ola gostaria de uma ajuda tenho o seguinte codigo para consumir um webservice, o problema é que nao tenho o retorno
tenho que encaminhar este envelope em xml
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string"><?xml version="1.0" encoding="utf-8"?> <requisicao in_schema="F"> <loginws cd_loginws="shopparanaws" cd_senhaws="582347" /> <pessoa acao="con" nr_cpfcnpj="87698595900" /> </requisicao></XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
<?php
require_once('lib/nusoap.php');
$url = "http://186.251.24.59/wbsStoreage/VirtualWsServer.exe/soap/IdmDados";
$args = ('<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string"><?xml version="1.0" encoding="utf-8"?> <requisicao in_schema="F"> <loginws cd_loginws="shopparanaws" cd_senhaws="582347" /> <pessoa acao="con" nr_cpfcnpj="87698595900" /> </requisicao></XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope>');
$client = new nusoap_client($url);
// Error check
$err = $client->getError();
if ($err) {
// Show error
echo '<h2>Error with soapclient creation: </h2><pre>' . $err . '</pre>';
// call won't work
}
$result = $client->call('teste', array($args));
if ($client->fault) {
// Manage error
}
echo "<p>Value returned from the server is: " . $result . "</p>";
echo '<h2>Request</h2>';
echo '<pre>'.htmlspecialchars($client->request, ENT_QUOTES).'</pre>';
echo '<h2>Response</h2>';
echo '<pre>'.htmlspecialchars($client->response, ENT_QUOTES).'</pre>';
echo '<h2>Debug</h2>';
echo '<pre>'.htmlspecialchars($client->debug_str, ENT_QUOTES).'</pre>';
?>
obtenho o seguinte
Notice: Array to string conversion in D:\xampp\htdocs\paranapark\7\1.php on line 23
Value returned from the server is: Array
Request
POST /wbsStoreage/VirtualWsServer.exe/soap/IdmDados HTTP/1.0
Host: 186.251.24.59
User-Agent: NuSOAP/0.9.5 (1.123)
Content-Type: text/xml; charset=ISO-8859-1
SOAPAction: ""
Content-Length: 1476
<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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/"><SOAP-ENV:Body><ns8524:teste xmlns:ns8524="http://tempuri.org"><__numeric_0 xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string">&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;requisicao in_schema="F"&gt; &lt;loginws cd_loginws="shopparanaws" cd_senhaws="582347" /&gt; &lt;pessoa acao="con" nr_cpfcnpj="87698595900" /&gt; &lt;/requisicao&gt;</XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope></__numeric_0></ns8524:teste></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response
HTTP/1.1 200 OK
Date: Fri, 05 May 2017 00:06:29 GMT
Server: Apache/2.2.22 (Win32)
Content:
Content-Length: 483
Connection: close
Content-Type: text/xml
<?xml version="1.0"?>
<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/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultactor/><faultcode>SOAP-ENV:Server</faultcode><faultstring>No method named 'teste' is supported by interface 'IdmDados'</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
Debug
2017-05-05 02:06:25.996622 nusoap_client: ctor wsdl= timeout=0 response_timeout=30
endpoint=string(66) "http://186.251.24.59/wbsStoreage/VirtualWsServer.exe/soap/IdmDados"
2017-05-05 02:06:25.996622 nusoap_client: instantiate SOAP with endpoint at http://186.251.24.59/wbsStoreage/VirtualWsServer.exe/soap/IdmDados
2017-05-05 02:06:25.996622 nusoap_client: call: operation=teste, namespace=http://tempuri.org, soapAction=, rpcParams=, style=rpc, use=encoded, endpointType=soap
params=array(1) {
[0]=>
string(713) "<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string"><?xml version="1.0" encoding="utf-8"?> <requisicao in_schema="F"> <loginws cd_loginws="shopparanaws" cd_senhaws="582347" /> <pessoa acao="con" nr_cpfcnpj="87698595900" /> </requisicao></XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope>"
}
headers=bool(false)
2017-05-05 02:06:25.996622 nusoap_client: serializing param array for operation teste
2017-05-05 02:06:25.996622 nusoap_client: in serialize_val: name=0, type=, name_ns=, type_ns=, use=encoded, soapval=
value=string(713) "<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string"><?xml version="1.0" encoding="utf-8"?> <requisicao in_schema="F"> <loginws cd_loginws="shopparanaws" cd_senhaws="582347" /> <pessoa acao="con" nr_cpfcnpj="87698595900" /> </requisicao></XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope>"
attributes=bool(false)
2017-05-05 02:06:25.996622 nusoap_client: serialize_val: serialize string
2017-05-05 02:06:25.996622 nusoap_client: serialize_val returning <__numeric_0 xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string">&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;requisicao in_schema="F"&gt; &lt;loginws cd_loginws="shopparanaws" cd_senhaws="582347" /&gt; &lt;pessoa acao="con" nr_cpfcnpj="87698595900" /&gt; &lt;/requisicao&gt;</XML> </ns1:requisicao> </SOAP-ENV:Body> </SOAP-ENV:Envelope></__numeric_0>
2017-05-05 02:06:25.996622 nusoap_client: wrapping RPC request with encoded method element
2017-05-05 02:06:25.996622 nusoap_client: In serializeEnvelope length=1079 body (max 1000 characters)=<ns8524:teste xmlns:ns8524="http://tempuri.org"><__numeric_0 xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string">&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;requisicao in_schema="F"&gt; &lt;loginws cd_loginws="shopparanaws" cd_senhaws="582347" /&gt; &lt;pessoa acao="con" nr_cpfcnpj="87698595900" /&gt; &lt;/requisicao&gt;</XML> </ns1:requisicao> style=rpc use=encoded encodingStyle=http://schemas.xmlsoap.org/soap/encoding/
2017-05-05 02:06:25.996622 nusoap_client: headers:
bool(false)
2017-05-05 02:06:25.996622 nusoap_client: namespaces:
array(0) {
}
2017-05-05 02:06:25.996622 nusoap_client: endpoint=http://186.251.24.59/wbsStoreage/VirtualWsServer.exe/soap/IdmDados, soapAction=, namespace=http://tempuri.org, style=rpc, use=encoded, encodingStyle=http://schemas.xmlsoap.org/soap/encoding/
2017-05-05 02:06:25.996622 nusoap_client: SOAP message length=1476 contents (max 1000 bytes)=<?xml version="1.0" encoding="ISO-8859-1"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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/"><SOAP-ENV:Body><ns8524:teste xmlns:ns8524="http://tempuri.org"><__numeric_0 xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:udmDados-IdmDados" 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/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <ns1:requisicao> <XML xsi:type="xsd:string">
2017-05-05 02:06:25.996622 nusoap_client: transporting via HTTP
2017-05-05 02:06:25.996622 nusoap_client: sending message, length=1476
2017-05-05 02:06:25.996622 soap_transport_http: ctor url=http://186.251.24.59/wbsStoreage/VirtualWsServer.exe/soap/IdmDados use_curl= curl_options:
array(0) {
}
2017-05-05 02:06:25.996622 soap_transport_http: parsed URL scheme = http
2017-05-05 02:06:25.996622 soap_transport_http: parsed URL host = 186.251.24.59
2017-05-05 02:06:25.996622 soap_transport_http: parsed URL path = /wbsStoreage/VirtualWsServer.exe/soap/IdmDados
2017-05-05 02:06:25.996622 soap_transport_http: set header Host: 186.251.24.59
2017-05-05 02:06:25.996622 soap_transport_http: set header User-Agent: NuSOAP/0.9.5 (1.123)
2017-05-05 02:06:25.996622 soap_transport_http: set header Content-Type: text/xml; charset=ISO-8859-1
2017-05-05 02:06:25.996622 soap_transport_http: set header SOAPAction: ""
2017-05-05 02:06:25.996622 soap_transport_http: entered send() with data of length: 1476
2017-05-05 02:06:25.996622 soap_transport_http: connect connection_timeout 0, response_timeout 30, scheme http, host 186.251.24.59, port 80
2017-05-05 02:06:25.996622 soap_transport_http: calling fsockopen with host 186.251.24.59 connection_timeout 0
2017-05-05 02:06:29.054242 soap_transport_http: set response timeout to 30
2017-05-05 02:06:29.054242 soap_transport_http: socket connected
2017-05-05 02:06:29.054242 soap_transport_http: set header Content-Length: 1476
2017-05-05 02:06:29.054242 soap_transport_http: HTTP request: POST /wbsStoreage/VirtualWsServer.exe/soap/IdmDados HTTP/1.0
2017-05-05 02:06:29.054242 soap_transport_http: HTTP header: Host: 186.251.24.59
2017-05-05 02:06:29.054242 soap_transport_http: HTTP header: User-Agent: NuSOAP/0.9.5 (1.123)
2017-05-05 02:06:29.054242 soap_transport_http: HTTP header: Content-Type: text/xml; charset=ISO-8859-1
2017-05-05 02:06:29.054242 soap_transport_http: HTTP header: SOAPAction: ""
2017-05-05 02:06:29.054242 soap_transport_http: HTTP header: Content-Length: 1476
2017-05-05 02:06:29.054242 soap_transport_http: wrote data to socket, length = 1677
2017-05-05 02:06:29.194643 soap_transport_http: read line of 17 bytes: HTTP/1.1 200 OK
2017-05-05 02:06:29.194643 soap_transport_http: read line of 37 bytes: Date: Fri, 05 May 2017 00:06:29 GMT
2017-05-05 02:06:29.194643 soap_transport_http: read line of 31 bytes: Server: Apache/2.2.22 (Win32)
2017-05-05 02:06:29.194643 soap_transport_http: read line of 11 bytes: Content:
2017-05-05 02:06:29.194643 soap_transport_http: read line of 21 bytes: Content-Length: 483
2017-05-05 02:06:29.194643 soap_transport_http: read line of 19 bytes: Connection: close
2017-05-05 02:06:29.194643 soap_transport_http: read line of 24 bytes: Content-Type: text/xml
2017-05-05 02:06:29.194643 soap_transport_http: read line of 2 bytes:
2017-05-05 02:06:29.194643 soap_transport_http: found end of headers after length 162
2017-05-05 02:06:29.194643 soap_transport_http: want to read content of length 483
2017-05-05 02:06:29.194643 soap_transport_http: read buffer of 483 bytes
2017-05-05 02:06:29.194643 soap_transport_http: read body of length 483
2017-05-05 02:06:29.194643 soap_transport_http: received a total of 645 bytes of data from server
2017-05-05 02:06:29.194643 soap_transport_http: closed socket
2017-05-05 02:06:29.194643 soap_transport_http: No Content-Encoding header
2017-05-05 02:06:29.194643 soap_transport_http: end of send()
2017-05-05 02:06:29.194643 nusoap_client: got response, length=483 type=text/xml
2017-05-05 02:06:29.194643 nusoap_client: Entering parseResponse() for data of length 483 headers:
array(6) {
["date"]=>
string(29) "Fri, 05 May 2017 00:06:29 GMT"
["server"]=>
string(21) "Apache/2.2.22 (Win32)"
["content"]=>
string(0) ""
["content-length"]=>
string(3) "483"
["connection"]=>
string(5) "close"
["content-type"]=>
string(8) "text/xml"
}
2017-05-05 02:06:29.194643 nusoap_client: Use encoding: ISO-8859-1 when creating nusoap_parser
2017-05-05 02:06:29.194643 nusoap_parser: No encoding specified in XML declaration
2017-05-05 02:06:29.194643 nusoap_parser: Entering nusoap_parser(), length=483, encoding=ISO-8859-1
2017-05-05 02:06:29.194643 nusoap_parser: found root struct Fault, pos 2
2017-05-05 02:06:29.194643 nusoap_parser: in buildVal() for Fault(pos 2) of type struct
2017-05-05 02:06:29.194643 nusoap_parser: in buildVal, there are children
2017-05-05 02:06:29.194643 nusoap_parser: in buildVal, adding Java Vector or generic compound type Fault
2017-05-05 02:06:29.194643 nusoap_parser: in buildVal, return:
array(3) {
["faultactor"]=>
&string(0) ""
["faultcode"]=>
&string(15) "SOAP-ENV:Server"
["faultstring"]=>
&string(60) "No method named 'teste' is supported by interface 'IdmDados'"
}
2017-05-05 02:06:29.194643 nusoap_parser: in nusoap_parser ctor, message:
array(6) {
[0]=>
array(9) {
["pos"]=>
int(0)
["children"]=>
string(2) "|1"
["cdata"]=>
string(0) ""
["depth"]=>
int(0)
["parent"]=>
string(0) ""
["status"]=>
string(8) "envelope"
["name"]=>
string(8) "Envelope"
["attrs"]=>
array(4) {
["xmlns:SOAP-ENV"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
["xmlns:xsd"]=>
string(32) "http://www.w3.org/2001/XMLSchema"
["xmlns:xsi"]=>
string(41) "http://www.w3.org/2001/XMLSchema-instance"
["xmlns:SOAP-ENC"]=>
string(41) "http://schemas.xmlsoap.org/soap/encoding/"
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}
[1]=>
array(9) {
["pos"]=>
int(1)
["children"]=>
string(2) "|2"
["cdata"]=>
string(0) ""
["depth"]=>
int(1)
["parent"]=>
int(0)
["status"]=>
string(4) "body"
["name"]=>
string(4) "Body"
["attrs"]=>
array(0) {
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
}
[2]=>
array(11) {
["pos"]=>
int(2)
["children"]=>
string(6) "|3|4|5"
["cdata"]=>
string(0) ""
["depth"]=>
int(2)
["parent"]=>
int(1)
["type"]=>
string(6) "struct"
["status"]=>
string(6) "method"
["name"]=>
string(5) "Fault"
["attrs"]=>
array(0) {
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
["result"]=>
array(3) {
["faultactor"]=>
&string(0) ""
["faultcode"]=>
&string(15) "SOAP-ENV:Server"
["faultstring"]=>
&string(60) "No method named 'teste' is supported by interface 'IdmDados'"
}
}
[3]=>
array(10) {
["pos"]=>
int(3)
["children"]=>
string(0) ""
["cdata"]=>
string(0) ""
["depth"]=>
int(3)
["parent"]=>
int(2)
["status"]=>
string(6) "method"
["name"]=>
string(10) "faultactor"
["attrs"]=>
array(0) {
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
["result"]=>
&string(0) ""
}
[4]=>
array(10) {
["pos"]=>
int(4)
["children"]=>
string(0) ""
["cdata"]=>
string(15) "SOAP-ENV:Server"
["depth"]=>
int(3)
["parent"]=>
int(2)
["status"]=>
string(6) "method"
["name"]=>
string(9) "faultcode"
["attrs"]=>
array(0) {
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
["result"]=>
&string(15) "SOAP-ENV:Server"
}
[5]=>
array(10) {
["pos"]=>
int(5)
["children"]=>
string(0) ""
["cdata"]=>
string(60) "No method named 'teste' is supported by interface 'IdmDados'"
["depth"]=>
int(3)
["parent"]=>
int(2)
["status"]=>
string(6) "method"
["name"]=>
string(11) "faultstring"
["attrs"]=>
array(0) {
}
["namespace"]=>
string(41) "http://schemas.xmlsoap.org/soap/envelope/"
["result"]=>
&string(60) "No method named 'teste' is supported by interface 'IdmDados'"
}
}
2017-05-05 02:06:29.194643 nusoap_parser: parsed successfully, found root struct: 2 of name Fault
2017-05-05 02:06:29.194643 nusoap_client: sent message successfully and got a(n) array
return=array(3) {
["faultactor"]=>
string(0) ""
["faultcode"]=>
string(15) "SOAP-ENV:Server"
["faultstring"]=>
string(60) "No method named 'teste' is supported by interface 'IdmDados'"
}
2017-05-05 02:06:29.194643 nusoap_client: got fault
2017-05-05 02:06:29.194643 nusoap_client: faultactor = <br>
2017-05-05 02:06:29.194643 nusoap_client: faultcode = SOAP-ENV:Server<br>
2017-05-05 02:06:29.194643 nusoap_client: faultstring = No method named 'teste' is supported by interface 'IdmDados'<br>