Php – WSDL URL for a WCF Service (basicHttpBinding) hosted inside a Windows Service

basichttpbindingPHPurlwcfwsdl

I am hosting a WCF service in a Windows Service on one of our servers. After making it work in basicHttpBinding and building a test client in .NET (which finally worked) I went along and try to access it from PHP using the SoapClient class. The final consumer will be a PHP site so I need to make it consumable in PHP.

I got stumped when I had to enter the WSDL url in the constructor of the SoapClient class in the PHP code. Where is the WSDL? All I have is :

http://172.27.7.123:8000/WordService and
http://172.27.7.123:8000/WordService/mex

None of these do not expose WSDL.

Being a newbie in WCF I might have asked a dumb thing (or I might have a wrong assumption somewhere). Please be gentle 😀

And no, http://172.27.7.123:8000/WordService?wsdl does not show anything different than http://172.27.7.123:8000/WordService 🙁

Am I forced to host it in IIS? Am I forced to use a regular WebService?

Best Answer

This might help:

http://msdn.microsoft.com/en-us/library/ms734765.aspx

In a nutshell you need to configure your service endpoints and behaviour. Here is a minimal example:

<system.serviceModel>
  <services>

    <service 
      <!-- Namespace.ServiceClass implementation -->
      name="WcfService1.Service1" 

      <!-- User behaviour defined below -->
      behaviorConfiguration="SimpleServiceBehaviour"> 

      <endpoint 
        address="" 
        binding="basicHttpBinding"
        <!-- Namespace.Interface that defines our service contract -->
        contract="WcfService1.IService1"/>

    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="SimpleServiceBehaviour">

        <serviceMetadata 
          <!-- We allow HTTP GET -->
          httpGetEnabled="true" 

          <!-- Conform to WS-Policy 1.5 when generating metadata -->
          policyVersion="Policy15"/>

      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>

Don't forget to remove the XML comments as they're invalid where they are.