Bagroff
Новичок
soap srv vs soap client. не формируется респонз&реквест
Есть soap-сервер
Есть soap-клиент
Есть wsdl описание веб-сервиса
Но, увы и ах... ни реквеста, ни респонза нет...
<pre>
stdClass Object
(
)
</pre>
string(191) "POST /timesrv.php HTTP/1.1
Host: websrv
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://websrv/GetTime"
Content-Length: 211
"
string(236) "HTTP/1.1 200 OK
Date: Mon, 15 Jan 2007 09:29:54 GMT
Server: Apache/2.2.0 (Unix) PHP/5.1.2
X-Powered-By: PHP/5.1.2
Content-Length: 220
Keep-Alive: timeout=999, max=100
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
"
REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://websrv/"><SOAP-ENV:Body><ns1:GetArray/></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://websrv/"><SOAP-ENV:Body><ns1:GetArrayResponse/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Наверное, что не так с описанием wsdl:types...
Есть soap-сервер
PHP:
function GetTime($GetArray='Y-m-d H:i:s') {
$result = array();
$result[0] = date($GetArray);
$result[1] = mktime();
return $result;
}
ini_set("soap.wsdl_cache_enabled", "0");
$server = new SoapServer("time.wsdl");
$server->addFunction("GetTime");
$server->handle();
PHP:
ini_set("soap.wsdl_cache_enabled", "0");
$client = new SoapClient("http://websrv/time.wsdl", array('trace' => 1));
try {
echo "<pre>\n";
$result = $client->GetTime("H:i:s");
print_r($result);
echo "\n</pre>\n";
} catch (SoapFault $exception) {
echo $exception;
}
var_dump($client->__getLastRequestHeaders());
var_dump($client->__getLastResponseHeaders());
echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
echo "RESPONSE:\n" . $client->__getLastResponse() . "\n";
PHP:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://websrv/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://websrv/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://websrv/">
<s:element name="GetArray">
<s:complexType/>
</s:element>
<s:element name="GetArrayResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="GetArrayResult" type="tns:ArrayOfString"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfString">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string"/>
</s:sequence>
</s:complexType>
</s:schema>
</wsdl:types>
<wsdl:message name="MessageRequest">
<wsdl:part name="parameter" element="tns:GetArray"/>
</wsdl:message>
<wsdl:message name="MessageResponse">
<wsdl:part name="parameter" element="tns:GetArrayResponse"/>
</wsdl:message>
<wsdl:portType name="TimeService">
<wsdl:operation name="GetTime">
<wsdl:input message="tns:MessageRequest"/>
<wsdl:output message="tns:MessageResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TimeService" type="tns:TimeService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetTime">
<soap:operation soapAction="http://websrv/GetTime" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="TimeService12" type="tns:TimeService">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetTime">
<soap12:operation soapAction="http://websrv/GetTime" style="rpc"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TimeService">
<wsdl:port name="TimeService" binding="tns:TimeService">
<soap:address location="http://websrv/timesrv.php"/>
</wsdl:port>
<wsdl:port name="TimeService12" binding="tns:TimeService12">
<soap12:address location="http://websrv/timesrv.php"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
<pre>
stdClass Object
(
)
</pre>
string(191) "POST /timesrv.php HTTP/1.1
Host: websrv
Connection: Keep-Alive
User-Agent: PHP SOAP 0.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://websrv/GetTime"
Content-Length: 211
"
string(236) "HTTP/1.1 200 OK
Date: Mon, 15 Jan 2007 09:29:54 GMT
Server: Apache/2.2.0 (Unix) PHP/5.1.2
X-Powered-By: PHP/5.1.2
Content-Length: 220
Keep-Alive: timeout=999, max=100
Connection: Keep-Alive
Content-Type: text/xml; charset=utf-8
"
REQUEST:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://websrv/"><SOAP-ENV:Body><ns1:GetArray/></SOAP-ENV:Body></SOAP-ENV:Envelope>
RESPONSE:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://websrv/"><SOAP-ENV:Body><ns1:GetArrayResponse/></SOAP-ENV:Body></SOAP-ENV:Envelope>
Наверное, что не так с описанием wsdl:types...