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 Dário Abdulrehman <da...@gmail.com> on 2007/11/20 18:42:58 UTC

mapping WSDL types to Java types

I'm using WSDL2Java (Axis 1.3) to generate a WS client for the following
WSDL.
However, the table is generated as an array of string arrays.
Is there some way to force the generation of Java Beans for the TableType
and LineType elements?

Thanks.

generated Java code:
public class MyDocType  implements java.io.Serializable {
    private java.lang.String[][] table;
    ....


WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions name="to2DStringArray"
    targetNamespace="http://www.mycom.com/ns"
    xmlns:ns="http://www.mycom.com/ns"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/">
    <wsdl:types>
        <xsd:schema targetNamespace="http://www.mycom.com/ns"
            xmlns="http://www.mycom.com/ns"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <xsd:element name="MyDoc" type="MyDocType" />

            <xsd:complexType name="LineType">
                <xsd:sequence>
                    <xsd:element name="Column" type="xsd:string"
minOccurs="1" maxOccurs="unbounded"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>


            <xsd:complexType name="TableType">
                <xsd:sequence>
                    <xsd:element name="Line" minOccurs="2"
                        type="LineType" maxOccurs="7"
                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>



            <xsd:complexType name="MyDocType">
                <xsd:sequence>
                    <xsd:element name="Table" minOccurs="0"
type="TableType">
                    </xsd:element>


                </xsd:sequence>
            </xsd:complexType>

        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="MyMessage">
        <wsdl:part name="parameters" element="ns:MyDoc" />
    </wsdl:message>

    <wsdl:portType name="MyPortType">
        <wsdl:operation name="submit">
            <wsdl:input message="ns:MyMessage" />
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:binding name="MyBinding" type="ns:MyPortType"
        xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
        <soapbind:binding style="document"
            transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="submit">
            <soapbind:operation soapAction="" />
            <wsdl:input>
                <soapbind:body use="literal" />
            </wsdl:input>
        </wsdl:operation>
    </wsdl:binding>

    <wsdl:service name="MyService">
        <wsdl:port name="MyPort" binding="ns:MyBinding">
            <soapbind:address
                location="http://localhost:8080/axis/services/myservice" />
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

-- 
Dário Abdulrehman
PGP Public Key: http://tinyurl.com/2pm9d7
--

Re: mapping WSDL types to Java types

Posted by Amila Suriarachchi <am...@gmail.com>.
On Nov 20, 2007 11:12 PM, Dário Abdulrehman <da...@gmail.com> wrote:
> I'm using WSDL2Java (Axis 1.3) to generate a WS client for the following
> WSDL.
> However, the table is generated as an array of string arrays.
> Is there some way to force the generation of Java Beans for the TableType
> and LineType elements?
Use Axis2. That is the default in Axis2.
>
> Thanks.
>
> generated Java code:
> public class MyDocType  implements java.io.Serializable {
>     private java.lang.String[][] table;
>     ....
>
>
> WSDL:
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <wsdl:definitions name="to2DStringArray"
>     targetNamespace="http://www.mycom.com/ns"
>     xmlns:ns="http://www.mycom.com/ns "
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
>     xmlns:soapbind="http://schemas.xmlsoap.org/wsdl/soap/ ">
>     <wsdl:types>
>         <xsd:schema targetNamespace="http://www.mycom.com/ns"
>             xmlns="http://www.mycom.com/ns "
>             xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>
>             <xsd:element name="MyDoc" type="MyDocType" />
>
>             <xsd:complexType name="LineType">
>                 <xsd:sequence>
>                     <xsd:element name="Column" type="xsd:string"
> minOccurs="1" maxOccurs="unbounded"
>                         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>                     </xsd:element>
>                 </xsd:sequence>
>              </xsd:complexType>
>
>
>             <xsd:complexType name="TableType">
>                 <xsd:sequence>
>                     <xsd:element name="Line" minOccurs="2"
>                         type="LineType" maxOccurs="7"
>                         xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>                     </xsd:element>
>                 </xsd:sequence>
>             </xsd:complexType>
>
>
>
>             <xsd:complexType name="MyDocType">
>                 <xsd:sequence>
>                     <xsd:element name="Table" minOccurs="0"
> type="TableType">
>                     </xsd:element>
>
>
>                 </xsd:sequence>
>             </xsd:complexType>
>
>         </xsd:schema>
>     </wsdl:types>
>
>     <wsdl:message name="MyMessage">
>         <wsdl:part name="parameters" element="ns:MyDoc" />
>     </wsdl:message>
>
>     <wsdl:portType name="MyPortType">
>         <wsdl:operation name="submit">
>             <wsdl:input message="ns:MyMessage" />
>         </wsdl:operation>
>     </wsdl:portType>
>
>     <wsdl:binding name="MyBinding" type="ns:MyPortType"
>         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
>         <soapbind:binding style="document"
>             transport=" http://schemas.xmlsoap.org/soap/http" />
>         <wsdl:operation name="submit">
>             <soapbind:operation soapAction="" />
>             <wsdl:input>
>                 <soapbind:body use="literal" />
>             </wsdl:input>
>         </wsdl:operation>
>     </wsdl:binding>
>
>     <wsdl:service name="MyService">
>         <wsdl:port name="MyPort" binding="ns:MyBinding">
>             <soapbind:address
>                 location="http://localhost:8080/axis/services/myservice" />
>         </wsdl:port>
>      </wsdl:service>
>
> </wsdl:definitions>
>
> --
> Dário Abdulrehman
> PGP Public Key: http://tinyurl.com/2pm9d7
> --



-- 
Amila Suriarachchi,
WSO2 Inc.

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