Forum Moderators: coopster
<?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>
<ViewConfiguration xmlns="http://www.url.com/">
<Auth>
<User>string</User>
<Password>string</Password>
</Auth>
</ViewConfiguration>
</soap:Body>
</soap:Envelope>
So I did this:
class Auth {
public $User;
public $Password;
public function __construct($user, $pass) {
$this->User = $user;
$this->Password = $pass;
}
}
$client = new SoapClient("http://url?WSDL", array('trace' => 1, 'classmap' => array('Auth' => "Auth")));
$auth = new Auth('username', 'password');
$param = array('Auth' => $auth);
$authobj = new SoapVar($param, SOAP_ENC_OBJECT, "Auth", "http://soapinterop.org/xsd");
$response = $client->ViewConfiguration($authobj);
print($client->__getLastRequest());
SysExt::vardump($response);
This gives me:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.sterlingticket.com/">
<SOAP-ENV:Body>
<ns1:ViewConfiguration>
<Auth>
<User>username</User>
<Passwords>password</Password>
</Auth>
</ns1:ViewConfiguration>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Which is basically what I want, except it gives me an error. Then I spot that there's a namespace-difference with the function I'm calling? Please, can someone help me? I've spent the whole day trying to look for answers, but I find nothing. Has noone ever done anything similar from PHP? If it helps, the webservice is written in .NET.
[edited by: coopster at 2:20 am (utc) on Aug. 12, 2005]
[edit reason] fixed sidescroll [/edit]