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 Br...@mainline.com on 2004/07/30 21:46:05 UTC

newbie question - sending XML documents in soapenv:Body

Hello friends -

I'm in the process of integrating two systems, I am using the AXIS SOAP
engine and my counterpart at another organization is using the .NET  SOAP
engine.  I have managed to create some stubs based on the other parties
.WSDLs.  They provided the following WSDL for one of our transactions (URLS
have been modified for confidentiality purposes):

  <definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="
http://www.w3.org/2001/XMLSchema" xmlns:s0="
http://www.random.customer.com/webservices" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="
http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="
http://www.random.customer.com/webservices" xmlns="
http://schemas.xmlsoap.org/wsdl/">
 <types>
 <s:schema elementFormDefault="qualified" targetNamespace="
http://www.random.customer.com/webservices">
 <s:element name="InsertOrUpdateConsumption">
 <s:complexType>
 <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="sXML" type="s:string" />
  </s:sequence>
  </s:complexType>
  </s:element>
 <s:element name="InsertOrUpdateConsumptionResponse">
 <s:complexType>
 <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="
InsertOrUpdateConsumptionResult" type="s:string" />
  </s:sequence>
  </s:complexType>
  </s:element>
  </s:schema>
  </types>
   <message name="InsertOrUpdateConsumptionSoapIn">
  <part name="parameters" element="s0:InsertOrUpdateConsumption" />
  </message>
 <message name="InsertOrUpdateConsumptionSoapOut">
  <part name="parameters" element="s0:InsertOrUpdateConsumptionResponse" />
  </message>
   <portType name="XXXServiceSoap">
 <operation name="InsertOrUpdateConsumption">
  <input message="s0:InsertOrUpdateConsumptionSoapIn" />
  <output message="s0:InsertOrUpdateConsumptionSoapOut" />
  </operation>
  </portType>
 <binding name="XXXServiceSoap" type="s0:XXXServiceSoap">
  <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="
document" />
  <operation name="InsertOrUpdateConsumption">
  <soap:operation soapAction="
http://www.random.customer.com/webservices/InsertOrUpdateConsumption" style
="document" />
 <input>
  <soap:body use="literal" />
  </input>
 <output>
  <soap:body use="literal" />
  </output>
  </operation>
  </binding>
 <service name="XXXService">
 <port name="XXXServiceSoap" binding="s0:XXXServiceSoap">
  <soap:address location="
http://XXX.random.customer.com:81/XXX2/XXXService.asmx" />
  </port>
  </service>
  </definitions>


I went ahead and generated classes based on this .WSDL and they compile
fine.  I seem to be able to call the method and don't get a fault thrown.
However, the logging that happens at execute time seems to indicate that
the XML message I am sending across the wire is getting encoded, like this:

DEBUG [main] (Call.java:2548) - <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi
="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <InsertOrUpdateConsumption xmlns
="http://www.random.customer.com/webservices">
   <sXML>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;
standalone=&quot;yes&quot;?&gt;
&lt;premiseConsumption&gt;
&lt;servicePointId&gt;9236524392&lt;/servicePointId&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;02/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;45.106852&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;03/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;46.717811&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;04/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;51.550688&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;04/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;4.832877&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;05/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;&lt;consu
mptionAmount&gt;45.106852&lt;/consumptionAmount&gt;&lt;/consumption&gt;
&lt;consumption&gt;&lt;consumptionDate&gt;06/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;51.550688&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;consumption&gt;
&lt;consumptionDate&gt;06/2004&lt;/consumptionDate&gt;
&lt;consumptionType&gt;KWH&lt;/consumptionType&gt;
&lt;consumptionAmount&gt;6.443836&lt;/consumptionAmount&gt;
&lt;/consumption&gt;&lt;/premiseConsumption&gt;

</sXML>
  </InsertOrUpdateConsumption>
 </soapenv:Body>
</soapenv:Envelope>

I tend to think that this is a result of the third party taking a
simplistic approach to defining his web service such that it doesn't expect
an entire XML document, but rather one element of type string and
consequently AXIS has encoded my XML.  I have provided the developer with
an .xsd defining the xml that I expect to send his process; with the &gt;
and &lt; strings replaced with their appropriate counterparts, the XML
above conforms to that .xsd.  On the other hand, I am entirely new to web
services, and maybe this is what the output looks like any time you use
literal encoding to send a full blown XML message in the SOAP envelope.
I'm also curious if I can force AXIS not to encode my XML string in the
event that I am not able to convince my partner to change the web service
he has operational.

Any and all insight is appreciated.

Thanks.

brian