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 Guo Tianchong <gu...@nec-as.nec.com.cn> on 2009/02/18 11:08:37 UTC

how to make classes for by wsdl2java

hi all,

I am using wsdl2java command to create java class.
Now, I can create classes for my <soap:Body>'s child elements.
but, how to make classes for <soap:Header>'s child elements?

My resquest/response soap message is the following:

----> request message
<soap:Enveloper ...>
    <soap:Header>
      <mh:ID soap:mustUnderstand="1">1<mh:ID>
      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
    </soap:Header>
    <soap:Body>
      <mh:Inform>
        ... ...
      </mh:Inform>
    <soap:Body>
</soap:Enveloper>

---->response message
<soap:Enveloper ...>
    <soap:Header>
      <mh:ID soap:mustUnderstand="1">1<mh:ID>
      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
    </soap:Header>
    <soap:Body>
      <mh:InformResponse>
        ... ...
      </mh:InformResponse>
    <soap:Body>
</soap:Enveloper>


************and my .wsdl file is:
<definitions>
....
<types>
  <xsd:schema targetNamespace="...">
    <xs:element name="Inform">
      <xs:complexType>
        <xs:sequence>
          ....
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="InformResponse">
      <xs:complexType>
        <xs:sequence>
          ....
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xsd:schema>
</types>

<message name="Headers">
  <part name="ID" element="tns:ID" />
  <part name="MACAddress" element="tns:MACAddress" />
</message>
<message name="InformRequest">
  <part name="part0" element="tns:Inform" />
</message>
<message name="InformResponse">
  <part name="part0" element="tns:InformResponse" />
</message>

.....

<binding name="Mybinding" type="tns:MyportType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="inform">
      <soap:operation style="document" soapAction="urn:inform" />
      <input>
        <soap:header message="tns:Headers" part="ID" use="literal" />
        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
        <soap:body use="literal" />
      </input>
      <output>
        <soap:header message="tns:Headers" part="ID" use="literal" />
        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
....

</definitions>



Now, I can create InformDocument & InformResponseDocument classes,
but how can make classes for <soap:Header> by wsdl2java?

Thanks for any help!

Guo


Re: how to make classes for by wsdl2java

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
hi all,

It seems that this is one solution.
Thanks! Yves-Marie.

Does anybody know that how to make classes for <soap:Header> by wsdl2java
without AXIOM-API(s) ?

such as,  create the following classes by wsdl2java.
 mypackage.ID;
 mypackage.MACAddress;


Regards!

Guo

----- Original Message ----- 
From: "DANIEL, Yves Marie" <yv...@capgemini.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, February 18, 2009 7:22 PM
Subject: RE: how to make classes for <soap:Header> by wsdl2java


|I don't konw, but you can add elements in the header with :
|
|
|        QName elementName = new QName( "YOUR_ID" );
|        OMFactory omFactory = OMAbstractFactory.getOMFactory();
|        OMElement omElement = omFactory.createOMElement( elementName, null );
|        omElement.setText( "YOUR_VALUE" );
|        this._YOUR_STUB._getServiceClient().addHeader( omElement );
|
|
| Yves-Marie
|
|
|
|
|
| -----Message d'origine-----
| De : Guo Tianchong [mailto:guotc@nec-as.nec.com.cn]
| Envoyé : mercredi 18 février 2009 11:09
| À : axis-user
| Objet : how to make classes for <soap:Header> by wsdl2java
|
| hi all,
|
| I am using wsdl2java command to create java class.
| Now, I can create classes for my <soap:Body>'s child elements.
| but, how to make classes for <soap:Header>'s child elements?
|
| My resquest/response soap message is the following:
|
| ----> request message
| <soap:Enveloper ...>
|    <soap:Header>
|      <mh:ID soap:mustUnderstand="1">1<mh:ID>
|      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
|    </soap:Header>
|    <soap:Body>
|      <mh:Inform>
|        ... ...
|      </mh:Inform>
|    <soap:Body>
| </soap:Enveloper>
|
| ---->response message
| <soap:Enveloper ...>
|    <soap:Header>
|      <mh:ID soap:mustUnderstand="1">1<mh:ID>
|      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
|    </soap:Header>
|    <soap:Body>
|      <mh:InformResponse>
|        ... ...
|      </mh:InformResponse>
|    <soap:Body>
| </soap:Enveloper>
|
|
| ************and my .wsdl file is:
| <definitions>
| ....
| <types>
|  <xsd:schema targetNamespace="...">
|    <xs:element name="Inform">
|      <xs:complexType>
|        <xs:sequence>
|          ....
|        </xs:sequence>
|      </xs:complexType>
|    </xs:element>
|    <xs:element name="InformResponse">
|      <xs:complexType>
|        <xs:sequence>
|          ....
|        </xs:sequence>
|      </xs:complexType>
|    </xs:element>
|  </xsd:schema>
| </types>
|
| <message name="Headers">
|  <part name="ID" element="tns:ID" />
|  <part name="MACAddress" element="tns:MACAddress" /> </message> <message name="InformRequest">
|  <part name="part0" element="tns:Inform" /> </message> <message name="InformResponse">
|  <part name="part0" element="tns:InformResponse" /> </message>
|
| .....
|
| <binding name="Mybinding" type="tns:MyportType">
|    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
|    <operation name="inform">
|      <soap:operation style="document" soapAction="urn:inform" />
|      <input>
|        <soap:header message="tns:Headers" part="ID" use="literal" />
|        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
|        <soap:body use="literal" />
|      </input>
|      <output>
|        <soap:header message="tns:Headers" part="ID" use="literal" />
|        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
|        <soap:body use="literal" />
|      </output>
|    </operation>
|  </binding>
| ....
|
| </definitions>
|
|
|
| Now, I can create InformDocument & InformResponseDocument classes, but how can make classes for <soap:Header> by wsdl2java?
|
| Thanks for any help!
|
| Guo
|
|
|
|
|
|
|
| This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is
| intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to
| read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message
| in error, please notify the sender immediately and delete all copies of this message.
| 


RE: how to make classes for by wsdl2java

Posted by "DANIEL, Yves Marie" <yv...@capgemini.com>.
I don't konw, but you can add elements in the header with :


        QName elementName = new QName( "YOUR_ID" );
        OMFactory omFactory = OMAbstractFactory.getOMFactory();
        OMElement omElement = omFactory.createOMElement( elementName, null );
        omElement.setText( "YOUR_VALUE" );
        this._YOUR_STUB._getServiceClient().addHeader( omElement ); 


Yves-Marie 

 

 

-----Message d'origine-----
De : Guo Tianchong [mailto:guotc@nec-as.nec.com.cn] 
Envoyé : mercredi 18 février 2009 11:09
À : axis-user
Objet : how to make classes for <soap:Header> by wsdl2java

hi all,

I am using wsdl2java command to create java class.
Now, I can create classes for my <soap:Body>'s child elements.
but, how to make classes for <soap:Header>'s child elements?

My resquest/response soap message is the following:

----> request message
<soap:Enveloper ...>
    <soap:Header>
      <mh:ID soap:mustUnderstand="1">1<mh:ID>
      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
    </soap:Header>
    <soap:Body>
      <mh:Inform>
        ... ...
      </mh:Inform>
    <soap:Body>
</soap:Enveloper>

---->response message
<soap:Enveloper ...>
    <soap:Header>
      <mh:ID soap:mustUnderstand="1">1<mh:ID>
      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
    </soap:Header>
    <soap:Body>
      <mh:InformResponse>
        ... ...
      </mh:InformResponse>
    <soap:Body>
</soap:Enveloper>


************and my .wsdl file is:
<definitions>
....
<types>
  <xsd:schema targetNamespace="...">
    <xs:element name="Inform">
      <xs:complexType>
        <xs:sequence>
          ....
        </xs:sequence>
      </xs:complexType>
    </xs:element>
    <xs:element name="InformResponse">
      <xs:complexType>
        <xs:sequence>
          ....
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xsd:schema>
</types>

<message name="Headers">
  <part name="ID" element="tns:ID" />
  <part name="MACAddress" element="tns:MACAddress" /> </message> <message name="InformRequest">
  <part name="part0" element="tns:Inform" /> </message> <message name="InformResponse">
  <part name="part0" element="tns:InformResponse" /> </message>

.....

<binding name="Mybinding" type="tns:MyportType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <operation name="inform">
      <soap:operation style="document" soapAction="urn:inform" />
      <input>
        <soap:header message="tns:Headers" part="ID" use="literal" />
        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
        <soap:body use="literal" />
      </input>
      <output>
        <soap:header message="tns:Headers" part="ID" use="literal" />
        <soap:header message="tns:Headers" part="MACAddress" use="literal" />
        <soap:body use="literal" />
      </output>
    </operation>
  </binding>
....

</definitions>



Now, I can create InformDocument & InformResponseDocument classes, but how can make classes for <soap:Header> by wsdl2java?

Thanks for any help!

Guo







This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is 
intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to 
read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message 
in error, please notify the sender immediately and delete all copies of this message.


Re: how to make classes for by wsdl2java

Posted by Guo Tianchong <gu...@nec-as.nec.com.cn>.
hi Amila,

I'm using Axis2 1.4.1

Since with axis2.x this happens automatically, which APIs can I use to 
get the headers object in the Skeleton class?

for example:

My skeleton class likes:

public class MySkeleton {

    public mypackage.InformResponseDocument inform(mypackage.InformDocument inform) {
                //TODO : fill this with the necessary business logic

        // here, which API(s) can I use to get the headers info?

    }
     
}

  ----- Original Message ----- 
  From: Amila Suriarachchi 
  To: axis-user@ws.apache.org 
  Sent: Thursday, February 19, 2009 12:47 PM
  Subject: Re: how to make classes for <soap:Header> by wsdl2java


  Are you using axis1.x? with axis2.x this happens automatically.

  thanks,
  Amila.


  On Wed, Feb 18, 2009 at 3:38 PM, Guo Tianchong <gu...@nec-as.nec.com.cn> wrote:

    hi all,

    I am using wsdl2java command to create java class.
    Now, I can create classes for my <soap:Body>'s child elements.
    but, how to make classes for <soap:Header>'s child elements?

    My resquest/response soap message is the following:

    ----> request message
    <soap:Enveloper ...>
       <soap:Header>
         <mh:ID soap:mustUnderstand="1">1<mh:ID>
         <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
       </soap:Header>
       <soap:Body>
         <mh:Inform>
           ... ...
         </mh:Inform>
       <soap:Body>
    </soap:Enveloper>

    ---->response message
    <soap:Enveloper ...>
       <soap:Header>
         <mh:ID soap:mustUnderstand="1">1<mh:ID>
         <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
       </soap:Header>
       <soap:Body>
         <mh:InformResponse>
           ... ...
         </mh:InformResponse>
       <soap:Body>
    </soap:Enveloper>


    ************and my .wsdl file is:
    <definitions>
    ....
    <types>
     <xsd:schema targetNamespace="...">
       <xs:element name="Inform">
         <xs:complexType>
           <xs:sequence>
             ....
           </xs:sequence>
         </xs:complexType>
       </xs:element>
       <xs:element name="InformResponse">
         <xs:complexType>
           <xs:sequence>
             ....
           </xs:sequence>
         </xs:complexType>
       </xs:element>
     </xsd:schema>
    </types>

    <message name="Headers">
     <part name="ID" element="tns:ID" />
     <part name="MACAddress" element="tns:MACAddress" />
    </message>
    <message name="InformRequest">
     <part name="part0" element="tns:Inform" />
    </message>
    <message name="InformResponse">
     <part name="part0" element="tns:InformResponse" />
    </message>

    .....

    <binding name="Mybinding" type="tns:MyportType">
       <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
       <operation name="inform">
         <soap:operation style="document" soapAction="urn:inform" />
         <input>
           <soap:header message="tns:Headers" part="ID" use="literal" />
           <soap:header message="tns:Headers" part="MACAddress" use="literal" />
           <soap:body use="literal" />
         </input>
         <output>
           <soap:header message="tns:Headers" part="ID" use="literal" />
           <soap:header message="tns:Headers" part="MACAddress" use="literal" />
           <soap:body use="literal" />
         </output>
       </operation>
     </binding>
    ....

    </definitions>



    Now, I can create InformDocument & InformResponseDocument classes,
    but how can make classes for <soap:Header> by wsdl2java?

    Thanks for any help!

    Guo





  -- 
  Amila Suriarachchi
  WSO2 Inc.
  blog: http://amilachinthaka.blogspot.com/

Re: how to make classes for by wsdl2java

Posted by Amila Suriarachchi <am...@gmail.com>.
Are you using axis1.x? with axis2.x this happens automatically.

thanks,
Amila.

On Wed, Feb 18, 2009 at 3:38 PM, Guo Tianchong <gu...@nec-as.nec.com.cn>wrote:

> hi all,
>
> I am using wsdl2java command to create java class.
> Now, I can create classes for my <soap:Body>'s child elements.
> but, how to make classes for <soap:Header>'s child elements?
>
> My resquest/response soap message is the following:
>
> ----> request message
> <soap:Enveloper ...>
>    <soap:Header>
>      <mh:ID soap:mustUnderstand="1">1<mh:ID>
>      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
>    </soap:Header>
>    <soap:Body>
>      <mh:Inform>
>        ... ...
>      </mh:Inform>
>    <soap:Body>
> </soap:Enveloper>
>
> ---->response message
> <soap:Enveloper ...>
>    <soap:Header>
>      <mh:ID soap:mustUnderstand="1">1<mh:ID>
>      <mh:MACAddress soap:mustUnderstand="1">01234567ABC<mh:ID>
>    </soap:Header>
>    <soap:Body>
>      <mh:InformResponse>
>        ... ...
>      </mh:InformResponse>
>    <soap:Body>
> </soap:Enveloper>
>
>
> ************and my .wsdl file is:
> <definitions>
> ....
> <types>
>  <xsd:schema targetNamespace="...">
>    <xs:element name="Inform">
>      <xs:complexType>
>        <xs:sequence>
>          ....
>        </xs:sequence>
>      </xs:complexType>
>    </xs:element>
>    <xs:element name="InformResponse">
>      <xs:complexType>
>        <xs:sequence>
>          ....
>        </xs:sequence>
>      </xs:complexType>
>    </xs:element>
>  </xsd:schema>
> </types>
>
> <message name="Headers">
>  <part name="ID" element="tns:ID" />
>  <part name="MACAddress" element="tns:MACAddress" />
> </message>
> <message name="InformRequest">
>  <part name="part0" element="tns:Inform" />
> </message>
> <message name="InformResponse">
>  <part name="part0" element="tns:InformResponse" />
> </message>
>
> .....
>
> <binding name="Mybinding" type="tns:MyportType">
>    <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http" />
>    <operation name="inform">
>      <soap:operation style="document" soapAction="urn:inform" />
>      <input>
>        <soap:header message="tns:Headers" part="ID" use="literal" />
>        <soap:header message="tns:Headers" part="MACAddress" use="literal"
> />
>        <soap:body use="literal" />
>      </input>
>      <output>
>        <soap:header message="tns:Headers" part="ID" use="literal" />
>        <soap:header message="tns:Headers" part="MACAddress" use="literal"
> />
>        <soap:body use="literal" />
>      </output>
>    </operation>
>  </binding>
> ....
>
> </definitions>
>
>
>
> Now, I can create InformDocument & InformResponseDocument classes,
> but how can make classes for <soap:Header> by wsdl2java?
>
> Thanks for any help!
>
> Guo
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/