Problem submitting arrayList type in (pear)soap
| From: | Dragan Dinic | Date: | Fri, 10 Sep 2004 22:40:49 +0000 |
| Subject: | Problem submitting arrayList type in (pear)soap | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-1615@lists.php.net to get a copy of this message | ||
Hi.
I have problem when sending arrayList type to wsdl enabled Java SOAP server. I 've tried all available php soap library (nusoap,pear soap and php5 soap) but didn 't get this working.
Here is description of arrayList type in wsdl file:
Code:
<complexType name="arrayList">
<complexContent>
<extension base="tns:list">
<sequence/>
</extension>
</complexContent>
</complexType>
<complexType name="list">
<complexContent>
<extension base="tns:collection">
<sequence/>
</extension>
</complexContent>
</complexType>
<complexType name="collection">
<complexContent>
<restriction base="soap11-enc:Array">
<attribute ref="soap11-enc:arrayType" wsdl:arrayType="anyType[]"/>
</restriction>
</complexContent>
</complexType>
and here is method descritption in wsdl I am trying to call:
Code:
<message name="NavigatorIF_loadStabloGaTipFilt">
<part name="int_1" type="xsd:int"/>
<part name="ArrayList_2" type="ns2:arrayList"/>
</message>
When I try to call method above, with all possible combination of arrays in php I am getting "mailformed array exception" fault code from server.
This is test script which use PEAR SOAP lib:
require_once("SOAP/Client.php");
$wsdl = new SOAP_WSDL("http://localhost:15000/b04/navigator?WSDL");
$proxy = $wsdl->getProxy();
$proxy->__trace(1);
//load user - this method set JSESSIONID
//which is sent as cookie during each http request
$response1 = $proxy->loadKorisnik("user","pass");
$arraylist[] = array("lastUpdate"=>0,"status"=>0,"key"=>"key","value"=>"3");
$response2 = $proxy->loadStabloGaTipFilt(17,$arraylist);
// Display the request and response
echo '<h2>Request</h2>';
echo '<pre>' . htmlspecialchars($proxy->__getlastrequest(), ENT_QUOTES) . '</pre>';
echo '<h2>Response</h2>';
echo '<pre>' . htmlspecialchars($proxy->__getlastresponse(), ENT_QUOTES) . '</pre>';
?>
Which produce following output:
Request
POST /b04/navigator HTTP/1.0
User-Agent: PEAR-SOAP 0.8.0RC2-devel
Host: neca2.boox.co.yu
Content-Type: text/xml; charset=UTF-8
Content-Length: 821
SOAPAction: ""
Cookie: JSESSIONID=B9C8FE56DBA0140C41B0527DE5CE9982
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:Navigator"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:loadStabloGaTipFilt>
<int_1 xsi:type="xsd:int">17</int_1>
<ArrayList_2 xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="Struct[1]" SOAP-ENC:offset="[0]">
<item>
<lastUpdate xsi:type="xsd:int">0</lastUpdate>
<status xsi:type="xsd:int">0</status>
<key xsi:type="xsd:string">key</key>
<value xsi:type="xsd:string">3</value></item></ArrayList_2></ns4:loadStabloGaTipFilt>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Response
HTTP/1.1 500 Internal Server Error
X-Powered-By: Servlet/2.4
SOAPAction: ""
Content-Type: text/xml; charset="utf-8"
Date: Thu, 09 Sep 2004 16:35:14 GMT
Server: Sun-Java-System/JWSDP-1.3
Connection: close
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="urn:Navigator" xmlns:ns1="http://java.sun.com/jax-rpc-ri/internal" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><env:Body><env:Fault><faultcode>env:Client</faultcode><faultstring>JAXRPC.TIE.01: caught exception while handling request: unexpected array element type: expected={http://www.w3.org/2001/XMLSchema}anyType, actual=Struct</faultstring></env:Fault></env:Body></env:Envelope>
Simmilar thing I am getting when using (almost) the same script with SOAP extension in PHP5:
here is output:
Fatal error: Uncaught SoapFault exception: [env:Client] JAXRPC.TIE.01: caught exception while handling request: unexpected array element type: expected={http://www.w3.org/2001/XMLSchema}anyType, actual={http://www.w3.org/2001/XMLSchema}ur-type in /disk2/data/Dinke/htdocs/soap.php:9 Stack trace: #0 /disk2/data/Dinke/htdocs/soap.php(9): SoapClient->loadStabloGaTipFilt('loadStabloGaTip...', Array) #1 {main} thrown in /disk2/data/Dinke/htdocs/soap.php on line 9
On my request, my service provider gave me following xml that needs to be sent as soap request:
Code:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:Navigator" xmlns:types="urn:Navigator/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:loadStabloGaTipFilt><int_1
xsi:type="xsd:int">17</int_1><ArrayList_2 href="#id1"
/></tns:loadStabloGaTipFilt><soapenc:Array id="id1"
soapenc:arrayType="xsd:anyType[1]"><Item href="#id2"
/></soapenc:Array><tns:KeyValue id="id2"
xsi:type="tns:KeyValue"><lastUpdate
xsi:type="xsd:long">0</lastUpdate><status
xsi:type="xsd:int">0</status><key xsi:type="xsd:string">key</key><value
xsi:type="xsd:string">3</value></tns:KeyValue></soap:Body></soap:Envelope>
however, I have no idea how can I produce this from any of php soap lib.
Thanks in advance
Dragan Dinic