Cannot call WCF service methods from php script


I have WCF service. When I try to access it from .NET page all works fine. However I cannot find a way to access it from php script.

    <binding name="NewBinding0">
      <reliableSession inactivityTimeout="01:00:00" />
      <security mode="TransportWithMessageCredential">
        <transport clientCredentialType="Basic" />
        <message clientCredentialType="UserName" />

    <behavior name="RegisterBehavior">
      <serviceDebug includeExceptionDetailInFaults="true" />
      <serviceMetadata httpsGetEnabled="true" />
      <serviceThrottling maxConcurrentCalls="48" maxConcurrentSessions="5000"
        maxConcurrentInstances="5000" />
        <userNameAuthentication userNamePasswordValidationMode="Custom"
          cacheLogonTokens="true" cachedLogonTokenLifetime="01:00:00" />
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
  <service behaviorConfiguration="RegisterBehavior" name="Riepas.WCFRiepas">
    <endpoint address="..."
      binding="wsHttpBinding" bindingConfiguration="NewBinding0" contract="...">

    <endpoint address="mex" binding="mexHttpsBinding" name="mex"

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"

Tried connecting from php, but it just hang. :(

    $client = new SoapClient("wsdl", array(
                                           'login'    => "...",
                                            'password' => "...",
                                            'soap_version'   => SOAP_1_2));
                                            $functions = $client->__getFunctions ();
var_dump ($functions);

$parameters = array("ReqVal" => "nu?");
//$result = $client->__soapCall("GetStr", $parameters);
//$result = $client->GetStr($parameters);

Functions returns normaly.




In order to use the php soapclient, you need to use basicHttpBinding, not wsHttpBinding.

For a very simple complete working example, see my Echo Service, which includes a php client.

This downside of this is that your service will not implement WS-Reliable Messaging or WS-Security. However, if you need those, there is an open source party module called the WSO2 Web Services Framework for PHP that supposedly handles wsHttpBinding.

People are also looking for solutions to the problem: Storing PHP 5.3 sessions into PostgreSQL 8.4


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.