axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vijesh A.V." <vijesh...@emirates.com>
Subject RE: Soap fault and ADB -- How to set the fault code
Date Tue, 03 Jul 2007 03:49:46 GMT

faultCode and faultString properties should have been available in
MyFaultException. MyFaultException extends Exception class, so you can
set faultString by setting message in Exception class.

What I did was I had included error code and error message (read fault
code and fault message) in MyFaultType

This is the soap trace when exception is thrown

<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
	<soapenv:Fault>
	<faultcode>soapenv:Client</faultcode>
	<faultstring>MyFaultException</faultstring>
	<detail>
	<ns2:MyFault
xmlns:ns2="http://www.test.com/general/exception/xsd">
	
	<!-- elements in MyFaultType -->
	<ns2:errorCode>TEST ERROR</ns2:errorCode>
	<ns2:message>Error Message</ns2:message>
	
	</ns2:MyFault>
	</detail>
	</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>


 

-----Original Message-----
From: Ali, Haneef [mailto:haneef.ali@hp.com] 
Sent: 02 July 2007 08:01
To: axis-user@ws.apache.org
Subject: Soap fault and ADB -- How to set the fault code


Hi,

I have a wsdl operation which throws fault of type "MyFault".

(i.e)  <element name="MyFault" type="MyFaultType" />

For this scenario ADB generates the following classes
   a) MyFaultException
   b) MyFault  derived from ADBbean
   c) MyFaultType

Class MyFault has MyFaultType as instance variable.  Exception MyFault
goes as detail in SOAPFault which is fine.  Now I don't understand how
to set faultCode and faultString.   I believe ADB should inherit the
class MyFaultException  from AxisFault instead of Exception? Can some
one please let me know how to set the faultCode and faultString?

Thanks,
Haneef
 

-----Original Message-----
From: Ali, Haneef
Sent: Monday, June 11, 2007 8:44 PM
To: axis-user@ws.apache.org
Subject: RE: SOAP fault - custom detail namespace

Thanks for the response. I do have the element and wsdl declaration. I
believe in this case Axis2 works as expected, and looks like Axis1.4 has
a bug.

1) Axis 2 desterilizes the elements only if the qName of the xmlFragment
matches.
1) Axis 1.4 tries to look for Qname. If it can't find Qname then it
looks for localName. If it finds localName then it desterilizes the
request, which I think is wrong

Can you please confirm whether this is a feature or bug in Axis 1.4? I
debugged the code and found that the following file is accepting the
fields even if they are not in the proper namespace.

Method : BeanDeSerializer.onStartChild
Line : 216
	The code is trying to get "BeanPropertyDescriptor" based on
Qname. If it can't find then it tries to find the
"BeanPropertyDescriptor" using localname, which is causing the problem.
(i.e) if you have xmlFragment where only "localName" matches, then it
desterilizes the bean which I think is wrong

Thanks,
Haneef

-----Original Message-----
From: Anne Thomas Manes [mailto:atmanes@gmail.com]
Sent: Monday, June 11, 2007 3:19 PM
To: axis-user@ws.apache.org
Subject: Re: SOAP fault - custom detail namespace

Based on your schema, the fault message should look like this:

  <env:Fault>
       <faultcode>env:Server</faultcode>
       <faultstring>Some message</faultstring>
       <detail>
               <n1:MyException xmlns:n1="http://MyNamespace">
                       <ns1:mesg1 xsi:nil="true"></ns1:mesg1>
                       <ns1:mesg2 xsi:nil="true"></ns1:mesg2>
                </n1:MyExceptio>
       </detail>
  </env:Fault>

Also, please verify that you have in fact defined an *element*. (The
schema fragment you showed us only defines a complex type.)

Make sure that this declaration is included in your schema:

   <xsd:element name="MyException" type="tns:MyException"/>

And make sure your WSDL fault message part references this element.

Anne

On 6/11/07, Ali, Haneef <haneef.ali@hp.com> wrote:
> Hi,
>
> I have the following complex Element
>
> <xsd:schema elementFormDefault="qualified"
> attributeFormDefault="qualified"
> targetNamespace="http://MyNamespace">
>
>  <xsd:complexType name="MyException">
>    <xsd:sequence>
>         <element name="mesg1" type="xsd:string" />
>         <element name="mesg2" type="xsd:string" />
>    </xsd:sequence>
> <xsd:complexType>
>
> <xsd:schema>
>
> I have omitted unnecessary implementation details. Bascially my 
> weblogic webservice throws this excecption and the xml in the wire 
> look like
>
>
> <env:Fault>
>         <faultcode>env:Server</faultcode>
>         <faultstring>Some message</faultstring>
>         <detail>
>                 <n1:MyException xmlns:n1="http://MyNamespace">
>                         <mesg1 xsi:nil="true"></mesg1>
>                         <mesg2 xsi:nil="true"></mesg2>
>                  </n1:MyExceptio>
>         </detail>
> </env:Fault>
>
>
> This xml fragment is accepted by both Axis 1.4 client and weblogic 
> client. Axis 2.0 rejects this.  Axis 2.0 is not able to findout the 
> namespace for  the element "mesg1' and "mesg2".
>
> Can you please let me know who is correct? I believe Axis2.0 is 
> correct
>
>
> Thanks,
> Haneef
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message