在 WSDL 中找不到任何可用的绑定服务 [英] Could not find any usable binding services in WSDL

查看:20
本文介绍了在 WSDL 中找不到任何可用的绑定服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Kohana 和 PHP 的 SoapServer() 类来处理 SOAP 请求(QIWI 支付系统).

I'm trying to serve SOAP requests (QIWI payment system) with Kohana and PHP's SoapServer() class.

所以我收到 PHP 致命错误,提示SOAP 错误:解析 WSDL:在 WSDL 中找不到任何可用的绑定服务."

So I'm getting PHP Fatal error saying "SOAP-ERROR: Parsing WSDL: Could not find any usable binding services in WSDL."

我的服务脚本是:

$s = new SoapServer(DOCROOT.'wsdls/IShopClientWS.wsdl');

我的 WSDL 文件位于 http://mysite.url/wsdls/IShopClientWS.wsdl

My WSDL file is in http://mysite.url/wsdls/IShopClientWS.wsdl

它的内容是:

        <?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="IShopClientWSService" targetNamespace="http://client.ishop.mw.ru/" xmlns:tns="http://client.ishop.mw.ru/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://client.ishop.mw.ru/" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://client.ishop.mw.ru/">
    <xs:element name="updateBill" type="tns:updateBill"/>
    <xs:element name="updateBillResponse" type="tns:updateBillResponse"/>
    <xs:complexType name="updateBill">
        <xs:sequence>
            <xs:element minOccurs="0" name="login" type="xs:string"/>
            <xs:element minOccurs="0" name="password" type="xs:string"/>
            <xs:element minOccurs="0" name="txn" type="xs:string"/>
            <xs:element name="status" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="updateBillResponse">
        <xs:sequence>
            <xs:element name="updateBillResult" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="updateBillExt" type="tns:updateBillExt"/>
    <xs:element name="updateBillExtResponse" type="tns:updateBillExtResponse"/>

    <xs:complexType name="Param">
        <xs:sequence>
            <xs:element name="name" nillable="false" type="xsd:string"/>
            <xs:element name="value" nillable="false" type="xsd:string"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="ArrayOfParams">
        <xs:sequence>
            <xs:element maxOccurs="unbounded" minOccurs="0" name="item" type="tns:Param"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="updateBillExt">
        <xs:sequence>
            <xs:element minOccurs="0" name="login" type="xs:string"/>
            <xs:element minOccurs="0" name="password" type="xs:string"/>
            <xs:element minOccurs="0" name="txn" type="xs:string"/>
            <xs:element name="status" type="xs:int"/>
        <xs:element name="params" nillable="false" type="tns:ArrayOfParams"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="updateBillExtResponse">
        <xs:sequence>
            <xs:element name="updateBillExtResult" type="xs:int"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
  </wsdl:types>
  <wsdl:message name="updateBillResponse">
    <wsdl:part name="parameters" element="tns:updateBillResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="updateBill">
    <wsdl:part name="parameters" element="tns:updateBill">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="updateBillExtResponse">
    <wsdl:part name="parameters" element="tns:updateBillExtResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="updateBillExt">
    <wsdl:part name="parameters" element="tns:updateBillExt">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="IShopClientWS">
    <wsdl:operation name="updateBill">
      <wsdl:input name="updateBill" message="tns:updateBill">
    </wsdl:input>
      <wsdl:output name="updateBillResponse" message="tns:updateBillResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="updateBillExt">
      <wsdl:input name="updateBillExt" message="tns:updateBillExt">
    </wsdl:input>
      <wsdl:output name="updateBillExtResponse" message="tns:updateBillExtResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="IShopClientWSBinding" type="tns:IShopClientWS">
    <soap12:binding style="document" transport="http://www.w3.org/2003/05/soap/bindings/HTTP/"/>
    <wsdl:operation name="updateBill">
      <soap12:operation soapAction="updateBill" style="document"></soap12:operation>
      <wsdl:input name="updateBill">
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="updateBillResponse">
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="updateBillExt">
      <soap12:operation soapAction="updateBillExt" style="document"/>
      <wsdl:input name="updateBillExt">
        <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="updateBillExtResponse">
        <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="IShopClientWSServiceService">
    <wsdl:port name="IShopClientWSPort" binding="tns:IShopClientWSBinding">
      <soap12:address location="https://mysite.url/path_to_serving_script"></soap12:address>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

由于 PHP-SOAP 源文件位于 http://lxr.sweon.net/php/http/source/ext/soap/php_sdl.c:

Due to PHP-SOAP source files at http://lxr.sweon.net/php/http/source/ext/soap/php_sdl.c:

if (ctx.sdl->bindings == NULL || ctx.sdl->bindings->nNumOfElements == 0) {
                 soap_error0(E_ERROR, "Parsing WSDL: Could not find any usable binding services in WSDL.");
}

那么,我的 WSDL 文件有什么问题?

So, what's wrong with my WSDL file?

非常感谢您的帮助!

推荐答案

乍一看,我会说 SOAP 1.2 不是 SOAP 1.1(PHP 的默认设置).对于 1.2 服务,使用:

At a glance, I would say SOAP 1.2 is not SOAP 1.1 (PHP's default). For 1.2 services, use:

$s = new SoapServer(DOCROOT.'wsdls/IShopClientWS.wsdl', 
        array('soap_version' => SOAP_1_2));

此外,传输应该是 "http://schemas.xmlsoap.org/soap/http" AFAIK,而不是 http://www.w3.org/2003/05/肥皂/绑定/HTTP/.

Also, transport should be "http://schemas.xmlsoap.org/soap/http" AFAIK, not http://www.w3.org/2003/05/soap/bindings/HTTP/.

<soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

老实说,我不完全知道为什么,只是它在我的 wsdl 中并且正常工作.如果有人自虐到可以深入研究规范,请随时链接到相关部分.

To be honest, I do not strictly know why, just that it is in my wsdl's and it just works. If anyone is masochistic enough to delve in the specs feel free to link to the relevant portion.

以下是 1.1 和 1.2 规范之间的一些差异:http://schemas.xmlsoap.org/wsdl/soap12/soap12WSDL.htm而且没有像这样的交通工具http://www.w3.org/2003/05/soap/bindings/HTTP/所以我认为这只是 QIWI 支付系统的错误.

Here is some differencies between 1.1 and 1.2 specs: http://schemas.xmlsoap.org/wsdl/soap12/soap12WSDL.htm And there is no transport like http://www.w3.org/2003/05/soap/bindings/HTTP/ So my thoughts that this is just QIWI payment system bug.

这篇关于在 WSDL 中找不到任何可用的绑定服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆