Home

"Add Connection" can't connect to web service with ?wsdl query fragment

edited July 2014
I'm trying to connect LINQPad to web services exposed by an existing software product. I'm fairly certain that the web services in question are implemented using WCF.

Using Visual Studio 2013 I can add a Web Service Reference to the web service by specifying the WSDL path in the URI (e.g. http://server/Ampla/Inventory/2010/03/Soap11?wsdl). This successfully builds a proxy class which I can use. Similarly, I can connect using WcfTestClient by passing in the URI ending in ?wsdl.

I can use svcutil.exe and csc.exe to compile a proxy client assembly, and then add that assembly as a reference in LINQPad, but I don't get the browsing tools of an added connection that way.

When I try to use the LINQPad "Add Connection" wizard, if I include the ?wsdl query in the URI, LINQPad rejects the URI ("ArgumentException: Expected an absolute, well formed http URL without a query or fragment". If I leave out the ?wsdl query, I get a "(400) Bad Request" response. There isn't a full exception message in LINQPad that I've been able to find, but attempting the same operation in WcfTestClient yields the following more complete error message:

Error: Cannot obtain Metadata from http://server/Ampla/Inventory/2010/03/Soap11 If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://server/Ampla/Inventory/2010/03/Soap11 Metadata contains a reference that cannot be resolved: 'http://server/Ampla/Inventory/2010/03/Soap11'. Content Type application/soap+xml; charset=utf-8 was not supported by service http://server/Ampla/Inventory/2010/03/Soap11. The client and service bindings may be mismatched. The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error URI: http://server/Ampla/Inventory/2010/03/Soap11 The document at the url http://server/Ampla/Inventory/2010/03/Soap11 was not recognized as a known document type.The error message from each known type may help you fix the problem:- Report from 'http://server/Ampla/Inventory/2010/03/Soap11' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.- Report from 'DISCO Document' is 'There was an error downloading 'http://localhost:8889/Ampla/Inventory/2010/03/Soap11?disco'.'. - Unable to connect to the remote server - No connection could be made because the target machine actively refused it 127.0.0.1:8889- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

So this error message suggests to me that the metadata configuration of the web services isn't set up the way LINQPad expects. Is there any way I can make LINQPad use the known location of the WSDL file (as Visual Studio and WcfTestClient can do), or am I stuck with just manually generating a proxy assembly and referencing it conventionally?

Comments

Sign In or Register to comment.