Advertisement
Guest User

PHP Soap Issue

a guest
Dec 3rd, 2013
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. ----------------------------------------------
  2. server.php:
  3. ----------------------------------------------
  4. <?php
  5. class TestClass {
  6. public function importData($data)
  7. {
  8. $fd = fopen("testsoap.log", "a");
  9. fwrite($fd, var_export($data, true));
  10. fclose($fd);
  11.  
  12. return array();
  13. }
  14. }
  15.  
  16. $server = new SoapServer("test.wsdl");
  17. $server->setClass("TestClass");
  18. $server->handle();
  19.  
  20.  
  21. ----------------------------------------------
  22. client.php:
  23. ----------------------------------------------
  24. <?php
  25. for($i = 1; $i < 40000; $i++) {
  26. $data .= "+";
  27. }
  28.  
  29. $obj = new stdClass();
  30. $obj->someVariable = $data;
  31. $client = new SoapClient("test.wsdl");
  32. $something = $client->importData($obj);
  33. var_dump($something);
  34.  
  35. ----------------------------------------------
  36. WSDL:
  37. ----------------------------------------------
  38. <definitions name="importData"
  39. targetNamespace="http://some_url"
  40. xmlns:es="http://url_to/server.php"
  41. xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
  42. xmlns="http://schemas.xmlsoap.org/wsdl/"
  43. >
  44.  
  45. <message name="importDataRequest">
  46. <part name="irgendwas" element="xsd:string"/>
  47. </message>
  48.  
  49. <portType name="importDataPortType">
  50. <operation name="importData">
  51. <input message="es:importDataRequest"/>
  52. </operation>
  53. </portType>
  54.  
  55. <binding name="importDataSoapBinding"
  56. type="es:importDataPortType">
  57. <soap:binding style="document"
  58. transport="http://schemas.xmlsoap.org/soap/http"/>
  59. <operation name="importData">
  60. <soap:operation
  61. soapAction="http://url_to/server.php"/>
  62. <input>
  63. <soap:body use="literal"
  64. namespace="http://some_url"/>
  65. </input>
  66. </operation>
  67. </binding>
  68.  
  69. <service name="importDataService">
  70. <documentation>import Data</documentation>
  71. <port name="importDataPort"
  72. binding="es:importDataSoapBinding">
  73. <soap:address location="http://url_to/server.php"/>
  74. </port>
  75. </service>
  76.  
  77. </definitions>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement