Groups | Blog | Home
all groups > asp.net webservices > october 2004 >

asp.net webservices : WSDL & Faults


Ryan Folstad via .NET 247
10/31/2004 3:54:50 AM
Hello,

I have been provided a wsdl file for a webservice that i would like to call
with .net. Everything works fine however if the method throws an exception
(fault) no SoapException is thrown and no response is visible from the
generated class.

2 questions.

1. From within the wsdl generated class file how do i see the actually soap
request/response in its entirety?

2. I've read that wsdl.exe cannot deal with custom faults:
wsdl snippet:
<portType name="MethodSoap">
<operation name="Method">
<input message="MethodIn/>
<output message="MethodOut/>
<fault name="Fault" message="Fault"/>
</operation>
</fault>

Soap response that .net can't handle:
<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body>
<faultcode xmlns="http://psfttemp.org">200</faultcode>
<faultstring>Custom Fault Error.</faultstring>
<runcode>0</runcode>
<detail>
<keyinformation><PERSON_ID>1</PERSON_ID></keyinformation>
<messages><type>Message</type>
<messagesetnumber>15</messagesetnumber>
<messagenumber>11</messagenumber>
<messagetext>Invalid value -- press the prompt button or
hyperlink for a list of valid values (15,11)</messagetext>
<explaintext>The value entered in the field does not match one
of the allowable values. You can see the allowable values by pressing the
Prompt button or hyperlink.</explaintext>
</messages>
</detail>
</soap:Body>
</soap:Envelope>


How can i modify the generated wsdl or generated class to properly read this
fault?

Any help is greatly appreciated!!!

Ryan

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

danro NO[at]SPAM microsoft.com
11/15/2004 11:44:53 PM
Hi Ryan,

The example you showed - the XML for a custom fault, is not valid according
to the SOAP spec. The Body element can only contain a single child
element, and the example you showed has several direct descendants. The
Fault element should be the one specified in the SOAP spec, and the custom
details should be placed in the Details element that is a part of the SOAP
Fault element.

It is entirely possible to use custom faults with .NET framework based
code... the XML received, however, has to be SOAP compliant.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
[quoted text, click to view]
cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09
.phx.gbl
[quoted text, click to view]
AddThis Social Bookmark Button