sujit kirve - 2010-09-19

Hi  All,

I am using the gSOAP server  webserices (In C++) and trying make a call through NuSoap client .
As the method requires parameters in Complex Type format, I passing same in array type format through NUSOAP.

the WSDL as Follows. 

<wsdl:definitions targetNamespace="http://xyz.com">
<wsdl:types>
<schema targetNamespace="http:// xyz.com">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="DataItem">
<sequence>
<element name="key" nillable="true" type="xsd:string"/>
<element name="value" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="ArrayOfRequestParam">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="impl:DataItem"/>
</restriction>
</complexContent>
</complexType>

<wsdl:message name="soapRequestRequest">
<wsdl:part name="pageName" type="xsd:string"/>
<wsdl:part name="keyvaluepair" type="impl:ArrayOfRequestParam"/>
</wsdl:message>

<wsdl:input name="soapRequestRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://xyz.com" use="encoded"/>
</wsdl:input>

Nusoap  PHP Call  ,

                $wsdl = "file:///usr/local/SOAPAPIServer.wsdl";
                $soapclient = new nusoapclient($wsdl,true);
                $DataItem= array(
                     array('key'=>'ADD','value'=>'ADD'),
                     array('key'=>'db_Users.UserId','value'=>'SUJIT_test'),
                     array('key'=>'Password','value'=>'Password'),
                     array('key'=>'ConfirmPassword','value'=>'Password'),
                                        
                );
              
                   
                              
                $para = array('functionName'=>'UserEdit','keyvaluepair'=>$DataItem) ;
                $result = $soapclient->call('soapRequest',$para);
              
                $error= $soapclient->getError();
                echo '<h2>Error</h2>';
                echo '<pre>';print( htmlspecialchars($error, ENT_QUOTES)); echo '</pre>';
              
                echo '<h2>Request</h2>';
                echo '<pre>';print( htmlspecialchars($soapclient->request, ENT_QUOTES)); echo '</pre>';
                echo "<br>";
                echo '<h2>Response</h2>';
                echo '<pre>' . htmlspecialchars($soapclient->response, ENT_QUOTES) . '</pre>';

o/p as follows=>

Validation constraint violation: data type mismatch SOAP-ENC:Array in element &lt;keyvaluepair&gt;

Anybody face this problem before, please let me know.