SOAP call to WisePay WSDL from PHP


I'm trying to make use of an API with this service provider to submit student data, presented as XML.  I am confident that the XML itself is correctly constructed, but am not overly familiar with the PHP SoapClient class.

The WSDL I'm using is this:

This has an 'xmltext' element, into which I'm trying to pass the constructed XML as a parameter.  I believe it is this bit that is not working, since a dump of the SOAP Request does not contain said content.  The error I'm getting back from the web service is "Failed XML Initialisation", which I think supports this theory.

I'm running PHP 5.4 on Windows Server 2012 R2 (IIS 8.5).

My PHP code follows.  $xmltext is soundly constructed XML.  The commented code are alternatives I've already tried.

If anyone has any tips to assist, I'd be grateful to hear them.

$soap_client_options = array(       'trace'=>1

$client = new SoapClient('', $soap_client_options);

class WisePaySubmission {
      public $xmltext;

$wps = new WisePaySubmission();
$wps->xmltext = $xmltext;

$params = array(

$params = array(

// Invoke webservice method
$response = $client->WisePaySendAccounts (array($params));

// Also tried...
//$response = $client->__soapCall("WisePaySendAccounts", array($params));

// Print webservice response
echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "\n";
echo "REQUEST:\n" . $client->__getLastRequest() . "\n";

A dump of the headers, constructed SOAP request and response follows:

POST /services/WP_Account_Import_ws.asmx HTTP/1.1
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.4.14
Content-Type: text/xml; charset=utf-8
SOAPAction: ""

Content-Length: 254

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="" xm

object(stdClass)#1 (1) {
  string(26) "Failed XML Initialisation"
Anglian Learning Technical ServicesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

greetings bottishamvc, , I have done some SOAP connections in PHP, and they are a difficult to understand PHP set of code and Object methods, I looked at your  WSDL XML at -

This seems to be an XML TEXT submission Object definition.

and the "WisePaySubmission" , seems to be a TYPE definition a WSDL element, maybe not a Method.,

I feel that methods are WSDL operations, as a part of a service.

For the most part, the best way, and sometimes the only way to do successful PHP SOAP transactions, is to get the PHP code example from the Soap service, as -
in your case, I tried to find the PHP code there for this education payment service SOAP definitions, but could not find any. BUT they do say that you can get them to do, or help you to do, the SERVER code needed for their SOAP service.

You might contact them here -
Anglian Learning Technical ServicesAuthor Commented:
Thank you.  Unfortunately, Wisepay only offer a framework in ASPX, not our preferred PHP.  I have got another of their APIs working, in the form of an SSO solution, just not this one.
In your code you have two things that may help in using this WSDL -

If the WSDL has valid organization for it's objects and types definitions, the __getFunctions( )  can list the object structures linked to the method names with the TYPES for the method parameters, and the TYPE of the return, ,  that are available in that soap connection.

Unfortunately in PHP, the parameters of the TYPES can be confusing, as in PHP you can sometimes use PHP Arrays (with name=>value pairs) instead of PHP objects (with name=>value pairs). There there is the confusion (at least its confusing to me) about using the PHP -
   new SoapVar( )
or using a constructed  name=>value  array.

In your WSDL there are -

which adds (binds) to the SOAP object more methods and or types, or child (sub) objects.

you may can look at the ASP code to see how it uses the Object connections (child and or sub objects), as I have said, you can just do trial and error PHP code tests and read the error messages to try and get working code, or ask the wisepay people for some sort of PHP , help, there must be someone to use this in PHP before?
I wish I could be more help, but I do not have the experience to just read a WSDL definition like -

and know what the objects methods and types are for PHP.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anglian Learning Technical ServicesAuthor Commented:
Thanks, Slick812,

It turned out that I needed to add an extra dimension to the method parameter, like so:

$params = array(
      "xmltext"=>array ("any"=>$xmltext)

These tiny little misunderstandings can end up being so time consuming!

Thanks very much for your advice.  I've now completed the upload script and also have their SSO offering functional, so I'm grateful.

In reference to your reflection over someone must having already done this, they claim not!  I have now offered myself as a reference if anyone else approaches them about the same thing.

Many thanks,

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.