I tried to connect to SOAP web service built in .NET from PHP using SOAPClient.
https://yoyoddoofof.cloudapp.net/TimeCardService.svc?wsdl
Also, I need to use x509 Self-Signed Certificate to encrypt all outgoing messages to their server. The certificate I got has .cer extension. Do I need to convert it to .pem before I use it with PHP SOAP client or I can use .cer with the SOAP client?
class Hello {
/**
* @var string
*/
public $echo = 'Hello';
}
$local_cert = "$dir/Request_Root_CA.pem";
$options = array('login' => 'myUsername', 'password' => 'NoPass4me');
$client = new SoapClient("https://yoyoddoofof.cloudapp.net/TimeCardService.svc?wsdl", $options);
// Print all the availiable functions to call
echo '<pre>';
print_r($client->__getFunctions());
echo '</pre>';
$response = $client->Hello(new Hello());
Output:
Array
(
[0] => HelloResponse Hello(Hello $parameters)
)
SoapFault Object
(
[message:protected] => Unsupported Media Type
When I tried to use the service using the above client to call Hello function passing it a Hello object, I got an ‘Unsupported Media Type’ exception message.
This indicates to me that it is expecting an Echo class instead of plain string? But I couldn’t test that one because I cannot create a class with name Echo.
Can anybody please tell me what could be the problem here? Either interoperability between PHP and .NET WCF services or Data type issue.
Also, how can we use PHP Soap client to use x509 Self-Signed Certificate to encrypt outgoing messages?