You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Ali, Haneef" <ha...@hp.com> on 2007/07/02 06:00:44 UTC

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 <ha...@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