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 Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> on 2006/01/10 17:37:40 UTC

[Axis2] Problems with WSDL2Java and Soap:Header

  Hello all.

  I have the following wsdl file (attached at the end of the message), that uses a "soap:header" in the operation "begin" of the PortType "MyServicePortType".

  Axis2's wsd2java generates all code reporting no errors, but the code generated doesn't compile. The problem is that in the Skeleton, it generates al method like this:

        public  voidBegunDocument begin (BeginDocument param){
                //Todo fill this with the necessary business logic
                return null;
        }

  As it can be seen, the metod has two return types: "void" and "BegunDocument" with no separation between them. 

  I can remove "void" and the code will compile, but all the rest of the classes asume that "begin" returns "void" instead of "BegunDocument" (specially disturbing in the stub, wich returns nothing).

  If I remove the "soap:header" line in the wsdl file, the code is generated correctly, not only in the skeleton, but also in the stub.

  I'm able to modify the code generated by wsdl2java so it can return the correct values, or even take the code generated by the wsdl without soap:header. But, will the headers be sent and received correctly? Is my wsdl wrong? Sould I wait for Axis2 0.94 release and try again?

  Thank you so much in advance, 

       Rubén

P.S.: Following you can find the wsdl code.


<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tns="http://www.my-enterprise.org/2005/10/srvc"
	xmlns:srvc="http://www.my-enterprise.org/schemas/2005/10/srvc"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

	targetNamespace="http://www.my-enterprise.org/2005/10/srvc">

    <wsdl:types>
        <xs:schema>
            <xs:import namespace="http://www.my-enterprise.org/schemas/2005/10/srvc" schemaLocation="srvc.xsd"/>
        </xs:schema>
    </wsdl:types>

    <wsdl:message name="HeaderMessage">
        <wsdl:part element="srvc:header" name="hdr"/>
    </wsdl:message>

    <wsdl:message name="BeginMessage">
        <wsdl:part element="srvc:begin" name="content"/>
    </wsdl:message>

    <wsdl:message name="BegunMessage">
        <wsdl:part element="srvc:begun" name="content"/>
    </wsdl:message>

    <wsdl:portType name="MyServicePortType">
        <wsdl:operation name="begin">
            <wsdl:input  message="tns:BeginMessage"/>
			<wsdl:output message="tns:BegunMessage"/>
        </wsdl:operation>
    </wsdl:portType>

    <!-- SOAP 1.1 over HTTP bindings -->

    <wsdl:binding name="MyServicePortTypeSOAPBinding" type="tns:MyServicePortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

        <wsdl:operation name="begin">
			<soap:operation soapAction="begin" style="rpc"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
				<soap:header part="hdr" message="tns:HeaderMessage" use="literal"/>
			</wsdl:output>
        </wsdl:operation>

    </wsdl:binding>

</wsdl:definitions>


Re: [Axis2] Problems with WSDL2Java and Soap:Header

Posted by Davanum Srinivas <da...@gmail.com>.
Rubén,

time to log bug :)

-- dims

On 1/13/06, Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> wrote:
>    The problem persists using Axis2 0.94's wsdl2java.
>
> On Wednesday 11 January 2006 10:08, Rubén Naranjo Izquierdo wrote:
> >   Hello Anne,
> >
> >   Thank you for your help, but even removing the style="rpc" attribute, I
> > get the same code generation :(
> >
> >   Has somebody any other suggestion?
> >
> >   Thanks,
> >
> >      Rubén
> >
> > On Wednesday 11 January 2006 00:22, Anne Thomas Manes wrote:
> > > Remove the style="rpc" attribute from your <soap:operation> definition.
> > > RCP style is not compatible with way you've defined your messages.
> > >
> > > Anne
> > >
> > > On 1/10/06, Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> wrote:
> > > >   Hello all.
> > > >
> > > >   I have the following wsdl file (attached at the end of the message),
> > > > that uses a "soap:header" in the operation "begin" of the PortType
> > > > "MyServicePortType".
> > > >
> > > >   Axis2's wsd2java generates all code reporting no errors, but the code
> > > > generated doesn't compile. The problem is that in the Skeleton, it
> > > > generates al method like this:
> > > >
> > > >         public  voidBegunDocument begin (BeginDocument param){
> > > >                 //Todo fill this with the necessary business logic
> > > >                 return null;
> > > >         }
> > > >
> > > >   As it can be seen, the metod has two return types: "void" and
> > > > "BegunDocument" with no separation between them.
> > > >
> > > >   I can remove "void" and the code will compile, but all the rest of
> > > > the classes asume that "begin" returns "void" instead of
> > > > "BegunDocument" (specially disturbing in the stub, wich returns
> > > > nothing).
> > > >
> > > >   If I remove the "soap:header" line in the wsdl file, the code is
> > > > generated correctly, not only in the skeleton, but also in the stub.
> > > >
> > > >   I'm able to modify the code generated by wsdl2java so it can return
> > > > the correct values, or even take the code generated by the wsdl without
> > > > soap:header. But, will the headers be sent and received correctly? Is
> > > > my wsdl wrong? Sould I wait for Axis2 0.94 release and try again?
> > > >
> > > >   Thank you so much in advance,
> > > >
> > > >        Rubén
> > > >
> > > > P.S.: Following you can find the wsdl code.
> > > >
> > > >
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > >
> > > > <wsdl:definitions
> > > >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > > >         xmlns:tns="http://www.my-enterprise.org/2005/10/srvc"
> > > >         xmlns:srvc="http://www.my-enterprise.org/schemas/2005/10/srvc"
> > > >         xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > > >         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > > >         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > > >
> > > >         targetNamespace="http://www.my-enterprise.org/2005/10/srvc">
> > > >
> > > >     <wsdl:types>
> > > >         <xs:schema>
> > > >             <xs:import namespace="
> > > > http://www.my-enterprise.org/schemas/2005/10/srvc" schemaLocation="
> > > > srvc.xsd"/>
> > > >         </xs:schema>
> > > >     </wsdl:types>
> > > >
> > > >     <wsdl:message name="HeaderMessage">
> > > >         <wsdl:part element="srvc:header" name="hdr"/>
> > > >     </wsdl:message>
> > > >
> > > >     <wsdl:message name="BeginMessage">
> > > >         <wsdl:part element="srvc:begin" name="content"/>
> > > >     </wsdl:message>
> > > >
> > > >     <wsdl:message name="BegunMessage">
> > > >         <wsdl:part element="srvc:begun" name="content"/>
> > > >     </wsdl:message>
> > > >
> > > >     <wsdl:portType name="MyServicePortType">
> > > >         <wsdl:operation name="begin">
> > > >             <wsdl:input  message="tns:BeginMessage"/>
> > > >                         <wsdl:output message="tns:BegunMessage"/>
> > > >         </wsdl:operation>
> > > >     </wsdl:portType>
> > > >
> > > >     <!-- SOAP 1.1 over HTTP bindings -->
> > > >
> > > >     <wsdl:binding name="MyServicePortTypeSOAPBinding"
> > > > type="tns:MyServicePortType">
> > > >         <soap:binding style="document" transport="
> > > > http://schemas.xmlsoap.org/soap/http"/>
> > > >
> > > >         <wsdl:operation name="begin">
> > > >                         <soap:operation soapAction="begin"
> > > > style="rpc"/> <wsdl:input>
> > > >                 <soap:body use="literal"/>
> > > >             </wsdl:input>
> > > >             <wsdl:output>
> > > >                 <soap:body use="literal"/>
> > > >                                 <soap:header part="hdr"
> > > > message="tns:HeaderMessage" use="literal"/>
> > > >                         </wsdl:output>
> > > >         </wsdl:operation>
> > > >
> > > >     </wsdl:binding>
> > > >
> > > > </wsdl:definitions>
>


--
Davanum Srinivas : http://wso2.com/blogs/

Re: [Axis2] Problems with WSDL2Java and Soap:Header

Posted by Rubén Naranjo Izquierdo <rn...@alumnos.upm.es>.
   The problem persists using Axis2 0.94's wsdl2java.

On Wednesday 11 January 2006 10:08, Rubén Naranjo Izquierdo wrote:
>   Hello Anne,
>
>   Thank you for your help, but even removing the style="rpc" attribute, I
> get the same code generation :(
>
>   Has somebody any other suggestion?
>
>   Thanks,
>
>      Rubén
>
> On Wednesday 11 January 2006 00:22, Anne Thomas Manes wrote:
> > Remove the style="rpc" attribute from your <soap:operation> definition.
> > RCP style is not compatible with way you've defined your messages.
> >
> > Anne
> >
> > On 1/10/06, Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> wrote:
> > >   Hello all.
> > >
> > >   I have the following wsdl file (attached at the end of the message),
> > > that uses a "soap:header" in the operation "begin" of the PortType
> > > "MyServicePortType".
> > >
> > >   Axis2's wsd2java generates all code reporting no errors, but the code
> > > generated doesn't compile. The problem is that in the Skeleton, it
> > > generates al method like this:
> > >
> > >         public  voidBegunDocument begin (BeginDocument param){
> > >                 //Todo fill this with the necessary business logic
> > >                 return null;
> > >         }
> > >
> > >   As it can be seen, the metod has two return types: "void" and
> > > "BegunDocument" with no separation between them.
> > >
> > >   I can remove "void" and the code will compile, but all the rest of
> > > the classes asume that "begin" returns "void" instead of
> > > "BegunDocument" (specially disturbing in the stub, wich returns
> > > nothing).
> > >
> > >   If I remove the "soap:header" line in the wsdl file, the code is
> > > generated correctly, not only in the skeleton, but also in the stub.
> > >
> > >   I'm able to modify the code generated by wsdl2java so it can return
> > > the correct values, or even take the code generated by the wsdl without
> > > soap:header. But, will the headers be sent and received correctly? Is
> > > my wsdl wrong? Sould I wait for Axis2 0.94 release and try again?
> > >
> > >   Thank you so much in advance,
> > >
> > >        Rubén
> > >
> > > P.S.: Following you can find the wsdl code.
> > >
> > >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > >
> > > <wsdl:definitions
> > >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > >         xmlns:tns="http://www.my-enterprise.org/2005/10/srvc"
> > >         xmlns:srvc="http://www.my-enterprise.org/schemas/2005/10/srvc"
> > >         xmlns:xs="http://www.w3.org/2001/XMLSchema"
> > >         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> > >         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> > >
> > >         targetNamespace="http://www.my-enterprise.org/2005/10/srvc">
> > >
> > >     <wsdl:types>
> > >         <xs:schema>
> > >             <xs:import namespace="
> > > http://www.my-enterprise.org/schemas/2005/10/srvc" schemaLocation="
> > > srvc.xsd"/>
> > >         </xs:schema>
> > >     </wsdl:types>
> > >
> > >     <wsdl:message name="HeaderMessage">
> > >         <wsdl:part element="srvc:header" name="hdr"/>
> > >     </wsdl:message>
> > >
> > >     <wsdl:message name="BeginMessage">
> > >         <wsdl:part element="srvc:begin" name="content"/>
> > >     </wsdl:message>
> > >
> > >     <wsdl:message name="BegunMessage">
> > >         <wsdl:part element="srvc:begun" name="content"/>
> > >     </wsdl:message>
> > >
> > >     <wsdl:portType name="MyServicePortType">
> > >         <wsdl:operation name="begin">
> > >             <wsdl:input  message="tns:BeginMessage"/>
> > >                         <wsdl:output message="tns:BegunMessage"/>
> > >         </wsdl:operation>
> > >     </wsdl:portType>
> > >
> > >     <!-- SOAP 1.1 over HTTP bindings -->
> > >
> > >     <wsdl:binding name="MyServicePortTypeSOAPBinding"
> > > type="tns:MyServicePortType">
> > >         <soap:binding style="document" transport="
> > > http://schemas.xmlsoap.org/soap/http"/>
> > >
> > >         <wsdl:operation name="begin">
> > >                         <soap:operation soapAction="begin"
> > > style="rpc"/> <wsdl:input>
> > >                 <soap:body use="literal"/>
> > >             </wsdl:input>
> > >             <wsdl:output>
> > >                 <soap:body use="literal"/>
> > >                                 <soap:header part="hdr"
> > > message="tns:HeaderMessage" use="literal"/>
> > >                         </wsdl:output>
> > >         </wsdl:operation>
> > >
> > >     </wsdl:binding>
> > >
> > > </wsdl:definitions>

Re: [Axis2] Problems with WSDL2Java and Soap:Header

Posted by Rubén Naranjo Izquierdo <rn...@alumnos.upm.es>.
  Hello Anne, 

  Thank you for your help, but even removing the style="rpc" attribute, I get 
the same code generation :(

  Has somebody any other suggestion?

  Thanks,

     Rubén

On Wednesday 11 January 2006 00:22, Anne Thomas Manes wrote:
> Remove the style="rpc" attribute from your <soap:operation> definition.
> RCP style is not compatible with way you've defined your messages.
>
> Anne
>
> On 1/10/06, Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> wrote:
> >   Hello all.
> >
> >   I have the following wsdl file (attached at the end of the message),
> > that uses a "soap:header" in the operation "begin" of the PortType
> > "MyServicePortType".
> >
> >   Axis2's wsd2java generates all code reporting no errors, but the code
> > generated doesn't compile. The problem is that in the Skeleton, it
> > generates al method like this:
> >
> >         public  voidBegunDocument begin (BeginDocument param){
> >                 //Todo fill this with the necessary business logic
> >                 return null;
> >         }
> >
> >   As it can be seen, the metod has two return types: "void" and
> > "BegunDocument" with no separation between them.
> >
> >   I can remove "void" and the code will compile, but all the rest of the
> > classes asume that "begin" returns "void" instead of "BegunDocument"
> > (specially disturbing in the stub, wich returns nothing).
> >
> >   If I remove the "soap:header" line in the wsdl file, the code is
> > generated correctly, not only in the skeleton, but also in the stub.
> >
> >   I'm able to modify the code generated by wsdl2java so it can return the
> > correct values, or even take the code generated by the wsdl without
> > soap:header. But, will the headers be sent and received correctly? Is my
> > wsdl wrong? Sould I wait for Axis2 0.94 release and try again?
> >
> >   Thank you so much in advance,
> >
> >        Rubén
> >
> > P.S.: Following you can find the wsdl code.
> >
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> >
> > <wsdl:definitions
> >         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >         xmlns:tns="http://www.my-enterprise.org/2005/10/srvc"
> >         xmlns:srvc="http://www.my-enterprise.org/schemas/2005/10/srvc"
> >         xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> >         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> >
> >         targetNamespace="http://www.my-enterprise.org/2005/10/srvc">
> >
> >     <wsdl:types>
> >         <xs:schema>
> >             <xs:import namespace="
> > http://www.my-enterprise.org/schemas/2005/10/srvc" schemaLocation="
> > srvc.xsd"/>
> >         </xs:schema>
> >     </wsdl:types>
> >
> >     <wsdl:message name="HeaderMessage">
> >         <wsdl:part element="srvc:header" name="hdr"/>
> >     </wsdl:message>
> >
> >     <wsdl:message name="BeginMessage">
> >         <wsdl:part element="srvc:begin" name="content"/>
> >     </wsdl:message>
> >
> >     <wsdl:message name="BegunMessage">
> >         <wsdl:part element="srvc:begun" name="content"/>
> >     </wsdl:message>
> >
> >     <wsdl:portType name="MyServicePortType">
> >         <wsdl:operation name="begin">
> >             <wsdl:input  message="tns:BeginMessage"/>
> >                         <wsdl:output message="tns:BegunMessage"/>
> >         </wsdl:operation>
> >     </wsdl:portType>
> >
> >     <!-- SOAP 1.1 over HTTP bindings -->
> >
> >     <wsdl:binding name="MyServicePortTypeSOAPBinding"
> > type="tns:MyServicePortType">
> >         <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >
> >         <wsdl:operation name="begin">
> >                         <soap:operation soapAction="begin" style="rpc"/>
> >             <wsdl:input>
> >                 <soap:body use="literal"/>
> >             </wsdl:input>
> >             <wsdl:output>
> >                 <soap:body use="literal"/>
> >                                 <soap:header part="hdr"
> > message="tns:HeaderMessage" use="literal"/>
> >                         </wsdl:output>
> >         </wsdl:operation>
> >
> >     </wsdl:binding>
> >
> > </wsdl:definitions>

Re: [Axis2] Problems with WSDL2Java and Soap:Header

Posted by Anne Thomas Manes <at...@gmail.com>.
Remove the style="rpc" attribute from your <soap:operation> definition.
RCP style is not compatible with way you've defined your messages.

Anne

On 1/10/06, Rubén Naranjo Izquierdo <rn...@alumnos.upm.es> wrote:
>
>   Hello all.
>
>   I have the following wsdl file (attached at the end of the message),
> that uses a "soap:header" in the operation "begin" of the PortType
> "MyServicePortType".
>
>   Axis2's wsd2java generates all code reporting no errors, but the code
> generated doesn't compile. The problem is that in the Skeleton, it generates
> al method like this:
>
>         public  voidBegunDocument begin (BeginDocument param){
>                 //Todo fill this with the necessary business logic
>                 return null;
>         }
>
>   As it can be seen, the metod has two return types: "void" and
> "BegunDocument" with no separation between them.
>
>   I can remove "void" and the code will compile, but all the rest of the
> classes asume that "begin" returns "void" instead of "BegunDocument"
> (specially disturbing in the stub, wich returns nothing).
>
>   If I remove the "soap:header" line in the wsdl file, the code is
> generated correctly, not only in the skeleton, but also in the stub.
>
>   I'm able to modify the code generated by wsdl2java so it can return the
> correct values, or even take the code generated by the wsdl without
> soap:header. But, will the headers be sent and received correctly? Is my
> wsdl wrong? Sould I wait for Axis2 0.94 release and try again?
>
>   Thank you so much in advance,
>
>        Rubén
>
> P.S.: Following you can find the wsdl code.
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <wsdl:definitions
>         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>         xmlns:tns="http://www.my-enterprise.org/2005/10/srvc"
>         xmlns:srvc="http://www.my-enterprise.org/schemas/2005/10/srvc"
>         xmlns:xs="http://www.w3.org/2001/XMLSchema"
>         xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>
>         targetNamespace="http://www.my-enterprise.org/2005/10/srvc">
>
>     <wsdl:types>
>         <xs:schema>
>             <xs:import namespace="
> http://www.my-enterprise.org/schemas/2005/10/srvc" schemaLocation="
> srvc.xsd"/>
>         </xs:schema>
>     </wsdl:types>
>
>     <wsdl:message name="HeaderMessage">
>         <wsdl:part element="srvc:header" name="hdr"/>
>     </wsdl:message>
>
>     <wsdl:message name="BeginMessage">
>         <wsdl:part element="srvc:begin" name="content"/>
>     </wsdl:message>
>
>     <wsdl:message name="BegunMessage">
>         <wsdl:part element="srvc:begun" name="content"/>
>     </wsdl:message>
>
>     <wsdl:portType name="MyServicePortType">
>         <wsdl:operation name="begin">
>             <wsdl:input  message="tns:BeginMessage"/>
>                         <wsdl:output message="tns:BegunMessage"/>
>         </wsdl:operation>
>     </wsdl:portType>
>
>     <!-- SOAP 1.1 over HTTP bindings -->
>
>     <wsdl:binding name="MyServicePortTypeSOAPBinding"
> type="tns:MyServicePortType">
>         <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>
>         <wsdl:operation name="begin">
>                         <soap:operation soapAction="begin" style="rpc"/>
>             <wsdl:input>
>                 <soap:body use="literal"/>
>             </wsdl:input>
>             <wsdl:output>
>                 <soap:body use="literal"/>
>                                 <soap:header part="hdr"
> message="tns:HeaderMessage" use="literal"/>
>                         </wsdl:output>
>         </wsdl:operation>
>
>     </wsdl:binding>
>
> </wsdl:definitions>
>
>