I am trying to learn the basics, but I cannot get a working example for a request. Here is what I have:
Request needed:
Code
POST /swsim/SwsimV42.asmx HTTP/1.1
Host: swsim.testing.stamps.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://stamps.com/xml/namespace/2015/01/swsim/swsimv42/AuthenticateUser"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AuthenticateUser xmlns="http://stamps.com/xml/namespace/2015/01/swsim/swsimv42">
<Credentials>
<IntegrationID>guid</IntegrationID>
<Username>string</Username>
<Password>string</Password>
</Credentials>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>
PHP Code:
Code
<?php
$wsdl = 'https://swsim.testing.stamps.com/swsim/swsimv42.asmx?WSDL';
$trace = true;
$exceptions = true;
$Credentials = array(
'IntegrationID' => 'my-int-id',
'Username' => 'username',
'Password' => 'password'
);
try
{
$client = new SoapClient($wsdl, array('trace' => $trace, 'exceptions' => $exceptions));
$response = $client->AuthenticateUser($Credentials);
}
catch (Exception $e)
{
echo "Error!";
echo $e -> getMessage ();
echo 'Last response: '. $client->__getLastResponse();
}
var_dump($response);
?>
Error:
Code
Error!SOAP-ERROR: Encoding: object has no 'Credentials' propertyLast response:
Notice: Undefined variable: response in C:\Stamps\TEST.php on line 26
NULL
This seems like it should be very simple to fix but I am inexperienced with PHP and SOAP. I am looking for the most simplistic answer. 300fg for corrected PHP code.