美文网首页
第四十八章 解决 IRIS 中的 SOAP 问题 - 使用 WS

第四十八章 解决 IRIS 中的 SOAP 问题 - 使用 WS

作者: Cache技术分享 | 来源:发表于2024-07-04 08:08 被阅读0次

    第四十八章 解决 IRIS 中的 SOAP 问题 - 使用 WSDL 的问题

    由于以下几个原因,可能会在 SOAP 向导中(或使用相应的 %SOAP.WSDL.Reader 类时)看到错误:

    • 提供的 WSDL URL 可能需要使用 SSL 证书进行身份验证,而未指定 SSL 配置或指定了错误的 SSL 配置。如果出现这种情况,则会显示一条错误消息,例如:
    ERROR #6301: SAX XML Parser Error: invalid document structure 
    while processing Anonymous Stream at line 1 offset 1
    

    要纠正此错误,可以指定适当的 SSL 配置。

    • 提供的 WSDL URL 需要使用用户名和密码进行身份验证。如果是这样,则会显示一条错误消息,例如:
    ERROR #6301: SAX XML Parser Error: Expected entity name for reference 
    while processing Anonymous Stream at line 10 offset 27 
    

    注意:虽然线和偏移值可能会有所不同,但它们将与前一种情况下的不同。

    要纠正此错误,可以按照使用 SOAP 向导和使用受密码保护的 WSDL URL 中所述指定用户名和密码。

    • WSDL 可能包含对外部定义实体的引用,而向导在 10 秒超时期限之前无法解析这些实体。如果是这样,则会显示一条错误消息,例如:
    ERROR #6416: Element 'wsdl:definitions' - unrecognized wsdl element 'porttype'
    

    要纠正此错误,可以检查 WSDL 中的 <import><include> 指令,例如:

    <import namespace="https://example.com/stockquote/definitions"
               location="https://example.com/stockquote/stockquote.wsdl"/>
    

    如果发现此类指令,请采取以下步骤:

    1. 将主要 WSDL 下载到文件。
    2. 将引用的 WSDL 下载到文件。
    3. 编辑主 WSDL 来引用所引用 WSDL 的新位置。

    类似地,可以检查 WSDL 是否使用相对 URL 引用其他文档,例如:

    xmlns:acme="urn:acme.com.:acme:service:ServiceEndpointInterface" 
    

    如果将 WSDL 下载到文件中,则无法使用相对引用。相反,还必须下载引用的文档并编辑 WSDL 以指向其新位置。

    • WSDL 包含多个部分的 <message> 元素,并使用文档样式绑定。如果是这样,则会出现错误消息,例如:
    ERROR #6425: Element 'wsdl:binding:operation:msg:input' - message 'AddSoapOut' 
    Message Style must be used for document style message with 2 or more parts.
    
    

    要纠正此错误,可以在使用向导时选择“使用未包装的消息格式作为文档样式 Web 方法”选项。

    • WSDL 无效。如果是,则会显示一条错误消息,例如:
    ERROR #6419: Element 'wsdl:binding:operation' - inconsistent
    soap:namespace for operation getWidgetInfo
    

    错误消息指明了 WSDL 的问题。在此示例中,以下 WSDL 摘录中的 <operation> 元素产生了错误:

    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="https://acme.acmecorp.biz:9999/widget/services" 
                      xmlns="https://schemas.xmlsoap.org/wsdl/" 
                      xmlns:wsdl="https://schemas.xmlsoap.org/wsdl/" =
                     [parts omitted]>
      <wsdl:message name="getWidgetInfoRequest">
      </wsdl:message>
      <wsdl:message name="getWidgetInfoResponse">
        <wsdl:part name="getWidgetInfoReturn" type="xsd:string"/>
      </wsdl:message>
      <wsdl:portType name="Version">
        <wsdl:operation name="getWidgetInfo">
          <wsdl:input message="impl:getWidgetInfoRequest" name="getWidgetInfoRequest"/>
          <wsdl:output message="impl:getWidgetInfoResponse" name="getWidgetInfoResponse"/>
        </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="VersionSoapBinding" type="impl:Version">
        <wsdlsoap:binding style="rpc" transport="https://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getWidgetInfo">
          <wsdlsoap:operation soapAction=""/>
          <wsdl:input name="getWidgetInfoRequest">
            <wsdlsoap:body encodingStyle="https://schemas.xmlsoap.org/soap/encoding/" 
                           namespace="https://acmesubsidiary.com" 
                           use="encoded"/>
          </wsdl:input>
          <wsdl:output name="getWidgetInfoResponse">
            <wsdlsoap:body encodingStyle="https://schemas.xmlsoap.org/soap/encoding/"                                       
                           namespace="https://acme.acmecorp.biz:9999/widget/services" 
                           use="encoded"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      [parts omitted]
    

    在这种情况下,问题在于 <operation><input> 部分指出请求消息(getVersionRequest)位于命名空间“https://acmesubsidiary.com”中,但 WSDL 的前面部分显示该消息是 Web 服务的目标命名空间:“https://acme.acmecorp.biz:9999/widget/services”。

    请注意,无效的 WSDL 文档可能是有效的 XML 文档,因此使用纯 XML 工具来验证 WSDL 并不是充分的测试。有一些第三方 WSDL 验证工具可用,也可以使用 SOAP 向导返回的信息直接检查 WSDL

    • WSDL 包含 IRIS 不支持的功能。

    相关文章

      网友评论

          本文标题:第四十八章 解决 IRIS 中的 SOAP 问题 - 使用 WS

          本文链接:https://www.haomeiwen.com/subject/bayicjtx.html