You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Dimuthu Leelarathne <mu...@opensource.lk> on 2003/11/17 10:58:42 UTC
Wrong root element in Doc\literal
hi all,
I ran the following wsdl through the WSDL2Java tool. It's a document
literal service. I use the generated classes to send a request. I get a
wrong root element in the message.
<soapenv:Body>
<RequestPerson xmlns="urn:Notification">
<name>Saman</name>
<adress>Colombo</adress>
</RequestPerson>
</soapenv:Body>
</soapenv:Envelope>
Instead of the tag <RequestPerson>, there should be <Person>. The root
element is wrong. I have given the wsdl below.
Am I doing something wrong or is this a bug ? Have you experienced this
before?
I am really thankful for any input.
Dimuthu.
<?xml version="1.0" encoding="utf-8" ?>
<definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="urn:Notification"
targetNamespace="urn:Notification"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<s:schema elementFormDefault="qualified"
targetNamespace="urn:Notification">
<s:complexType name="PersonData">
<s:sequence>
<s:element name="name" type="s:string" />
<s:element name="adress" type="s:string"/>
</s:sequence>
</s:complexType>
<s:element name="RequestPerson" type="s0:PersonData"/>
<s:element name="ResponsePerson" type="s0:PersonData"/>
</s:schema>
</types>
<message name="InMessage">
<part name="parameters" element="s0:RequestPerson"/>
</message>
<message name="OutMessage">
<part name="parameters" element="s0:ResponsePerson"/>
</message>
<portType name="NotificationPort">
<operation name="findPerson">
<input message="s0:InMessage"/>
<output message="s0:OutMessage"/>
</operation>
</portType>
<binding name="NotificationBinding" type="s0:NotificationPort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document"/>
<operation name="findPerson">
<soap:operation soapAction="findPerson" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="NotificationService">
<port name="NotificationPort" binding="s0:NotificationBinding">
<soap:address
location="http://localhost:8080/axis/services/NotificationPort" />
</port>
</service>
</definitions>
--
Lanka Software Foundation - Proud to be a part of it.
http://www.opensource.lk
RE: Wrong root element in Doc\literal
Posted by Ias <ia...@apache-korea.org>.
> hi all,
>
> I ran the following wsdl through the WSDL2Java tool. It's a
> document literal service. I use the generated classes to send
> a request. I get a wrong root element in the message.
>
> <soapenv:Body>
> <RequestPerson xmlns="urn:Notification">
> <name>Saman</name>
> <adress>Colombo</adress>
> </RequestPerson>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> Instead of the tag <RequestPerson>, there should be <Person>.
I'm curious of what made you think of <Person> as the root element.
> The root element is wrong. I have given the wsdl below.
>
> Am I doing something wrong or is this a bug ? Have you
> experienced this before?
The request message is correct based on the WSDL. Let me make it brief to
explain how it goes with doc/literal style:
<operation name="findPerson">
<input message="s0:InMessage"/>
->
<message name="InMessage">
<part name="parameters" element="s0:RequestPerson"/>
</message>
->
<s:element name="RequestPerson" type="s0:PersonData"/>
-> The name of the root element directly under SOAP body is "RequestPerson",
i.e. the value of the "name" attribute in <s0:RequestPerson> declaration.
I hope this illustration helps you,
Ias
>
> I am really thankful for any input.
> Dimuthu.
>
> <?xml version="1.0" encoding="utf-8" ?>
> <definitions
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:s="http://www.w3.org/2001/XMLSchema"
> xmlns:s0="urn:Notification"
> targetNamespace="urn:Notification"
> xmlns="http://schemas.xmlsoap.org/wsdl/">
>
> <types>
> <s:schema elementFormDefault="qualified"
> targetNamespace="urn:Notification">
>
> <s:complexType name="PersonData">
> <s:sequence>
> <s:element name="name" type="s:string" />
> <s:element name="adress" type="s:string"/>
> </s:sequence>
> </s:complexType>
>
> <s:element name="RequestPerson" type="s0:PersonData"/>
> <s:element name="ResponsePerson" type="s0:PersonData"/>
>
> </s:schema>
> </types>
>
> <message name="InMessage">
> <part name="parameters" element="s0:RequestPerson"/>
> </message>
>
> <message name="OutMessage">
> <part name="parameters" element="s0:ResponsePerson"/>
> </message>
>
> <portType name="NotificationPort">
> <operation name="findPerson">
> <input message="s0:InMessage"/>
> <output message="s0:OutMessage"/>
> </operation>
> </portType>
>
> <binding name="NotificationBinding" type="s0:NotificationPort">
>
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="document"/>
>
> <operation name="findPerson">
> <soap:operation soapAction="findPerson" style="document"/>
> <input>
> <soap:body use="literal"/>
> </input>
> <output>
> <soap:body use="literal"/>
> </output>
> </operation>
> </binding>
>
> <service name="NotificationService">
> <port name="NotificationPort" binding="s0:NotificationBinding">
> <soap:address
> location="http://localhost:8080/axis/services/NotificationPort" />
> </port>
> </service>
>
> </definitions>
> --
> Lanka Software Foundation - Proud to be a part of it.
> http://www.opensource.lk
>
>
>
>