Monday, February 2, 2009

Pseudo errors when referencing WSDLS

@YaronNaveh

Sometimes when you "add service reference" in VS 2008 you will get a few warnings (see below). When using svcutil like this:


$> svcutil http://myHost/Service.asmx?WSDL


these warnings may appear as errors.

If you get these errors/warnings:


Attempting to download metadata from 'http://myHost/Service.asmx?WSDL' using WS-Metadata Exchange or DISCO.
Error: Cannot import wsdl:binding
Detail: The required WSDL extension element 'binding' from namespace 'http://sch
emas.xmlsoap.org/wsdl/http/' was not handled.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://myNamespace/']/wsdl:binding

[@name='myBindingHttpPost']


Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://myNamespace/']/wsdl:binding

[@name='myBindingHttpPost']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://myNamespace/']/wsdl:service

[@name='myService']/wsdl:port[@name='myPort'
]


Generating files...


Then (usually) you have nothing to worry about. What they mean is that your WSDL contains a binding which uses HTTP Post transport. For example:


<wsdl:binding name="myHttpPost" type="tns:MyHttpPost">
  <http:binding verb="POST" />
...


WCF does not support this binding and so raised an error. So why you have nothing to worry about? The reason is that usually when a WSDL contains a HTTP Post binding it also contains a SOAP one and WCF can work with it. For example:



<wsdl:binding name="mySoapBinding" type="tns:mySoapPortType">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
...


Actually you can see that even though errors have occured a functioning proxy was still generated.

Note that if you create a .NET 2.0 (asmx) web service then there is a configuration to determine if a HTTP Post binding should be created. I can't find it now but promise to post the details later on...

@YaronNaveh

What's next? get this blog rss updates or register for mail updates!

0 comments: