Reputation: 7238
I have a website with a Silverlight-enabled WCF service. The service works fine, and I can browse to the WSDL page in the browser with no problems.
Now, I am trying to create a client in a DLL. I need to create the whole client programmatically though, because it is being called in a DLL, which for whatever reason (by design?) won't read the ServiceModel section from its own config file.
So here is my code:
Dim endp As EndpointAddress = New EndpointAddress("http://www.mydomain.com/licensing/lic.svc")
Dim bind As WSHttpBinding = New WSHttpBinding()
Dim svc = New lnt.licClient(bind, endp)
Dim rsp = svc.CheckIt(key)
But when i call the svc.CheckIt method, i get the following error:
Content Type application/soap+xml; charset=utf-8 was not supported by service http://www.mydomain.com/licensing/lic.svc.
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 'application/soap+msbin1'.."}
How do I properly create my client so that these are properly "matched"??
Thanks in advance!!!
Upvotes: 11
Views: 20580
Reputation: 580
I ran into this same issue. More spefically my fix was to update the type of bindings I was using. I was using wsHttpBindings
instead of basicHttpBindings
. This was causing failures as wsHttpBindings
uses SOAP 1.2 while basicHttpBindings
use SOAP 1.1 and the service I was using required SOAP 1.1
Upvotes: 3
Reputation: 1
I had the same error. Service was compiling, client aplication too. Service reference in client aplication was updating reference succesfully. I've tried deleting and add reference once again and it was'nt helpfull. The problem was in removed interface in web service.
Upvotes: 0
Reputation: 7238
Ah --- found it. The ServiceModel section in the website's web.config
was set to customBinding. Changed it so it matched what the client was sending, and now it works beautifully.
Upvotes: 11