PHP SOAP help needed


Not very experienced with SOAP and recently I bumped into an issue with it.
I have to make certain requests to the SOAP server and just can’t make it work. Is there anyone experienced with SOAP that could put me on the right track? I suspect that the authentication isn’t done properly thus returning me empty data objects.

Here’s a sample of my code (including the WSDL):

$auth = array(
        'AuthHeader' => array('Username' => 'myuser', 'Password' => 'mypass'),
        'trace' => true

try {
    $client = new SoapClient("", $auth);
    $result = $client->__soapCall( 'GetListOfYears', array('ModelTypeCode' => 'A') );
    echo $client->__getLastRequest();
} catch (SoapFault $e) {

here is how the client request supposed to be:

POST /GeneralGGWebService.asmx HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap12="">
    <AuthHeader xmlns="">
    <GetListOfYears xmlns="">

and here is how mine looks :frowning:

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

Thank you very much for your time, I would really appreciate any advice you could have for me.

Problem solved. Just in case anyone will bump into the same issue, here’s the solution:

 	$client = new SoapClient("http://www.your-wsdl-url.asmx?WSDL");
catch (Exception $e)

$headerbody["Username"] = 'myusername';
$headerbody["Password"] = 'mypassword';
$ns = "";

$header = new SOAPHeader($ns, 'AuthHeader', $headerbody);