Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WSDL (service.xml):
- -------------------
- <?xml version="1.0" encoding="UTF-8"?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://127.0.0.1/soap/server.php?a=a&b=b" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="TestService" targetNamespace="http://127.0.0.1/soap/server.php?a=a&b=b">
- <types>
- <xsd:schema targetNamespace="http://127.0.0.1/soap/server.php?a=a&b=b" />
- </types>
- <portType name="TestServicePort">
- <operation name="test">
- <documentation>test</documentation>
- <input message="tns:testIn" />
- <output message="tns:testOut" />
- </operation>
- </portType>
- <binding name="TestServiceBinding" type="tns:TestServicePort">
- <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="test">
- <soap:operation soapAction="http://127.0.0.1/soap/server.php?a=a&b=b#test" />
- <input>
- <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://127.0.0.1/soap/server.php?a=a&b=b" />
- </input>
- <output>
- <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://127.0.0.1/soap/server.php?a=a&b=b" />
- </output>
- </operation>
- </binding>
- <service name="TestServiceService">
- <port name="TestServicePort" binding="tns:TestServiceBinding">
- <soap:address location="http://127.0.0.1/soap/server.php?a=a&b=b" />
- </port>
- </service>
- <message name="testIn" />
- <message name="testOut">
- <part name="return" type="xsd:string" />
- </message>
- </definitions>
- -------------------
- Server:
- -------------------
- $wsdl = './service.xml';
- $server = new SoapServer($wsdl, array(
- 'cache_wsdl' => WSDL_CACHE_NONE,
- ));
- $server->setClass('TestService');
- $server->handle();
- -------------------
- Client:
- -------------------
- $wsdl = './service.xml';
- $client = new SoapClient($wsdl, array(
- 'trace' => true,
- 'exceptions' => true,
- 'cache_wsdl' => WSDL_CACHE_NONE,
- ));
- $client->test(); // ERROR: Bad Request
- -------------------
- Actual invalid request:
- -------------
- SOAPAction: "http://test.local/ipb/isengard/test/soap/server.php?a=a&b=b#test"
- <?xml version="1.0" encoding="UTF-8"?>
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns1="http://127.0.0.1/soap/server.php?a=a&b=b" <!-- !!!!! ERROR !!!!! -->
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <SOAP-ENV:Body>
- <ns1:test />
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- ------------
- Must be:
- ------------
- SOAPAction: "http://test.local/ipb/isengard/test/soap/server.php?a=a&b=b#test"
- <?xml version="1.0" encoding="UTF-8"?>
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns1="http://127.0.0.1/soap/server.php?a=a&b=b"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <SOAP-ENV:Body>
- <ns1:test />
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- ------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement