|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-02-16 09:39 UTC] cfendt at silicom dot fr
Description:
------------
Hello,
I try to make some DB work after a SoapServer::handle()... but the script ends!
on the output, we can see the soapFault dump, but no "<!-- Alive!!!! -->"...
I try it on Win 5.0.1, Win 5.0.3, Win 5.0-CVS (15/2/2005), Win 5.1-CVS (15/2/2005), OS X 5.0.1 (build from source), OS X 5.0.3 (build from source)
Reproduce code:
---------------
<?php
$server = new SoapServer(null,
array('uri' => "http://test-uri/"));
$server->handle("");
echo "\r\n<!-- Alive!!!! -->\r\n";
?>
Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Bad Request</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
<!-- Alive!!!! -->
Actual result:
--------------
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Bad Request</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 01:00:01 2025 UTC |
In fact, I use a WSDL file... CODE : <?php class web_service { function sayHello($input) { return "Hello, ".$input."..."; } } $soap_query = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>" . " <soapenv:Body>" . " <m:sayHello xmlns:m='http://localhost/test.php'>" . " <m:login>toto</m:login>" . " </m:sayHello>" . " </soapenv:Body>" . "</soapenv:Envelope>"; $server = new SoapServer("./test.wsdl"); $server->setclass("web_service"); $server->handle($soap_query); echo "\r\nAlive!!!!\r\n"; $server->handle(""); echo "\r\nAlive!!!!\r\n"; ?> WSDL : <?xml version="1.0"?> <wsdl:definitions xmlns:tns="urn:TEST" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:typens="urn:TEST" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:TEST" name="TEST"> <message name="sayHelloInputMessage"> <part name="login" type="xsd:string"/> </message> <message name="sayHelloOutputMessage"> <part name="hello" type="xsd:string"/> </message> <portType name="TESTPorts"> <operation name="sayHello"> <input message="typens:sayHelloInputMessage"/> <output message="typens:sayHelloOutputMessage"/> </operation> </portType> <binding name="TESTBinding" type="typens:TESTPorts"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="sayHello"> <soap:operation soapAction="http://localhost/test.php"/> <input ><soap:body use="literal"/></input > <output><soap:body use="literal"/></output> </operation> </binding> <service name="TESTWebService"> <documentation>TEST WebService</documentation> <port name="TESTPorts" binding="typens:TESTBinding"> <soap:address location="http://localhost/test.php"/> </port> </service> </wsdl:definitions> RESULT : <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP-ENV:sayHelloResponse> <hello>Hello, toto...</hello> </SOAP-ENV:sayHelloResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Alive!!!! <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Bad Request</faultstring> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope> When the query is good => no problem The probleme is due to the SoapFault... I tried to catch SoapFault... but without result... try { $server->handle(""); } catch (SoapFault $fault) { echo "SoapFault"; } I don't know what is the more switable: never stop the process, or throw Exception... Regards, FENDT Charles