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 Angelo Immediata <an...@libero.it> on 2005/07/24 12:00:06 UTC

Some question about wsdl2java

Hi all; i'm using Axis 1.2.1; i have this wsdl file:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:impl="http://eng.it" xmlns:intf="http://eng.it" xmlns:request="http://webServ/request" xmlns:response="http://webServ/reponse" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nsRequest="request" xmlns:nsResponse="response" targetNamespace="http://eng.it" name="webServ">
	<wsdl:types>
		<xsd:schema targetNamespace="request">
			<xsd:include schemaLocation="file:///D:/project/Sample/schema/input.xsd"/>
		</xsd:schema>
		<xsd:schema targetNamespace="response">
			<xsd:include schemaLocation="file:///D:/project/Sample/schema/output.xsd"/>
		</xsd:schema>
	</wsdl:types>
	<wsdl:message name="request">
		<wsdl:part name="request" element="nsRequest:root"/>
	</wsdl:message>
	<wsdl:message name="response">
		<wsdl:part name="response" element="nsResponse:root"/>
	</wsdl:message>
	<wsdl:portType name="Sample">
		<wsdl:operation name="handleDocument">
			<wsdl:input name="request" message="impl:request"/>
			<wsdl:output name="response" message="impl:response"/>
		</wsdl:operation>
	</wsdl:portType>
	<wsdl:binding name="SampleSoapBinding" type="impl:Sample">
		<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
		<wsdl:operation name="handleDocument">
			<wsdlsoap:operation/>
			<wsdl:input>
				<wsdlsoap:body use="literal"/>
			</wsdl:input>
			<wsdl:output>
				<wsdlsoap:body use="literal"/>
			</wsdl:output>
		</wsdl:operation>
	</wsdl:binding>
	<wsdl:service name="SampleService">
		<wsdl:port name="Sample" binding="impl:SampleSoapBinding">
			<wsdlsoap:address location="http://localhost:8080/sample/services/Sample"/>
		</wsdl:port>
	</wsdl:service>
</wsdl:definitions>

The file input.xsd and output.xsd are these:

input.xsd:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:complexType name="sum">
        <xsd:sequence>
            <xsd:element name="primoOperando" type="xsd:long"/>
            <xsd:element name="secondoOperando" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="operations">
        <xsd:sequence>
            <xsd:element name="sum" type="sum"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="root">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="operations" type="operations" maxOccurs="unbounded"/>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

output.xsd:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <xsd:complexType name="operationResult">
        <xsd:sequence>
            <xsd:element name="result" maxOccurs="1" type="xsd:long"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="results">
        <xsd:sequence>
            <xsd:element name="operationResult" type="operationResult" maxOccurs="1"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:element name="root" type="results"/>
</xsd:schema>

Well i have used wsdl2java in order to create client for the web service described in the wsdl; the creation operation has worked very fine... when i have tried to use this client i have had this xml:

<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="request">
   <operations xmlns="">
     <sum>
      <primoOperando>12</primoOperando>
      <secondoOperando>14</secondoOperando>
     </sum>
   </operations>
</root>

While i have created some classes by using JAXB and i was waiting for a very simple xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<root>
   <operations>
     <sum>
      <primoOperando>12</primoOperando>
      <secondoOperando>14</secondoOperando>
     </sum>
   </operations>
</root>

Why have i had that xml file?
Thanks to all.



____________________________________________________________
Libero Flat, sempre a 4 Mega a 19,95 euro al mese! 
Abbonati subito su http://www.libero.it




Re: Some question about wsdl2java

Posted by Anne Thomas Manes <at...@gmail.com>.
The only difference between the two XML listings is that in the one
generated by Axis, the <root> element is namespace qualified (which is
required because <root> is a global element, and you have included the
schema in a schema with a target namespace), and in the one generated
by JAXB, the <root> element is not namespace qualified (which is
required because the schema has no target namespace).

Anne

On 7/24/05, Angelo Immediata <an...@libero.it> wrote:
> Hi all; i'm using Axis 1.2.1; i have this wsdl file:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <wsdl:definitions xmlns:impl="http://eng.it" xmlns:intf="http://eng.it" xmlns:request="http://webServ/request" xmlns:response="http://webServ/reponse" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:nsRequest="request" xmlns:nsResponse="response" targetNamespace="http://eng.it" name="webServ">
>         <wsdl:types>
>                 <xsd:schema targetNamespace="request">
>                         <xsd:include schemaLocation="file:///D:/project/Sample/schema/input.xsd"/>
>                 </xsd:schema>
>                 <xsd:schema targetNamespace="response">
>                         <xsd:include schemaLocation="file:///D:/project/Sample/schema/output.xsd"/>
>                 </xsd:schema>
>         </wsdl:types>
>         <wsdl:message name="request">
>                 <wsdl:part name="request" element="nsRequest:root"/>
>         </wsdl:message>
>         <wsdl:message name="response">
>                 <wsdl:part name="response" element="nsResponse:root"/>
>         </wsdl:message>
>         <wsdl:portType name="Sample">
>                 <wsdl:operation name="handleDocument">
>                         <wsdl:input name="request" message="impl:request"/>
>                         <wsdl:output name="response" message="impl:response"/>
>                 </wsdl:operation>
>         </wsdl:portType>
>         <wsdl:binding name="SampleSoapBinding" type="impl:Sample">
>                 <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
>                 <wsdl:operation name="handleDocument">
>                         <wsdlsoap:operation/>
>                         <wsdl:input>
>                                 <wsdlsoap:body use="literal"/>
>                         </wsdl:input>
>                         <wsdl:output>
>                                 <wsdlsoap:body use="literal"/>
>                         </wsdl:output>
>                 </wsdl:operation>
>         </wsdl:binding>
>         <wsdl:service name="SampleService">
>                 <wsdl:port name="Sample" binding="impl:SampleSoapBinding">
>                         <wsdlsoap:address location="http://localhost:8080/sample/services/Sample"/>
>                 </wsdl:port>
>         </wsdl:service>
> </wsdl:definitions>
> 
> The file input.xsd and output.xsd are these:
> 
> input.xsd:
> 
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>     <xsd:complexType name="sum">
>         <xsd:sequence>
>             <xsd:element name="primoOperando" type="xsd:long"/>
>             <xsd:element name="secondoOperando" type="xsd:long"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="operations">
>         <xsd:sequence>
>             <xsd:element name="sum" type="sum"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:element name="root">
>         <xsd:complexType>
>             <xsd:sequence>
>                 <xsd:element name="operations" type="operations" maxOccurs="unbounded"/>
>             </xsd:sequence>
>         </xsd:complexType>
>     </xsd:element>
> </xsd:schema>
> 
> output.xsd:
> 
> <?xml version="1.0"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>     <xsd:complexType name="operationResult">
>         <xsd:sequence>
>             <xsd:element name="result" maxOccurs="1" type="xsd:long"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:complexType name="results">
>         <xsd:sequence>
>             <xsd:element name="operationResult" type="operationResult" maxOccurs="1"/>
>         </xsd:sequence>
>     </xsd:complexType>
>     <xsd:element name="root" type="results"/>
> </xsd:schema>
> 
> Well i have used wsdl2java in order to create client for the web service described in the wsdl; the creation operation has worked very fine... when i have tried to use this client i have had this xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <root xmlns="request">
>    <operations xmlns="">
>      <sum>
>       <primoOperando>12</primoOperando>
>       <secondoOperando>14</secondoOperando>
>      </sum>
>    </operations>
> </root>
> 
> While i have created some classes by using JAXB and i was waiting for a very simple xml like this:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <root>
>    <operations>
>      <sum>
>       <primoOperando>12</primoOperando>
>       <secondoOperando>14</secondoOperando>
>      </sum>
>    </operations>
> </root>
> 
> Why have i had that xml file?
> Thanks to all.
> 
> 
> 
> ____________________________________________________________
> Libero Flat, sempre a 4 Mega a 19,95 euro al mese!
> Abbonati subito su http://www.libero.it
> 
> 
> 
>