Dan D.
Dan D.

Reputation: 8557

Can't make SOAP call to this certain service, "undefined" target namespace

I'm using Node.js module 'soap' to make calls to SOAP services. It works fine with some sample services, for example: http://www.dneonline.com/calculator.asmx?wsdl

However, I'm facing this error when making SOAP call to my client service, I don't get it why, maybe incompatibilty issue?, another guy has already asked similar question but no answer (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)

The SOAP endpoint (only accessibly by my IP) is at: http://103.226.108.150:7003/MobileOTM/Business/TruckingEvent?wsdl

This is the SOAP endpoint:

<?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>

Upvotes: 0

Views: 1534

Answers (1)

Dan D.
Dan D.

Reputation: 8557

Manual solution:

The XML described by the service URL is missing 'targetNamespace' attribute in some 'schema' tags.

Download the XML file from the URL and add 'targetNamespace' manually to all 'schema' tags. And make client from path to local file instead of http URL.

Related answer: SOAP node returns error Target-Namespace "undefined" already in use by another Schema

Upvotes: 1

Related Questions