无法对此特定服务,“未定义”目标名称空间进行SOAP调用

时间:2018-10-15 09:43:07

标签: javascript node.js soap wsdl undefined

我正在使用Node.js模块“ soap”来调用SOAP服务。它可以与某些示例服务配合使用,例如:http://www.dneonline.com/calculator.asmx?wsdl

但是,我在对客户服务进行SOAP调用时遇到此错误,但我不明白为什么,也许是不兼容问题?,另一个人已经问过类似的问题,但没有答案(Target namespace "undefined" already in use by another Schema) :

Target-Namespace "undefined" already in use by another Schema!
/temp/soap/node_modules/soap/lib/wsdl.js:499
    this.element = schema.elements[nsName.name];
                         ^

TypeError: Cannot read property 'elements' of undefined
    at subElement.MessageElement.postProcess (/temp/soap/node_modules/soap/lib/wsdl.js:499:26)
    at subElement.OperationElement.postProcess (/temp/soap/node_modules/soap/lib/wsdl.js:669:13)
    at subElement.PortTypeElement.postProcess (/temp/soap/node_modules/soap/lib/wsdl.js:689:11)
    at subElement.BindingElement.postProcess (/temp/soap/node_modules/soap/lib/wsdl.js:703:14)
    at subElement.ServiceElement.postProcess (/temp/soap/node_modules/soap/lib/wsdl.js:739:17)
    at /temp/soap/node_modules/soap/lib/wsdl.js:1063:26
    at /temp/soap/node_modules/soap/lib/wsdl.js:1218:7
    at WSDL._processNextInclude (/temp/soap/node_modules/soap/lib/wsdl.js:1189:12)
    at WSDL.callback (/temp/soap/node_modules/soap/lib/wsdl.js:1217:10)
    at /temp/soap/node_modules/soap/lib/wsdl.js:1098:12
    at WSDL._processNextInclude (/temp/soap/node_modules/soap/lib/wsdl.js:1189:12)
    at WSDL.processIncludes (/temp/soap/node_modules/soap/lib/wsdl.js:1232:8)
    at /temp/soap/node_modules/soap/lib/wsdl.js:1053:10
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

SOAP端点(只能通过我的IP访问)位于:http://103.226.108.150:7003/MobileOTM/Business/TruckingEvent?wsdl

这是SOAP端点:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="OTMMobileProcess" targetNamespace="http://xmlns.oracle.com/SOAServerDev/OTMMobileApp/OTMMobileProcess" xmlns:client="http://xmlns.oracle.com/SOAServerDev/OTMMobileApp/OTMMobileProcess" xmlns:ns1="http://xmlns.oracle.com/OTMMobileApp/TruckingEvent" xmlns:ns2="http://xmlns.oracle.com/OTMMobileAppProcess" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:documentation>http://snp-lph-otmdev-soa.localdomain:8001/soa-infra/services/SNP_DEV/OTMMobileApp!1.0/OTMMobileProcess.wsdl
    </wsdl:documentation>
  <plnk:partnerLinkType name="OTMMobileProcess">
    <plnk:role name="OTMMobileProcessProvider" portType="client:OTMMobileProcess"/>
  </plnk:partnerLinkType>
  <wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://xmlns.oracle.com/OTMMobileApp/TruckingEvent" schemaLocation="http://103.226.108.150:7003/MobileOTM/Business/TruckingEvent?SCHEMA%2FMobileOTM%2FResource%2Fxsd%2FTruckingEvent"/>
    </schema>
    <schema xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://xmlns.oracle.com/OTMMobileAppProcess" schemaLocation="http://103.226.108.150:7003/MobileOTM/Business/TruckingEvent?SCHEMA%2FMobileOTM%2FResource%2Fxsd%2FOTMMobileAppProcess"/>
    </schema>
  </wsdl:types>
  <wsdl:message name="OTMMobileProcessRequestMessage">
    <wsdl:part element="ns1:TruckingEvent" name="payload"/>
  </wsdl:message>
  <wsdl:message name="OTMMobileProcessResponseMessage">
    <wsdl:part element="ns2:ProcessResponse" name="payload"/>
  </wsdl:message>
  <wsdl:portType name="OTMMobileProcess">
    <wsdl:operation name="TruckingEvent">
      <wsdl:input message="client:OTMMobileProcessRequestMessage"/>
      <wsdl:output message="client:OTMMobileProcessResponseMessage"/>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="OTMMobileProcessBinding" type="client:OTMMobileProcess">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="TruckingEvent">
      <soap:operation soapAction="TruckingEvent" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="otmmobileprocess_client_ep">
    <wsdl:port binding="client:OTMMobileProcessBinding" name="OTMMobileProcess_pt">
      <soap:address location="http://172.16.39.34:7003/MobileOTM/Business/TruckingEvent"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

1 个答案:

答案 0 :(得分:1)

手动解决方案:

由服务URL描述的XML在某些“模式”标记中缺少“ targetNamespace”属性。

从URL下载XML文件,然后将“ targetNamespace”手动添加到所有“ schema”标记中。并使客户端从路径到本地文件而不是http URL。

相关答案:SOAP node returns error Target-Namespace "undefined" already in use by another Schema