I was having a lot of problems building a form that interacts with objects from a third party API via SOAP. I finally resolved the connection problems by making a change to the soap header.
Here is the XML that is required for the request:
<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:Header>
<AuthHeader xmlns="namespace.url">
<Username>string</Username>
<Password>string</Password>
</AuthHeader>
</soap:Header>
<soap:Body>
<SomeFunction xmlns="namespace.url" />
</soap:Body>
</soap:Envelope>
Here is the PHP I used along with some debug:
<?php
$wdsl = "http://servicedomain.service?wsdl";
$client = new SoapClient($wdsl, array("soap_version"=> SOAP_1_1,
'trace' => 1,
'exceptions' => 0
));
$ns = 'namespace.url';
$headerbody = array( 'AuthHeader' => array('Username' => 'user', 'Password' => 'pass'));
$header = new SoapHeader($ns, 'AuthHeader', $headerbody);
$client->__setSoapHeaders($header);
$response = $client->SomeFunction();
var_dump($response);
echo "REQUEST HEADER:\n" . $client->__getLastRequestHeaders() . "\n";
echo "REQUEST:\n" . $client->__getLastRequest() . "\n";
echo "RESPONSE HEADER:\n" . $client->__getLastResponseHeaders() . "\n";
echo "RESPONSE:\n" . $client->__getLastResponse() . "\n";
?>