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

发布于 2024-07-06 20:05:45 字数 844 浏览 6 评论 0原文

我在我们的一台服务器上的 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 :(

我是否被迫我是否被迫使用常规 WebService?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怀念你的温柔 2024-07-13 20:05:45

这可能会有所帮助:

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 注释,因为它们在所在位置无效。

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.

心头的小情儿 2024-07-13 20:05:45

请参阅此链接:

使用多个绑定和端点公开 WCF 服务

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.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文