cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Web scripts in Dot net

ecm09
Champ in-the-making
Champ in-the-making
Hi,

I am using the .net framework 3.5. I tried to consume the web scripts using dot net web services.

When I tried to add the path in the Addd web reference, It shows me the error  as below Smiley Happy

"The HTML document does not contain Web service discovery"

It seems that the web script which I am trying to use is in the HTML format. I tried to convert in WSDL, but it throws an error.

Please share me the steps and the snapshots or links (if possible),  to solve this issue.

Thanks in  advance.

Regards
Arun
8 REPLIES 8

zaizi
Champ in-the-making
Champ in-the-making
Web scripts are REST based web services. You can't use Visual Studio to add them as web references.

You are going to have to fetch it yourself and parse it;


var request = WebRequest.Create(requestUri);
            using (var response = request.GetResponse())
            {
                using (var responseStream = response.GetResponseStream())
                {
                    // parse the result and do something with it
                    return result;
                }
            }

ecm09
Champ in-the-making
Champ in-the-making
Hi,

  Thanks for your reply.
  When I tried to access the http://localhost:8080/alfresco/service/index/uri/api/people/{userName} in the code replied.
  I returns me an error "The remote server returned an error: (401) Unauthorized"
  The server is tomcat server running as a remote.
  I am using the below code in the dot net windows application  (Framework 3.5)

HttpWebRequest request = WebRequest.Create("http://localhost:8080/alfresco/service/index/uri/api/people/{userName}") as HttpWebRequest;
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader Rdr = new StreamReader(response.GetResponseStream());
                    MessageBox.Show(Rdr.ReadToEnd());
                }

Please reslove me this error and share the steps to pass the credentials.


Regards
Arun

mikeh
Star Contributor
Star Contributor
Use HTTP Basic authentication  in the request header.

Thanks,
Mike

ecm09
Champ in-the-making
Champ in-the-making
Hi,

Thanks for the reply.
I am trying to use Dot net Framework 3.5 by which I would like to write web services for creating a folder, storing and update the documents etc.
I downloaded the Alfresco version 3.1.
My question is

1. Does Alfresco v3.1 supports WSDL?
2. Which version should be used to support WSDL for writing dot net web services?
3. Could you plesae share the link to download the version supporting Dot net web services?

Please guide me the steps to be followed for consuming the WSDL from ALFRESCO to my web services.

Thanks,
Arun

unknown-user
Champ on-the-rise
Champ on-the-rise
At this time your best chance to getting code working in .NET is to download the Alfresco toolkit.
It does not use WCF/Framework 3.5 but this is your best chance. It uses WSE 1.0
I have run into too many issues with the Alfresco wsdl under the VS 2008/ 3.5 framework.
It will not properly generate a working proxy.
Go to Alfresco Forge and download the .NET toolkit.

vivekm1981
Champ in-the-making
Champ in-the-making
Alfresco forge's .net toolkit will only support webservices, but if we want to access say share's blog feature using .net 3.5/wcf, how we could achieve that ?

mrogers
Star Contributor
Star Contributor
Web Scripts are bog standard HTTP.    WCF is aimed at Web Services and won't help.

buurd
Champ in-the-making
Champ in-the-making
You need to learn the http-protocol and how to use it under .Net. When you have that knowleadge it is easy to call webscripts. Unfortunally I havn't seen any good tools to simulate mulipart-forms in .Net, as example.