Monday, March 26, 2012

Connect to a web reference

I have a web service running on my local machine and I have added it to a Atlas project in Visual Studio using web reference. There are three files created under App_WebReferences\localhost: xxx.disco, xxx.discomap and xxx.wsdl. How should I reference it in the following Atlas tag:

<atlas:servicereferencepath="??"type="text/javascript"/>

Also in my web service code, it has the following line:

<%@dotnet.itags.org. WebService Language="c#" Codebehind="ServerStatus.asmx.cs" Class="Microsoft.TeamFoundation.Server.ServerStatus" %>

But when I use the methodMicrosoft.TeamFoundation.Server.ServerStatus.GetSupportedContractVersion, I get an error saying "Microsoft" is undefined.

In general the service code is not available. I suppose its class information should be in .wsdl file. But I am not sure where to locate it. Please help. Thanks.

I had the same problem. You are not able to call external webservices by importing a web reference. You need to wrap the external webservice in your own webservice implemented by an asmx file.
For this I created a C# library with Visual Studio and added a web reference in the library. Now I was able to add a reference to the reulting DLL and call the external webservice from MyWebservice.asmx.
You are obligate to use this solution when the webservice is located on a different server than where your website will be hosted, because Javascript can not make HTTP requests to other servers.
Maybe you can bridge to that particular external web service. I am currently reading the followinghttp://atlas.asp.net/docs/atlas/doc/bridge/default.aspx.

No comments:

Post a Comment