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 :D
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?
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.
Please see this link:
Exposing a WCF Service With Multiple Bindings and Endpoints
Unlike previous ASMX services, the WSDL (web service definition language) for WCF services is not automatically generated. The previous image even tells us that "Metadata publishing for this service is currently disabled.". This is because we haven't configured our service to expose any meta data about it. To expose a WSDL for a service we need to configure our service to provide meta information. Note: The mexHttpBinding is also used to share meta information about a service. While the name isn't very "gump" it stands for Meta Data Exchange.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With