0

I need to construct SOAP message from database query search results and send it to another server. Can you give me a quick guide of how should I do it? I was told I should json encode query results in PHP, pass json to javascript and create SOAP xml using RESTful in javascript. Any ideas what would be the best way to do this task?

Thanks ^.^

Ward
  • 135
  • 1
  • 9
  • When is this happening? If you are sending data to another server when you are calling PHP code anyway, why complicate it with javascript? you can use cURL or SoapClient to do a server to server request right from PHP – Brian Heward Sep 09 '16 at 17:33
  • I was told it should be easier to construct soap message with javascript than with PHP. – Ward Sep 09 '16 at 17:38
  • "create SOAP xml using RESTful in javascript". That sounds wrong. SOAP is one way to build an API. A REST api is another way. If you just need to send data from one server to another... just create a REST api and send the json data between the servers... – M. Eriksson Sep 09 '16 at 17:39
  • If js only complicates things, I can try using cURL. Thanks! – Ward Sep 09 '16 at 17:41
  • ...you could check PHP's native SoapClient class? Then you don't need to manually build the request. – M. Eriksson Sep 09 '16 at 17:41
  • I've done SOAP calls in PHP. They aren't that hard. take a look at [link](http://stackoverflow.com/questions/11593623/how-to-make-a-php-soap-call-using-the-soapclient-class)this question's answers. or the php manual for SoapClient – Brian Heward Sep 09 '16 at 17:42
  • I can't send simple json. The endpoint is oracle service that requires strict SOAP message structure. – Ward Sep 09 '16 at 17:45
  • Then use PHP's native [SoapClient](http://php.net/manual/en/class.soapclient.php) instead of trying to build your own. – M. Eriksson Sep 09 '16 at 17:45
  • I'll try that. Thanks for the help guys! – Ward Sep 09 '16 at 17:47

0 Answers0