Claus Konrad wrote:
> MSDN: "The Detail property is used to supply application-specific error
> details related to the Body element of the SOAP request. According to the
> SOAP specification, if an error occurs because the client request cannot be
> processed due to the Body element of the SOAP request, the Detail property
> must be set. If an error occurs in the header entries of the SOAP request,
> you must throw a SoapHeaderException, so that the error details are returned
> in the SOAP header. If the error does not occur, due to the processing of the
> Body element, then the Detail property must not be set"
>
> As you state yourself - the Detail property of the SOAPException is indeed
> an XmlElement, hence you can investigate it using XPath or the like.
>
> Like this (from memory):
> XmlDocument doc = new XmlDocument();
> doc.LoadXML(se.Detail.OuterXml);
>
> string msg = doc.SelectSingleNode("some tag....");
> --
> rgds.
> /Claus Konrad
> --
> rgds.
> /Claus Konrad
>
>
> "sydney.luu@gmail.com" wrote:
>
> > Hello!
> >
> > I am currently developing a Web Service client application in VS.NET
> > 2005. Everything
> > is working fine except I don't know how to capture the SOAP error code
> > along with the
> > error message generated on the Web Service call.
> >
> > Here's a sample of the <SOAP:Fault> I got:
> >
> > <SOAP:Envelope xmlns:SOAP="
http://schemas.xmlsoap.org/soap/envelope/"> > > <SOAP:Header/>
> > <SOAP:Body>
> > <SOAP:Fault>
> > <faultcode>SOAP:Server</faultcode>
> > <faultstring>Server Error</faultstring>
> > <detail>
> > <nr1:MT_FAULT_SO
> > xmlns:nr1="
http://xyz.com/xi/ecommerce/order_history"> > > <standard>
> > <faultText>Enter a valid customer number</faultText>
> > <faultDetail>
> > <severity>E</severity>
> > <text>Enter a valid customer number</text>
> > <id>004</id>
> > </faultDetail>
> > </standard>
> > </nr1:MT_FAULT_SO>
> > </detail>
> > </SOAP:Fault>
> > </SOAP:Body>
> > </SOAP:Envelope>
> >
> > I have the following TRY.. CATCH block in my VB.NET code:
> >
> > TRY
> > .....
> > CATCH se AS SOAPException
> > Console.WriteLine(se.Message) ---> shows "Server Error"
> > Console.WriteLine(se.Code) ---> shows
> > "
http://schemas.xmlsoap.org/soap/envelope/:Server"
> > Console.WriteLine(se.Detail) ---> shows "System.Xml.XmlElement"
> >
> >
> > How do I get the custom error inside the <Detail> element? Is there a
> > tool in which I can use
> > to generate the client WS proxy class, using the WSDL, that will also
> > include methods where
> > by I can access the SOAP Fault class / methods?
> >
> >
> > Thanks in advance!
> >
> > -Sydney
> >
> >