Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a simple WCF Service running with a GET function. When I call it in a web browser. It works fine.

When I try the following PHP call:

define('NEWLINE' , "< br />
");
$wsdl = "https://www.***.info/Webservices/WCF/***.svc?wsdl";
Line 727: $soapClient= new SoapClient($wsdl,array('cache_wsdl' => 0));
$result = $soapClient->TestForPHP();
$soapClient = null;
echo "WCF service Return value: "." "."($result->getMessageResult)". NEWLINE;

I get the following error in my debug:

PHP Fatal error:  Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Could not find any usable binding services in WSDL. in /home/customer/www/staging9.***.com/public_html/wp-content/themes/hello-theme-child-master/functions.php:727

Here is what my bindings look like in my web.config file:

<system.serviceModel>
 
    <behaviors>
      <serviceBehaviors>
        <behavior name="inculdeExceptionDetails">
          <serviceDebug includeExceptionDetailInFaults="true " />
        </behavior>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior>
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="https">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </webHttpBinding>
    </bindings>
    <protocolMapping>
      <add binding="webHttpBinding" scheme="http" />
      <add binding="webHttpBinding" scheme="https" bindingConfiguration="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 

This webservice is in use being successfully consumed by other .NET clients, but this is my first attempt at doing it with PHP. I have also just tested and it works in jquery (which for now I will work with). I honestly, do not understand my binding settings though I remember that I did struggle to set it up to work properly for my .NET clients


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
284 views
Welcome To Ask or Share your Answers For Others

1 Answer

The binding used by your WCF service is webHttpBinding, so it is not correct to use soapClient to call the wcf service. You need to construct an HTTP request to access your WCF service.You can refer to this link to construct HTTP requests to access WCF services:HTTP Request


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...