axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anne Thomas Manes <atma...@gmail.com>
Subject Re: [Axis2] Throwing faults
Date Wed, 04 Jan 2006 14:03:33 GMT
When defining the fault <wsdl:message>, the message part must reference an
element, not a type. The element must be defined in your <wsdl:types>
section.

When defining the <soap:fault>, you must not specify the encodingStyle or
namespace attributes, and you must specify use="literal". The style
attribute is not permitted in the <soap:fault> definition.

All of your binding definitions are not valid. You cannot use the
encodingStyle attribute with use "literal".

If you want to work with Axis2, I strongly recommend that you switch to
document/literal. (At the very least you must switch to rpc/literal.)

Anne

On 1/4/06, Rubén Naranjo Izquierdo <rnaranjo@alumnos.upm.es> wrote:
>
>   First of all, thank you Anne for your answer. I don't know if I
> understood you right, but even specifying document/literal on faults as
> follows:
>
> --------------------
> <wsdl:binding name="MyServicePortTypeSOAPBinding"
> type="tns:MyServicePortType">
>         <soap:binding style="rpc" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>
>         <wsdl:operation name="begin">
>                 <soap:operation
>                         soapAction="
> http://www.webservicestransactions.org/wsdl/myservice/2003/03/begin"
>                         style="rpc"/>
>                 <wsdl:input>
>                         <soap:body encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/"
>                                 namespace="
> http://www.webservicestransactions.org/schemas/myservice/2003/03"
>                                 use="literal"/>
>                 </wsdl:input>
>                 <wsdl:output>
>                         <soap:body encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/"
>                                 namespace="
> http://www.webservicestransactions.org/schemas/myservice/2003/03"
>                                 use="literal"/>
>                 </wsdl:output>
>                 <wsdl:fault name="GeneralFault">
>                         <soap:fault encodingStyle="
> http://schemas.xmlsoap.org/soap/encoding/"
>                                 namespace="
> http://www.webservicestransactions.org/schemas/wsctx/2003/03"
>                                 style="document"
>                                 use="literal"/>
>                 </wsdl:fault>
>         </wsdl:operation>
> </wsdl:binding>
> --------------------
>
>   I get the same code generated by wsd2java on the file: "
> MyServicePortTypeSkeleton.java", which doesn't throw any kind of
> exception...
>
> --------------------
> public class MyServicePortTypeSkeleton {
>         public  BegunDocument begin (BeginDocument param0 ) {
>                 //Todo fill this with the necessary business logic
>                 return null;
>         }
> }
> --------------------
>
>    I still can't understand what is the problem here. Thanks in advance.
>
>
>         Rubén
>
> On Tuesday 03 January 2006 23:27, Anne Thomas Manes wrote:
> > Note that faults should always be defined as document/literal.
> >
> > >From the WS-I Basic Profile:
> >
> >  4.4.2 Bindings and Faults
> >
> > There are several interpretations for how wsdl:part elements that
> describe
> > soapbind:fault, soapbind:header, and soapbind:headerfault may be
> defined.
> >
> >  R2205 A wsdl:binding in a DESCRIPTION MUST refer, in each of its
> > soapbind:header, soapbind:headerfault and soapbind:fault elements, only
> to
> > wsdl:part element(s) that have been defined using the element attribute.
> >
> > Because faults and headers do not contain parameters, soapbind:fault,
> > soapbind:header and soapbind:headerfault assume, per WSDL 1.1, that the
> > value of the style attribute is "document". R2204 requires that all
> > wsdl:part elements with a style attribute whose value is "document" that
> > are bound to soapbind:body be defined using the element attribute. This
> > requirement does the same for soapbind:fault, soapbind:header and
> > soapbind:headerfault elements.
> >
> > Anne
> >
> > On 1/3/06, Rubén Naranjo Izquierdo <rnaranjo@alumnos.upm.es> wrote:
> > >   Hi,
> > >
> > >   I'm migrating from Axis 1.3 and I want to know how can I throw
> faults
> > > from
> > > my service to a client in Axis 2.
> > >
> > >   In Axis 1.3 I had some wsdl code like this:
> > >
> > > --------------------
> > >         <wsdl:message name="GeneralFaultMessage">
> > >             <wsdl:part name="fault" type="xs:string"/>
> > >         </wsdl:message>
> > > (....)
> > >         <wsdl:portType name="MyServicePortType">
> > >                 <wsdl:operation name="begin">
> > >                         <wsdl:input message="tns:BeginMessage"/>
> > >                         <wsdl:output message="tns:BegunMessage"/>
> > >                                                 <wsdl:fault
> > > name="GeneralFault" message="tns:GeneralFaultMessage"/>
> > >                 </wsdl:operation>
> > >         </wsdl:portType>
> > > (....)
> > >     <wsdl:binding name="MyServicePortTypeSOAPBinding"
> > > type="tns:MyServicePortType">
> > >                 <soap:binding style="rpc" transport="
> > > http://schemas.xmlsoap.org/soap/http"/>
> > >
> > >         <wsdl:operation name="begin">
> > >                 <soap:operation
> > > soapAction="
> > > http://www.webservicestransactions.org/wsdl/myservice/2003/03/begin"
> > > style="rpc"/>
> > >                 <wsdl:input>
> > >                                                 <soap:body
> > > encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"
> > > namespace="
> > > http://www.webservicestransactions.org/schemas/myservice/2003/03"
> > > use="encoded"/>
> > >                 </wsdl:input>
> > >                 <wsdl:output>
> > >                                                 <soap:body
> > > encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"
> > > namespace="
> > > http://www.webservicestransactions.org/schemas/myservice/2003/03"
> > > use="encoded"/>
> > >                 </wsdl:output>
> > >                 <wsdl:fault name="GeneralFault">
> > >                                                 <soap:fault
> > > encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> > > namespace="
> http://www.webservicestransactions.org/schemas/wsctx/2003/03"
> > > use="encoded"/>
> > >                 </wsdl:fault>
> > >         </wsdl:operation>
> > > --------------------
> > >
> > >   And using that wsdl code, wsdl2java generates an interface like
> this:
> > >
> > > --------------------
> > > public interface MyServicePortType extends java.rmi.Remote {
> > >     public AssertionType begin(_begin content) throws RemoteException,
> > > GeneralFaultMessage;
> > > --------------------
> > >
> > >   But that doesn't work any more on Axis2. Even using "literal"
> instead
> > > of "encoding" in the bindings of the wsdl. The resulting code
> generated
> > > by Axis2's wsdl2java doesn't throw any kind of exception. The question
> > > is, should it be thrown or Axis2 handles faults in a different way? If
> > > exceptions
> > > must be thrown in the same way Axis1.3 did, what am I doing wrong?
> > >
> > >   Thank you so much in advance,
> > >
> > >
> > >   Rubén Naranjo Izquierdo
>

Mime
View raw message