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

问题描述:

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

当我必须在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中不同的AM我被迫使用一个普通的WebService

+0

不错。感谢搜索,发现你的问题和答案 – 2010-11-25 15:15:25

这可能帮助:

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> 

不要忘记删除XML注释,因为它们无效,它们在哪里。

+2

我很抱歉,但链接似乎被破坏 – 2008-10-04 10:51:21

请参阅?此链接:

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. 
+0

也谢谢你:) - 你指出的文件也显示httpGetEnabled设置为true。 – 2008-10-05 19:40:35