xml - How to pass Authentication Header to node-soap -
i trying use wsdl service client cannot find how set headers.
the reason need because wsdl trying use requires username , password via headers. wsdl
> post /service.asmx http/1.1 > host: 210.12.155.16 > content-type: text/xml; charset=utf-8 > content-length: length > soapaction: "http://yyyy.com:1002/apability" > > <?xml version="1.0" encoding="utf-8"?> > <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" > xmlns:xsd="http://www.w3.org/2001/xmlschema" > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> > <soap:header> > <authheader xmlns="http://yyyy.com:1002/"> > <username>string</username> > <password>string</password> > </authheader> > </soap:header> > <soap:body> > <sale xmlns="http://yyyy.com:1002/"> > <bid>string</bid> > <amount>string</amount> > </sale> > </soap:body> > </soap:envelope>
and code :
var args={bid:"123",amount : "10000"}; var authheader = { "username" : user, "password" : pass }; soap.createclient(url,function(error,client){ client.addsoapheader(authheader); client.sale(args,function(error,result){ console.log(error); });
i have send authentication in header doesn't work
thing soapheader's var wrong . solve authentication problem ? lot
you can less try sending header in way
var autentication ='<authheader xmlns="http://yyyy.com:1002/"><username>user</username><password>pass</password></authheader>'
add header
client.addsoapheader(autentication)
good luck
Comments
Post a Comment