php 托管在 Windows 服务中的 WCF 服务 (basicHttpBinding) 的 WSDL URL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/167852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
WSDL URL for a WCF Service (basicHttpBinding) hosted inside a Windows Service
提问by Andrei R?nea
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.
我在我们的一台服务器上的 Windows 服务中托管 WCF 服务。在 basicHttpBinding 中使其工作并在 .NET 中构建测试客户端(最终工作)后,我继续尝试使用 SoapClient 类从 PHP 访问它。最终消费者将是一个 PHP 站点,因此我需要使其可在 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 :
当我不得不在 PHP 代码的 SoapClient 类的构造函数中输入 WSDL url 时,我被难住了。WSDL 在哪里?我所拥有的是:
http://172.27.7.123:8000/WordServiceand http://172.27.7.123:8000/WordService/mex
http://172.27.7.123:8000/WordService和 http://172.27.7.123:8000/WordService/mex
None of these do not expose WSDL.
这些都没有公开 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
作为 WCF 的新手,我可能会问一个愚蠢的问题(或者我可能在某处有错误的假设)。请温柔点 :D
And no, http://172.27.7.123:8000/WordService?wsdldoes not show anything different than http://172.27.7.123:8000/WordService:(
不,http://172.27.7.123:8000/WordService?wsdl没有显示任何与http://172.27.7.123:8000/WordService不同的东西:(
Am I forced to host it in IIS? Am I forced to use a regular WebService?
我是否被迫在 IIS 中托管它?我是否被迫使用常规的 WebService?
采纳答案by Kev
This might help:
这可能有帮助:
http://msdn.microsoft.com/en-us/library/ms734765.aspx
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.
不要忘记删除 XML 注释,因为它们在它们所在的位置无效。
回答by DaveK
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.

