在Windows服务中托管的WCF服务(basicHttpBinding)的WSDL URL

And*_*nea 12 php url wcf wsdl basichttpbinding

我在我们的一台服务器上的Windows服务中托管WCF服务.在使用basicHttpBinding并在.NET中构建测试客户端(最终工作)后,我继续尝试使用SoapClient类从PHP访问它.最终的消费者将是一个PHP站点,所以我需要在PHP中使用它.

当我必须在PHP代码中的SoapClient类的构造函数中输入WSDL url时,我感到难过.WSDL在哪里?我只有:

http://172.27.7.123:8000/WordServicehttp://172.27.7.123:8000/WordService/mex

这些都不会暴露WSDL.

作为WCF的新手,我可能会问一个愚蠢的事情(或者我可能在某处有错误的假设).请温柔:D

不,http://172.27.7.123:8000/WordService?wsdl没有显示任何不同于http://172.27.7.123:8000/WordService :(

我被迫在IIS中托管它吗?我是否被迫使用常规WebService?

Kev*_*Kev 9

这可能有所帮助:

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

简而言之,您需要配置服务端点和行为.这是一个最小的例子:

<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>
Run Code Online (Sandbox Code Playgroud)

不要忘记删除XML注释,因为它们无效.

  • 我很抱歉,但链接似乎被打破了 (2认同)