axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig Duncan" <craig.dun...@invisioninc.com>
Subject Castor, WSDL2Java oddness in XML from client
Date Wed, 26 Nov 2003 20:43:17 GMT
I have been working my way through this article
http://www-106.ibm.com/developerworks/library/ws-castor/ 

and trying to apply the same principles to a project that I am working on.
As the article describes I started with a wsdl file and generated the java
code from that file.  Everything deploys correctly.  I created a client to
make the soap call.  Here is where I am seeing issues.  I have a TCP monitor
that shows what is being sent and the soap body does not match up with what
I am expecting.

 

I have included the WSDL below.  The input to the method is called
RunPOEngine which has four elements defined within it (see the
RunPOEngine.xsd below).  The oddness that is appearing in the soap xml looks
like this ( I have chopped out much of the message as it is very large):

 

<soapenv:Body>

   <RunPOEngine xmlns="http://www.invisioninc.com/soap/encoding">

     <TranHdr><TranHdr Version="String" TransactionNumber="0"
Timestamp="2001-12-17T09:30:47.000-05:00" ClientName="String" UserId="0"


       UserName="String"/></TranHdr>

     <Deal><Deal Id="0" Name="String" ........ </Deal></Deal>

.

.

.

 

As you can see, for some reason the elements under RunPOEngine (TranHdr and
Deal) are in the soap body twice.  The same is true for the other 2
elements, I am just not showing them in the snippet above.  When axis tries
to unmarshall this using the castor classes I have provided, it fails
because the first <TranHdr> has no attributes.  What I expected to see in
the TCP monitor is this:

 

<soapenv:Body>

   <RunPOEngine xmlns="http://www.invisioninc.com/soap/encoding">

      <TranHdr Version="String" TransactionNumber="0"
Timestamp="2001-12-17T09:30:47.000-05:00" ClientName="String" UserId="0"


       UserName="String"/>

     <Deal Id="0" Name="String" ........ </Deal>

 

BTW, I am using the stubs generated by WSDL2Java in my client class.

 

Any help would be appreciated.

 

Craig Duncan

 

 

 

 

==================== RunPOEngine.xsd
===============================================

 

xs:schema targetNamespace="http://www.invisioninc.com/soap/encoding"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:iv="http://www.invisioninc.com/soap/encoding"
elementFormDefault="qualified" attributeFormDefault="unqualified">

       <xs:include schemaLocation="Common.xsd"/>

       <xs:include schemaLocation="Deal.xsd"/>

       <xs:include schemaLocation="Avails.xsd"/>

       <xs:include schemaLocation="PO_Instructions.xsd"/>

       <xs:element name="RunPOEngine">

              <xs:complexType>

                     <xs:sequence>

                           <xs:element name="TranHdr" type="iv:TranHdr"/>

                           <xs:element name="Deal" type="iv:Deal"/>

                           <xs:element name="POInstructions"
type="iv:POInstructions"/>

                           <xs:element name="Avails" type="iv:Avails"
minOccurs="0"/>

                     </xs:sequence>

              </xs:complexType>

       </xs:element>

</xs:schema>

 

 

 

===========================  W S D L
===============================================

 

<!-- edited with XMLSPY v2004 rel. 3 U (http://www.xmlspy.com) by John
MacDonald (INVISION) -->

<definitions targetNamespace="http://www.invisioninc.com/soap/encoding/wsdl"


   xmlns="http://schemas.xmlsoap.org/wsdl/" 

   xmlns:tns="http://www.invisioninc.com/soap/encoding/wsdl" 

   xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 

   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 

   xmlns:foo="http://www.foo.org/" 

   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 

   xmlns:types="http://www.invisioninc.com/soap/encoding">

       <types>

              <xsd:schema
targetNamespace="http://www.invisioninc.com/soap/encoding">

                     <xsd:import schemaLocation="PackageOptimizer.xsd"/>

              </xsd:schema>

       </types>

       <message name="runPOEngineReq">

              <part name="parameters" element="types:RunPOEngine" />

       </message>

       <message name="runPOEngineResponse">

              <part name="parameters" element="types:RunPOEngineOut"/>

       </message>

       <portType name="PackageOptimizerPortType">

              <operation name="RunPOEngine">

                     <input message="tns:runPOEngineReq"/>

                     <output message="tns:runPOEngineResponse"/>

              </operation>

       </portType>

       <binding name="PackageOptimizerSOAPBinding"
type="tns:PackageOptimizerPortType">

              <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

              <operation name="RunPOEngine">

                     <soap:operation style="document"
soapAction="RunPOEngine"/>

                     <input>

                           <soap:body use="literal"/>

                     </input>

                     <output>

                           <soap:body use="literal"/>

                     </output>

              </operation>

       </binding>

       <service name="PackageOptimizerService">

              <port name="PackageOptimizerSOAPPort"
binding="tns:PackageOptimizerSOAPBinding">

                     <soap:address
location="http://localhost:8080/axis/services/PackageOptimizerSOAPPort"/>

              </port>

       </service>

</definitions>

 


Mime
View raw message