WCF over HTTPS with PHP throwing "Method not allowed" exception
I created a WCF.NET service that should always be over HTTPS. When I first created the service skeleton and ran it over HTTP it worked fine. I used PHP5 to test for compatibility with built-in SOAP functions. However, once I switched to HTTPS, when I try to call a function from PHP, I get an error with the message "Method Not Allowed" and the error code "http". However, this allows me to get a list of methods. The error occurs when calling the Test method.
Here is the WCF config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="secureBasic">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="apiBehavior" name="TestAPI.API">
<endpoint address="https://192.168.0.3/API"
binding="basicHttpBinding"
bindingConfiguration="secureBasic"
contract="TestAPI.IAPI"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="apiBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
And this is what PHP calls it:
$client = new SoapClient("https://192.168.0.3/API.svc?wsdl");
echo "<pre>" . print_r($client->__getFunctions(), 1) . "</pre>";
$param = new stdClass();
$param->A = "123";
$param->B = "456";
try {
$client->Test($param);
} catch (Exception $e) {
die("<pre>" . print_r($e,1) . "</pre>");
}
I am using a self signed SSL certificate for testing and I do not believe PHP requires a trusted certificate.
What am I doing wrong?
+1
source to share