You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Daryoush Mehrtash <dm...@bea.com> on 2005/06/03 02:00:39 UTC

Problem with Soap fault in Axis 1.2

I have an application that I generated from a WSDL (running on axis
1.2).  The Faults that it generates doesn't seem to make sense to me.  I
would appreciate if any one can tell me if the fault messages shown
below are valid or not.

 

 

The method getPastTradePrice can throw two possible exceptions.  Here
are the messages that Axis sends in case of the exceptions:
 

MyOtherException:

 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server.generalException</faultcode>
            <faultstring />
            <detail>
                <web.MyOtherException>
                    <ns1:myOtherString
xmlns:ns1="http://web">xxxx</ns1:myOtherString>
                    <ns2:myString
xmlns:ns2="http://web">2ndString</ns2:myString>
                </web.MyOtherException>
                <ns3:exceptionName
xmlns:ns3="http://xml.apache.org/axis/">web.MyOtherException</ns3:except
ionName>
                <ns4:hostname
xmlns:ns4="http://xml.apache.org/axis/">DMEHRTAS02</ns4:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

 

 

 

InvalidTickerException:

 

 

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <soapenv:Fault>
            <faultcode>soapenv:Server.generalException</faultcode>
            <faultstring />
            <detail>
                <ns1:fault xmlns:ns1="http://web">
                    <ns1:tickerSymbol>xxx</ns1:tickerSymbol>
                </ns1:fault>
                <ns2:exceptionName
xmlns:ns2="http://xml.apache.org/axis/">web.InvalidTickerException</ns2:
exceptionName>
                <ns3:hostname
xmlns:ns3="http://xml.apache.org/axis/">DMEHRTAS02</ns3:hostname>
            </detail>
        </soapenv:Fault>
    </soapenv:Body>
</soapenv:Envelope>

 

 

I have the following questions:

 

 

1)  Why is it that one of the exceptions is serialized under <ns1:fault
xmlns:ns1="http://web">   and the other under <web.MyOtherException> ?
 
 
 
 
2)  What is the relationship between the detail and the wsdl,  in case
of   <web.MyOtherException> ?

 

The WSDL for the Fault message is defined as:

 
 
<schema.....>

 

<complexType name="MyOtherException">
    <sequence>
     <element name="myOtherString" nillable="true" type="xsd:string"/>
     <element name="myString" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>

 

   <element name="fault1" type="impl:MyOtherException"/>
</schema>

            ................

 

  <wsdl:message name="MyOtherException">
           <wsdl:part element="impl:fault1" name="fault"/>
         </wsdl:message>

 

Doesn't this mean that the detail should look something like:

 

             <detail>
                <ns1:MyOtherException xmlns:ns1="http://web">
                    <ns1:myOtherString>xxxx</ns1:myOtherString>
                    <ns1:myString>2ndString </ns1:myString>
                </ns1:MyOtherException>
            </detail>

 

 

 

 

Thanks,

 

Daryoush Mehrtash


Re: Problem with Soap fault in Axis 1.2

Posted by Anne Thomas Manes <at...@gmail.com>.
This definition:

  <schema…..>
    <complexType name="MyOtherException">
      <sequence>
        <element name="myOtherString" nillable="true" type="xsd:string"/>
        <element name="myString" nillable="true" type="xsd:string"/>
      </sequence>
    </complexType>
    <element name="fault1" type="impl:MyOtherException"/>
  </schema>
            …………….
  <wsdl:message name="MyOtherException">
       <wsdl:part element="impl:fault1" name="fault"/>
  </wsdl:message>
 
should produce this:

          <detail>
                <ns1:fault1 xmlns:ns1="your-schema-targetNamespace">
                    <ns1:myOtherString>xxxx</ns1:myOtherString>
                    <ns1:myString>2ndString</ns1:myString>
                </ns1:fault1>
           </detail>

(That's assuming you used elementFormDefault="qualified" -- if not,
then the two subelements would not be namespace qualified).

I suggest you file a bug report.

Anne


On 6/2/05, Daryoush Mehrtash <dm...@bea.com> wrote:
>  
>  
> 
> I have an application that I generated from a WSDL (running on axis 1.2). 
> The Faults that it generates doesn't seem to make sense to me.  I would
> appreciate if any one can tell me if the fault messages shown below are
> valid or not. 
> 
>   
> 
>   The method getPastTradePrice can throw two possible exceptions.  Here are
> the messages that Axis sends in case of the exceptions:
>  
>  
> 
> MyOtherException: 
> 
>   <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <soapenv:Body>
>         <soapenv:Fault>
>             <faultcode>soapenv:Server.generalException</faultcode>
>             <faultstring />
>             <detail>
>                 <web.MyOtherException>
>                     <ns1:myOtherString
> xmlns:ns1="http://web">xxxx</ns1:myOtherString>
>                     <ns2:myString
> xmlns:ns2="http://web">2ndString</ns2:myString>
>                 </web.MyOtherException>
>                 <ns3:exceptionName
> xmlns:ns3="http://xml.apache.org/axis/">web.MyOtherException</ns3:exceptionName>
>                 <ns4:hostname
> xmlns:ns4="http://xml.apache.org/axis/">DMEHRTAS02</ns4:hostname>
>             </detail>
>         </soapenv:Fault>
>     </soapenv:Body>
> </soapenv:Envelope>
>  
> 
>   
> 
>   
> 
>   
> 
> InvalidTickerException: 
> 
>   
> 
>   <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>     <soapenv:Body>
>         <soapenv:Fault>
>             <faultcode>soapenv:Server.generalException</faultcode>
>             <faultstring />
>             <detail>
>                 <ns1:fault xmlns:ns1="http://web">
>                    
> <ns1:tickerSymbol>xxx</ns1:tickerSymbol>
>                 </ns1:fault>
>                 <ns2:exceptionName
> xmlns:ns2="http://xml.apache.org/axis/">web.InvalidTickerException</ns2:exceptionName>
>                 <ns3:hostname
> xmlns:ns3="http://xml.apache.org/axis/">DMEHRTAS02</ns3:hostname>
>             </detail>
>         </soapenv:Fault>
>     </soapenv:Body>
> </soapenv:Envelope>
>  
> 
>   
> 
>   
> 
> I have the following questions: 
> 
>   
> 
>   1)  Why is it that one of the exceptions is serialized under <ns1:fault
> xmlns:ns1="http://web">   and the other under <web.MyOtherException> ?
>  
>  
>  
>  
> 2)  What is the relationship between the detail and the wsdl,  in case of  
> <web.MyOtherException> ?
>  
> 
>   
> 
> The WSDL for the Fault message is defined as:  
>  
> <schema…..>
>  
> 
>   <complexType name="MyOtherException">
>     <sequence>
>      <element name="myOtherString" nillable="true" type="xsd:string"/>
>      <element name="myString" nillable="true" type="xsd:string"/>
>     </sequence>
>    </complexType>
>  
> 
>      <element name="fault1" type="impl:MyOtherException"/>
> </schema>
>  
> 
>             ……………. 
> 
>     <wsdl:message name="MyOtherException">
>            <wsdl:part element="impl:fault1" name="fault"/>
>          </wsdl:message>
>  
> 
>   
> 
> Doesn't this mean that the detail should look something like: 
> 
>                <detail>
>                 <ns1:MyOtherException xmlns:ns1="http://web">
>                    
> <ns1:myOtherString>xxxx</ns1:myOtherString>
>                     <ns1:myString>2ndString </ns1:myString>
>                 </ns1:MyOtherException>
>             </detail>
>  
> 
>   
> 
>   
> 
>   
> 
>   
> 
> Thanks, 
> 
>   
> 
> Daryoush Mehrtash 
>