troubleshooting Question

Created a SOAP server (newbie) but need to call it with XML not string params? help please

Avatar of Neil Thompson
Neil ThompsonFlag for United Kingdom of Great Britain and Northern Ireland asked on
Web Languages and StandardsPHP
1 Comment1 Solution270 ViewsLast Modified:
Hi

I'm ok with PHP and have just been asked to create a Web Service so one of our 3rd party suppliers can use our payments system. I've got all the info I need working once I have the data they want passed but I have no idea how my SOAP server should go about getting their XML

The examples I've used to learn pass parameters in as strings such as this example...

<?php
//client-test.php
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$client = new SoapClient("http://..../payments.wsdl");
$return = $client->makePayment('12.35');
?>

... but the company that wants to use our payments engine want to pass an XML document in something like...

<xml>
 <request>
  <reference>12345678</reference>
  <cardNumber>1234123456785678</cardNumber>
  <endDate>1109</endDate>
  <amount>12.51</amount>
 </request>
</xml>

... how would I go about that please? Would it simply be down to passing as simple xml in the 'makePaymentFunctions.php' page then doing what I want with it? If so how would I add it to the stub of client-test.php : $return = $client->makePayment(???????);

Many thanks
Neil
<?php 
//server.php
require 'makePaymentFunctions.php';
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("payments.wsdl");
$server->addFunction("makePayment");
$server->handle();
?>
ASKER CERTIFIED SOLUTION
leakim971
Multitechnician
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros