node.js - SOAP API request works with Boomerang, but not with node-soap -


i trying access soap api able using boomerang easily. here format of request:

<x:envelope xmlns:x="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v="http://ws.aramex.net/shippingapi/v1/" xmlns:arr="http://schemas.microsoft.com/2003/10/serialization/arrays">     <x:header/>     <x:body>         <v:shipmenttrackingrequest>             <v:clientinfo>                 <v:username>myusernamehere</v:username>                 <v:password>mypasswordhere</v:password>                 <v:version>v1.0</v:version>                 <v:accountnumber>myaccnumberhere</v:accountnumber>                 <v:accountpin>mypinhere</v:accountpin>                 <v:accountentity>xyz</v:accountentity>                 <v:accountcountrycode>xyz</v:accountcountrycode>             </v:clientinfo>             <v:transaction>                 <v:reference1>001</v:reference1>                 <v:reference2>?</v:reference2>                 <v:reference3>?</v:reference3>                 <v:reference4>?</v:reference4>                 <v:reference5>?</v:reference5>             </v:transaction>             <v:shipments>                 <arr:string>41496248135</arr:string>             </v:shipments>             <v:getlasttrackingupdateonly>true</v:getlasttrackingupdateonly>         </v:shipmenttrackingrequest>     </x:body> </x:envelope> 

the request gets me required information. want make same request using node-soap. here code:

var soap = require('soap'); var express = require('express'); var app = express();  var url = 'aramex/aramex.wsdl'; var args =  [{     clientinfo:      {         username: 'myusernamehere',         password: 'mypasswordhere',         version: 'v1.0',         accountnumber: 'myaccnumberhere',         accountpin: 'mypinhere',         accountentity: 'xyz',         accountcountrycode: 'xyz'             },     transaction:        { reference1: '001' },      shipments: ['41496248135'] }];  app.get('/', function(req, res){  soap.createclient(url, function(err, client) {         client.trackshipments(args, function(err, result, body) {           res.send(result);         });       }); })  app.listen(process.env.port, process.env.ip, function(){     console.log("server up"); }) 

all huge error in result. body of result object follows:

<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:body><s:fault><faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">a:internalservicefault</faultcode><faultstring xml:lang="en-us">error in deserializing body of request message operation 'trackshipments'. operationformatter encountered invalid message body. expected find node type 'element' name 'shipmenttrackingrequest' , namespace 'http://ws.aramex.net/shippingapi/v1/'. found node type 'element' name 'shipmenttrackingrequest' , namespace ''</faultstring><detail><exceptiondetail xmlns="http://schemas.datacontract.org/2004/07/system.servicemodel" xmlns:i="http://www.w3.org/2001/xmlschema-instance"><helplink i:nil="true"/><innerexception><helplink i:nil="true"/><innerexception i:nil="true"/><message>operationformatter encountered invalid message body. expected find node type 'element' name 'shipmenttrackingrequest' , namespace 'http://ws.aramex.net/shippingapi/v1/'. found node type 'element' name 'shipmenttrackingrequest' , namespace ''</message><stacktrace> @ system.servicemodel.dispatcher.datacontractserializeroperationformatter.deserializebody(xmldictionaryreader reader, messageversion version, string action, messagedescription messagedescription, object[] parameters, boolean isrequest)&#xd; @ system.servicemodel.dispatcher.operationformatter.deserializebodycontents(message message, object[] parameters, boolean isrequest)&#xd; @ system.servicemodel.dispatcher.operationformatter.deserializerequest(message message, object[] parameters)</stacktrace><type>system.runtime.serialization.serializationexception</type></innerexception><message>error in deserializing body of request message operation 'trackshipments'. operationformatter encountered invalid message body. expected find node type 'element' name 'shipmenttrackingrequest' , namespace 'http://ws.aramex.net/shippingapi/v1/'. found node type 'element' name 'shipmenttrackingrequest' , namespace ''</message><stacktrace> @ system.servicemodel.dispatcher.operationformatter.deserializerequest(message message, object[] parameters)&#xd; @ system.servicemodel.dispatcher.dispatchoperationruntime.deserializeinputs(messagerpc&amp; rpc)&#xd; @ system.servicemodel.dispatcher.dispatchoperationruntime.invokebegin(messagerpc&amp; rpc)&#xd; @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage5(messagerpc&amp; rpc)&#xd; @ system.servicemodel.dispatcher.immutabledispatchruntime.processmessage11(messagerpc&amp; rpc)&#xd; @ system.servicemodel.dispatcher.messagerpc.process(boolean isoperationcontextset)</stacktrace><type>system.servicemodel.communicationexception</type></exceptiondetail></detail></s:fault></s:body></s:envelope> 

how can fix problem?

if still relevant, encountered same. grab latest wdsl file aramex's website.

request args should follows:

let args =  [{     clientinfo: {         username: 'myusernamehere',         password: 'mypasswordhere',         version: 'v1.0',         accountnumber: 'myaccnumberhere',         accountpin: 'mypinhere',         accountentity: 'xyz',         accountcountrycode: 'xyz'             },     "transaction": {         "reference1": "001",         "reference2": "002",         "reference3": "003",         "reference4": "004",         "reference5": "005"     },     "shipments": {             "string": awb     },     "getlasttrackingupdateonly": false] }]; 

the error you're getting because wsdl parser unable match our args list defined inside wsdl file.


Comments