Advertisement
Guest User

Untitled

a guest
May 20th, 2015
541
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. WSDL (service.xml):
  2. -------------------
  3. <?xml version="1.0" encoding="UTF-8"?>
  4. <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&amp;b=b" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  5. 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&amp;b=b">
  6. <types>
  7. <xsd:schema targetNamespace="http://127.0.0.1/soap/server.php?a=a&amp;b=b" />
  8. </types>
  9. <portType name="TestServicePort">
  10. <operation name="test">
  11. <documentation>test</documentation>
  12. <input message="tns:testIn" />
  13. <output message="tns:testOut" />
  14. </operation>
  15. </portType>
  16. <binding name="TestServiceBinding" type="tns:TestServicePort">
  17. <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
  18. <operation name="test">
  19. <soap:operation soapAction="http://127.0.0.1/soap/server.php?a=a&amp;b=b#test" />
  20. <input>
  21. <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://127.0.0.1/soap/server.php?a=a&amp;b=b" />
  22. </input>
  23. <output>
  24. <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://127.0.0.1/soap/server.php?a=a&amp;b=b" />
  25. </output>
  26. </operation>
  27. </binding>
  28. <service name="TestServiceService">
  29. <port name="TestServicePort" binding="tns:TestServiceBinding">
  30. <soap:address location="http://127.0.0.1/soap/server.php?a=a&amp;b=b" />
  31. </port>
  32. </service>
  33. <message name="testIn" />
  34. <message name="testOut">
  35. <part name="return" type="xsd:string" />
  36. </message>
  37. </definitions>
  38. -------------------
  39.  
  40. Server:
  41. -------------------
  42. $wsdl = './service.xml';
  43. $server = new SoapServer($wsdl, array(
  44. 'cache_wsdl' => WSDL_CACHE_NONE,
  45. ));
  46.  
  47. $server->setClass('TestService');
  48. $server->handle();
  49. -------------------
  50.  
  51. Client:
  52. -------------------
  53. $wsdl = './service.xml';
  54. $client = new SoapClient($wsdl, array(
  55. 'trace' => true,
  56. 'exceptions' => true,
  57. 'cache_wsdl' => WSDL_CACHE_NONE,
  58. ));
  59.  
  60. $client->test(); // ERROR: Bad Request
  61. -------------------
  62.  
  63.  
  64. Actual invalid request:
  65. -------------
  66. SOAPAction: "http://test.local/ipb/isengard/test/soap/server.php?a=a&b=b#test"
  67.  
  68. <?xml version="1.0" encoding="UTF-8"?>
  69. <SOAP-ENV:Envelope
  70. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  71. xmlns:ns1="http://127.0.0.1/soap/server.php?a=a&b=b" <!-- !!!!! ERROR !!!!! -->
  72. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  73. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  74. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  75. <SOAP-ENV:Body>
  76. <ns1:test />
  77. </SOAP-ENV:Body>
  78. </SOAP-ENV:Envelope>
  79. ------------
  80.  
  81. Must be:
  82. ------------
  83. SOAPAction: "http://test.local/ipb/isengard/test/soap/server.php?a=a&b=b#test"
  84.  
  85. <?xml version="1.0" encoding="UTF-8"?>
  86. <SOAP-ENV:Envelope
  87. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  88. xmlns:ns1="http://127.0.0.1/soap/server.php?a=a&amp;b=b"
  89. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  90. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  91. SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  92. <SOAP-ENV:Body>
  93. <ns1:test />
  94. </SOAP-ENV:Body>
  95. </SOAP-ENV:Envelope>
  96. ------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement