PHP SOAP Continued

So, continuing from my last post, there's a missing chunk of documentation for PHP::SOAP, especially when it comes to interacting with .NET SOAP Servers. It's especially odd, because SOAP is one of the places where Microsoft seems to have written their code to exactly meet the standard; the problem probably isn't on the Microsoft end of things.

Again, we shut off the WS-Security specific to SOAP, and only used HTTP Authentication, by the customer's request. It seems that WS-Security uses a call to $client->setCredentials($user, $pass, 'basic), whereas HTTP Auth requires user/pass in the instantiation of the SoapClient.

Anyways, here's the example:


$user="bob";
$password='bobspassword';
$wsdl = "https://".$user.":".$password."@example.org/ws/supervisors/?wsdl";

$client = new SoapClient($wsdl, array("trace" => 1, "exceptions" => 0, "login" => $user, "password" => $password));

// Debugging information to show all functions described in the WSDL
$functions = $client->__getFunctions();
print_r($functions);
$types = $client->__getTypes();
print_r($types);
print "

";


// Call the SOAP service
$params->empId= "12345";
$response = $client->EmpToSuper($params);

// Display more debgging information
print_r($response);

print "

\n";

// Display the request that was sent out
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";

// Display the response that came back
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";

print "
";
?>

No comments: