Problem solved, gSOAP encodes arrays as generic vectors when classes have a namespace. As soon as i removed it everything worked.

Hi,

I have the following problem: I developed a Web Service in C with gSOAP that offers a method that takes an Array of Strings as parameter and returns an array of objects. I used the WSDL file the was generated by gSOAP in WSDL2Java to create a client. The resulting method in Java is generated correctly. When i call it with null as parameter for the Strings everything works fine and the resulting array of objects is returned. But when i try calling the method with an array of strings teh serialization fails:

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
faultSubcode:
faultString: Validation constraint violation: data type mismatch soapenc:Array in element <jobs>
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:Validation constraint violation: data type mismatch soapenc:Array in element <jobs> at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221) at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128) at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
   at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
   at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
   at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
   at org.apache.axis.client.Call.invoke(Call.java:2748)
   at org.apache.axis.client.Call.invoke(Call.java:2424)
   at org.apache.axis.client.Call.invoke(Call.java:2347)
   at org.apache.axis.client.Call.invoke(Call.java:1804)
   at rmws.RMWSStub.jobStatus(RMWSStub.java:298)
   at TestWS.main(TestWS.java:44)



The WSDL looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="RMWS"
targetNamespace="urn:rmws"
xmlns:tns="urn:rmws"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:ns2="http://tempuri.org/ns2.xsd";
xmlns:ns1="http://tempuri.org/ns1.xsd";
xmlns:ns="urn:rmws"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/";
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/";
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/";
xmlns="http://schemas.xmlsoap.org/wsdl/";>

<types>

<schema targetNamespace="http://tempuri.org/ns2.xsd";
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
 xmlns:ns2="http://tempuri.org/ns2.xsd";
 xmlns:ns1="http://tempuri.org/ns1.xsd";
 xmlns:ns="urn:rmws"
 xmlns="http://www.w3.org/2001/XMLSchema";
 elementFormDefault="unqualified"
 attributeFormDefault="unqualified">
 <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
 <complexType name="Result">
  <sequence>
<element name="message" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
    <element name="error" type="xsd:int" minOccurs="1" maxOccurs="1"/>
  </sequence>
 </complexType>
 <complexType name="Resource">
  <sequence>
<element name="resource" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="value" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="resource">
  <sequence>
<element name="item" type="ns2:Resource" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="Job">
  <sequence>
<element name="id" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="name" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="queue" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="status" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/> <element name="machine" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="jobstatus">
  <sequence>
<element name="item" type="ns2:Job" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="stringArr">
  <sequence>
<element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
</schema>

<schema targetNamespace="http://tempuri.org/ns1.xsd";
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
 xmlns:ns2="http://tempuri.org/ns2.xsd";
 xmlns:ns1="http://tempuri.org/ns1.xsd";
 xmlns:ns="urn:rmws"
 xmlns="http://www.w3.org/2001/XMLSchema";
 elementFormDefault="unqualified"
 attributeFormDefault="unqualified">
 <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
 <complexType name="resource">
  <sequence>
<element name="item" type="ns2:Resource" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="jobstatus">
  <sequence>
<element name="item" type="ns2:Job" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="stringArr">
  <sequence>
<element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
</schema>

<schema targetNamespace="urn:rmws"
 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
 xmlns:xsd="http://www.w3.org/2001/XMLSchema";
 xmlns:ns2="http://tempuri.org/ns2.xsd";
 xmlns:ns1="http://tempuri.org/ns1.xsd";
 xmlns:ns="urn:rmws"
 xmlns="http://www.w3.org/2001/XMLSchema";
 elementFormDefault="unqualified"
 attributeFormDefault="unqualified">
 <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
 <complexType name="resource">
  <sequence>
<element name="item" type="ns2:Resource" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="jobstatus">
  <sequence>
<element name="item" type="ns2:Job" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
 <complexType name="stringArr">
  <sequence>
<element name="item" type="xsd:string" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
  </sequence>
 </complexType>
</schema>

</types>

<message name="submitJob">
<part name="user" type="xsd:string"/>
<part name="job-script" type="xsd:string"/>
<part name="job-dir" type="xsd:string"/>
</message>

<message name="response">
<part name="return" type="ns2:Result"/>
</message>

<message name="reserve">
<part name="user" type="xsd:string"/>
<part name="job-script" type="xsd:string"/>
<part name="job-dir" type="xsd:string"/>
<part name="resource" type="ns1:resource"/>
</message>

<message name="jobStatusRequest">
<part name="user" type="xsd:string"/>
<part name="state" type="xsd:string"/>
<part name="jobs" type="ns1:stringArr"/>
</message>

<message name="jobStatusResponse">
<part name="result" type="ns1:jobstatus"/>
</message>

<portType name="RMWSPortType">
<operation name="submitJob">
<documentation>Service definition of function ns__submitJob</documentation>
 <input message="tns:submitJob"/>
 <output message="tns:response"/>
</operation>
<operation name="reserve">
<documentation>Service definition of function ns__reserve</documentation>
 <input message="tns:reserve"/>
 <output message="tns:response"/>
</operation>
<operation name="jobStatus">
<documentation>Service definition of function ns__jobStatus</documentation>
 <input message="tns:jobStatusRequest"/>
 <output message="tns:jobStatusResponse"/>
</operation>
</portType>

<binding name="RMWS" type="tns:RMWSPortType">
<SOAP:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="submitJob">
 <SOAP:operation style="rpc" soapAction=""/>
 <input>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </input>
 <output>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </output>
</operation>
<operation name="reserve">
 <SOAP:operation style="rpc" soapAction=""/>
 <input>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </input>
 <output>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </output>
</operation>
<operation name="jobStatus">
 <SOAP:operation style="rpc" soapAction=""/>
 <input>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </input>
 <output>
<SOAP:body use="encoded" namespace="urn:rmws" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
 </output>
</operation>
</binding>

<service name="RMWS">
<documentation>gSOAP 2.7.6c generated service definition</documentation>
<port name="RMWS" binding="tns:RMWS">
 <SOAP:address location="http://master.local:8081"/>
</port>
</service>

</definitions>





Reply via email to