Thanks for the answer....i already solved the problem. I had an error in the server so it expected something else than arrays. It works fine now.

Arrays are always the sticky part of interoperability :-/. It may be an
issue with the way the WSDL is constructed: try running the WS-I group's
interoperability tests to see if you get anything interesting.
Mindreef's SOAPScope runs the tests, if you want to buy a tool. If you
like free tools, the Eclipse project WST plugin seems to do the WS-I
tests, too -- convenient if you happen to be using Eclipse already.

Also, if you haven't already, you can try using Axis to generate WSDL
for a method with the signature you're looking for and compare it with
the WSDL you got from gSOAP. You can then set up a dummy service with
Axis and watch the XML going down the wire to see how it might be
different.

If you're using RPC-encoded and are free to make the choice, you might
try switching to Doc-literal, if for no other reason than the XML is a
lot easier to read.

Chris


-----Original Message-----
From: Michael Rudolf [mailto:[EMAIL PROTECTED] Sent: Sunday, October 30, 2005 16:53
To: [email protected]
Subject: String as parameter...

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.ja
va:221)
   at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.jav
a:128)
   at
org.apache.axis.encoding.DeserializationContext.endElement(Deserializati
onContext.java:1087)
   at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(
AbstractSAXParser.java:633)
   at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEnd
Element(XMLNSDocumentScannerImpl.java:719)
   at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$F
ragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:16
85)
   at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.s
canDocument(XMLDocumentFragmentScannerImpl.java:368)
   at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
1Configuration.java:834)
   at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML1
1Configuration.java:764)
   at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.jav
a:148)
   at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Abstr
actSAXParser.java:1242)
   at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
   at
org.apache.axis.encoding.DeserializationContext.parse(DeserializationCon
text.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(MustUnderstan
dChecker.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