N
N
neuromax2018-02-28 15:50:29
SOAP
neuromax, 2018-02-28 15:50:29

How to setup node.js soap?

I use this package https://www.npmjs.com/package/soap .

let args = {
            user: { Name: 'name', Password: 'password' }
        };

soap.createClient(url, function(err, client) {
            client.MyFunction(args, function(err, result) {
                //-------
            });
        });

This code generates such an xml request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:q1="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q2="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q4="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q18="http://schemas.datacontract.org/2004/07/TechInspection.Domain.Enums" xmlns:q5="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q6="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q7="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q8="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q9="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q10="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q11="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q12="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q13="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q14="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q15="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q16="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q17="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts" xmlns:q3="http://schemas.datacontract.org/2004/07/TechInspection.Domain.Enums" xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/">
    <soap:Body>
        <MyFunction xmlns="http://tempuri.org/">
            <user>
                <q12:Name xmlns:q12="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts">name</q12:Name>
                <q12:Password xmlns:q12="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts">password</q12:Password>
            </user>
        </MyFunction >
    </soap:Body>
</soap:Envelope>

How can I make a query like this?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:tec="http://schemas.datacontract.org/2004/07/TechInspection.Domain.DataContracts">
   <soapenv:Header/>
   <soapenv:Body>
      <tem: MyFunction >
         <tem:user>
            <tec:Name>name</tec:Name>
            <tec:Password>password</tec:Password>
         </tem:user>
      </tem: MyFunction >
   </soapenv:Body>
</soapenv:Envelope>

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Skibin, 2018-02-28
@megafax

Will it work?

client.['tem:MyFunction']({'tem:user': {'tec:Name': 'name', 'tec:Password': 'password'} }, (err, result) => { /*... */ });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question