php - Windows 服务内托管的 WCF 服务 (basicHttpBinding) 的 WSDL URL

标签 php wcf url 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?

最佳答案

这可能有帮助:

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

关于php - Windows 服务内托管的 WCF 服务 (basicHttpBinding) 的 WSDL URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/167852/

相关文章:

php - 没有 Paypal 账户的 Paypal 定期付款

php - 按字段对结果进行分组,但显示全部结果并按自定义顺序显示

c# - 使用 IParameterInspector.BeforeCall(string operationName, object[] inputs) 中止调用

c# - 添加 [PrincipalPermission(SecurityAction.Demand, Role = "ADMIN")] 时,对象引用未设置为对象的实例

jquery - Accordion 菜单,第一次单击时展开,如果子菜单展开则转到 URL

php - php URL 可以有数字参数吗?

php - 在php中将地址转换为经纬度

PHP - 变量包含不适用于 namespace 内的 include_once

c# - 用于 C# 的 WSDL 生成器

reactjs - 使用 URL 对象进行 Jest 测试