URL de WSDL para un servicio WCF (basicHttpBinding) alojado dentro de un servicio de Windows
-
03-07-2019 - |
Pregunta
Estoy alojando un servicio WCF en un servicio de Windows en uno de nuestros servidores. Después de hacer que funcionara en basicHttpBinding y construir un cliente de prueba en .NET (que finalmente funcionó), fui y traté de acceder a él desde PHP usando la clase SoapClient. El consumidor final será un sitio PHP, así que necesito que sea consumible en PHP.
Me quedé perplejo cuando tuve que ingresar la URL de WSDL en el constructor de la clase SoapClient en el código PHP. ¿Dónde está el WSDL? Todo lo que tengo es:
http://172.27.7.123:8000/WordService y http://172.27.7.123:8000/WordService/mex
Ninguno de estos no expone WSDL.
Siendo un novato en WCF, podría haber preguntado algo tonto (o podría tener una suposición errónea en alguna parte). Por favor, sé gentil: D
Y no, http://172.27.7.123:8000/WordService?wsdl no muestra algo diferente a http://172.27.7.123:8000/WordService :(
¿Estoy obligado a alojarlo en IIS? ¿Estoy obligado a usar un servicio web regular?
Solución
Esto podría ayudar:
http://msdn.microsoft.com/en-us/library /ms734765.aspx
En pocas palabras, debe configurar los puntos finales y el comportamiento de su servicio. Aquí hay un ejemplo mínimo:
<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>
No olvides eliminar los comentarios XML ya que no son válidos donde están.
Otros consejos
Por favor vea este enlace:
Exponer un servicio WCF con múltiples enlaces y puntos finales
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.