Link to home
Start Free TrialLog in
Avatar of Neil Thompson
Neil ThompsonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

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

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();
?>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial