Home > .NET, Web Services > wsdl.exe generator for WSDL with modeled soap faults

wsdl.exe generator for WSDL with modeled soap faults

Here is common problem with faults modeled using WSCF (WebServiceContractFirst) tool – while trying to generate C# Proxy for a webservice WSDL, I have kept getting the following error:

Error: Unable to cast object of type ‘System.Xml.XmlElement’ to type ‘System.Web
.Services.Description.ServiceDescriptionFormatExtension’
.

After a careful investigation of WSDL on W3C, I have discovered that the the bogus definition ( that wsdl.exe can’t understand)  was in fault section of the binding:

<binding name=”SOAServices type=”tns:SOAServicesInterface“>

 <soap:binding transport=”http://schemas.xmlsoap.org/soap/http“/>

  <operation name=”ValidateUser“>

      <soap:operation soapAction=”soa:validateUserIn style=”document“/>

      <input>

             <soap:body use=”literal“/>

      </input>

      <output>

             <soap:body use=”literal“/>

      </output>

       <fault name=”ValidateUserFault“>

          <soap:body use=”literal“/>

      </fault>

   </operation>

</binding>

Replacing the definition to include soap:fault instead of soap:body resolves the problem.

<wsdl:fault name=” ValidateUserFault “>

        <soap:fault name=” ValidateUserFault use=”literal“/>

 </wsdl:fault>

It would have been nice if wsdl.exe will generate more information for the errors, but ….

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: