@neuromax

Как настроить node.js soap?

Использую данный пакет 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) {
                //-------
            });
        });

Данный код формирует такой xml запрос
<?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>


Как сделать чтобы формировался такой запрос ?:

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


Заранее спасибо!
  • Вопрос задан
  • 46 просмотров
Пригласить эксперта
Ответы на вопрос 1
megafax
@megafax
web-программист
Так сработает?
client.['tem:MyFunction']({'tem:user': {'tec:Name': 'name', 'tec:Password': 'password'} }, (err, result) => { /*... */ });
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через TM ID
Похожие вопросы