Adding Web Reference to a Web Service from a Virtual IP URL

While developing WebServices for any organization and asking other clients to use these services, you might have got many mails from clients saying I recieved following error: "Unable to download the following file from http://VIPURL:6098/MyWebSite/MyWebSite.asmx?wsdl. Do you want to skip this file and continue?"

Explaination: 

When we add Web Reference to a Web Service from local client Application, the port number of the proxy server (for ex 6098 ) is attached to the actaul VIP URL in the client proxy class instead of Listener port number of the actual proxy server (VIP URL in our case). This is the reason why port number 6098 is appended to the VIP  and not allowing to call the remote WebService. 

 when we use direct URL instead of VIP, there are no issues. 

Workaround for this: 

1) Use wsdl.exe tool of Visual Studio to generate the proxy class instead of using Add Web Reference wizard, modify the URL in the proxy class constructor to remove the port number at the end, compile it and add reference to this assembly in the Client application as reference to a normal assembly instead of Web Reference (Internally Add Web Reference wizard also uses wsdl.exe to create proxy class). 

(or) 

2) While adding Web Reference for the service, instead of specifying direct URL, specify URL?wsdl and then add the Web Reference. 

Ex: Type http://VIPURL/MyWebService/MyWebService.asmx?wsdl in the URL field instead of http://VIPURL/MyWebService/MyWebService.asmxx 

After adding the Web Reference, modify the web.config to change the URL to remove the port number at the end. 

Modify the appSettings entry of the Web.Config 

<add key="VIPURL.MyWebService" value="http://VIPURL:6098/MyWebService/MyWebService.asmx"/> 

to 

<add key="VIPURL.MyWebService"
value
="http://VIPURL/MyWebService/MyWebService.asmx"/>

By Santhosh N   Popularity  (1578 Views)
Picture
Biography - Santhosh N
Having around 7 years of experience in designing and implementing software products including windows, console, service oriented and ofcourse predominantly on Web with .Net, XML, Javascript, Oracle, SQL Server.
My Blog