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 Alexander Mischur <a....@web.de> on 2005/04/19 18:33:40 UTC

SOAP Body Problems

Hello everybody,

i'm a newbie to SOAP and webservices.

I experiment some times with axis properties but i have no luck to get 
it right.

I have to write a client for a webservice thats implemented in MS .NET

In the specification the SOAP body must look like this:
<?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>
    <CreateExamples xmlns="http://localhost/axis/services/">
       <examples>
          <Example>
             <JoinUrl>http://ws.apache.org/axis/index.html</JoinUrl>
             <ProjectName>Apache Web Services Axis</Project>
          </Example>
          <Example>
             <JoinUrl>http://jakarta.apache.org/</JoinUrl>
             <ProjectName>Apache Jarkata</Project>
          </Example>
       </examples>
    </CreateExamples>
 </soapenv:Body>
</soapenv:Envelope>

But my axis client always generate this SOAP body, where the first 
letter of the xml tag are in lower case.

<?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>
    <CreateExamples xmlns="http://localhost/axis/services/">
       <examples>
          <example>
             <joinUrl>http://ws.apache.org/axis/index.html</joinUrl>
             <projectName>Apache Web Services Axis</project>
          </example>
          <example>
             <joinUrl>http://jakarta.apache.org/</joinUrl>
             <projectName>Apache Jarkata</project>
          </example>
       </examples>
    </CreateExamples>
 </soapenv:Body>
</soapenv:Envelope>


So my question is, that if SOAP is case sensitive?

If yes, and i think so,
how will i get axis to write the first letter in upper cases?

I classes i had are generetad with axis from a wsdl file.

The wsdl file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<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://localhost/axis/services/"
 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://localhost/axis/services/"
 xmlns="http://schemas.xmlsoap.org/wsdl/">
 <types>
    <s:schema elementFormDefault="qualified" 
targetNamespace="http://localhost/axis/services/">
       <s:element name="CreateExamples">
          <s:complexType>
             <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" name="examples" 
type="s0:ArrayOfExamples" />
             </s:sequence>
          </s:complexType>
       </s:element>
       <s:complexType name="ArrayOfExamples">
          <s:sequence>
             <s:element minOccurs="0" maxOccurs="unbounded" 
name="Example" nillable="true"
                type="s0:Example" />
          </s:sequence>
       </s:complexType>
       <s:complexType name="Example">
          <s:sequence>
             <s:element minOccurs="0" maxOccurs="1" name="JoinUrl" 
type="s:string" />
             <s:element minOccurs="0" maxOccurs="1" name="ProjectName" 
type="s:string" />
          </s:sequence>
       </s:complexType>
       <s:element name="CreateExampleResponse">
          <s:complexType>
             <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" 
name="CreateExampleResult" type="s0:ResultInfo" />
             </s:sequence>
          </s:complexType>
       </s:element>
       <s:complexType name="ResultInfo">
          <s:sequence>
             <s:element minOccurs="1" maxOccurs="1" name="Code" 
type="s:int" />
             <s:element minOccurs="0" maxOccurs="1" name="Description" 
type="s:string" />
          </s:sequence>
       </s:complexType>
    </s:schema>
 </types>
 <message name="CreateExamplesSoapIn">
    <part name="parameters" element="s0:CreateExamples" />
 </message>
 <message name="CreateExamplesSoapOut">
    <part name="parameters" element="s0:CreateExamplesResponse" />
 </message>
 <portType name="ApacheProjectServiceSoap">
    <operation name="CreateExamples">
       <input message="s0:CreateExamplesSoapIn" />
       <output message="s0:CreateExamplesSoapOut" />
    </operation>
 </portType>
 <binding name="ApacheProjectServiceSoap" 
type="s0:ApacheProjectServiceSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
style="document" />
    <operation name="CreateExamples">
       <soap:operation soapAction="http://localhost/axis/services/" 
style="document" />
       <input>
          <soap:body use="literal" />
       </input>
       <output>
          <soap:body use="literal" />
       </output>
    </operation>
 </binding>
 <service name="ApacheProjectService">
    <port name="ApacheProjectServiceSoap" 
binding="s0:ApacheProjectServiceSoap">
       <soap:address 
location="http://localhost/WebService/ApacheProjectService.asmx" />
    </port>
 </service>
</definitions>

The generated class example has a static block thats looks like this:

  static {
      typeDesc.setXmlType(new 
javax.xml.namespace.QName("http://localhost/axis/services/", "Example"));
      org.apache.axis.description.ElementDesc elemField = new 
org.apache.axis.description.ElementDesc();
      elemField.setFieldName("JoinUrl");
      elemField.setXmlName(new 
javax.xml.namespace.QName("http://localhost/axis/services/", "JoinUrl"));
      elemField.setXmlType(new 
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
      elemField.setMinOccurs(0);
      typeDesc.addFieldDesc(elemField);
      elemField = new org.apache.axis.description.ElementDesc();
      elemField.setFieldName("ProjectName");
      elemField.setXmlName(new 
javax.xml.namespace.QName("http://localhost/axis/services/", 
"ProjectName"));
      elemField.setXmlType(new 
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
      elemField.setMinOccurs(0);
      typeDesc.addFieldDesc(elemField);
  }


And the static block of the  generated class ArrayOfExample looks like 
this:

  static {
      typeDesc.setXmlType(new 
javax.xml.namespace.QName("http://localhost/axis/services/", 
"ArrayOfExample"));
      org.apache.axis.description.ElementDesc elemField = new 
org.apache.axis.description.ElementDesc();
      elemField.setFieldName("Example");
      elemField.setXmlName(new 
javax.xml.namespace.QName("http://localhost/axis/services/", "Example"));
      elemField.setXmlType(new 
javax.xml.namespace.QName("http://localhost/axis/services/", "Example"));
      elemField.setMinOccurs(0);
      elemField.setNillable(true);
      typeDesc.addFieldDesc(elemField);
  }

So i think everything i use is ok, but not the axis client configuration.

Please help me.

I thanks every one for his effort of reading this mail and helping me.

Greetings
Alex