2017-11-28 2 views
2

비누 요청 전송과 관련하여 매우 귀찮은 문제가 있습니다.node-soap을 사용하여 올바른 비누 요청 보내기

SOAP-UI와 같은 도구를 사용하면 XML로 적절한 비누 요청을 쉽게 작성할 수 있습니다. 하지만 노드 비누를 사용하여 비누 요청을 보내려고하면 올바른 XML 문자열을 얻을 수 없습니다. ...

노드 비누 플러그인이 추가되는 이유는 모르겠지만 메소드 이름 (GetArrBoardWithDetail)에 "SoapIn"문자열. 다음 코드를 참조하십시오

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://thalesgroup.com/RTTI/2017-02-02/ldb/" xmlns:tok="http://thalesgroup.com/RTTI/2013-11-28/Token/types" xmlns:ct2007="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes" 
 
    xmlns:ct2015="http://thalesgroup.com/RTTI/2015-11-27/ldb/commontypes" xmlns:ldbt2017="http://thalesgroup.com/RTTI/2017-02-02/ldb/types"> 
 
    <soapenv:Header> 
 
    <tok:AccessToken> 
 
     <tok:TokenValue>asdf</tok:TokenValue> 
 
    </tok:AccessToken> 
 
    </soapenv:Header> 
 
    <soapenv:Body> 
 
    <tns:**GetArrBoardWithDetailsSoapIn**> 
 
     <tns:numRows>50</tns:numRows> 
 
     <tns:crs>ACY</tns:crs> 
 
     <tns:filterCrs></tns:filterCrs> 
 
     <tns:filterType>to</tns:filterType> 
 
     <tns:timeOffset>0</tns:timeOffset> 
 
     <tns:timeWindow>120</tns:timeWindow> 
 
    </tns:**GetArrBoardWithDetailsSoapIn**> 
 
    </soapenv:Body> 
 
</soapenv:Envelope>

외부 도구 SoapUI는 "SoapIn"와 같은 문자열을 추가하지 않습니다. 비누 UI는 문자열 "Request"를 추가합니다 (다음 스 니펫 참조).

<?xml version="1.0" encoding="utf-8"?> 
 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://thalesgroup.com/RTTI/2017-02-02/ldb/" xmlns:tok="http://thalesgroup.com/RTTI/2013-11-28/Token/types" xmlns:ct2007="http://thalesgroup.com/RTTI/2007-10-10/ldb/commontypes" 
 
    xmlns:ct2015="http://thalesgroup.com/RTTI/2015-11-27/ldb/commontypes" xmlns:ldbt2017="http://thalesgroup.com/RTTI/2017-02-02/ldb/types"> 
 
    <soapenv:Header> 
 
    <tok:AccessToken> 
 
     <tok:TokenValue>asdf</tok:TokenValue> 
 
    </tok:AccessToken> 
 
    </soapenv:Header> 
 
    <soapenv:Body> 
 
    <tns:**GetArrBoardWithDetailsRequest**> 
 
     <tns:numRows>50</tns:numRows> 
 
     <tns:crs>ACY</tns:crs> 
 
     <tns:filterCrs></tns:filterCrs> 
 
     <tns:filterType>to</tns:filterType> 
 
     <tns:timeOffset>0</tns:timeOffset> 
 
     <tns:timeWindow>120</tns:timeWindow> 
 
    </tns:**GetArrBoardWithDetailsRequest**> 
 
    </soapenv:Body> 
 
</soapenv:Envelope>

비누 UI에 의해 생성 된 요청

는 제대로 작동합니다. SOAP-UI 요청에 따라 XML 문자열의이 부분을 조정하는 방법을 아는 사람이 있습니까?

소스 코드 :

soap.WSDL.prototype.ignoredNamespaces = ['targetNamespace', 'typedNamespace']; 
 

 
// several options to modify the xml code of the soap request 
 
const wsdlOptions = { 
 
    envelopeKey: 'soapenv', 
 
    'overrideRootElement': { 
 
    'namespace': 'tns', 
 
    } 
 
}; 
 

 
// // creates the soapClient 
 
soap.createClient(wsdlUrl, wsdlOptions, function(err, client) { 
 

 
    // adds the needed SoapHeader to the requests 
 
    client.addSoapHeader(soapHeaderXML); 
 

 
    // specific soap-request 
 
    client.GetArrBoardWithDetails(soapParams, function(result, err) { 
 
    var lRequest = client.lastRequest; 
 
    var prettyLRequest = prettyData.xml(lRequest); 
 
    console.log(prettyLRequest); 
 
    console.log(result); 
 
    }) 
 
})

친절한 감사

답변

0

당신이 보내집니다 비누 바디를 대체 할 node soap 문서에서 _xml를 사용할 수 있습니다.

+0

네, 문제를 해결 한 방식입니다. – SamSampleman