2017-09-07 3 views
0

저는 nodejs를 처음 사용하고 비누 웹 서비스 호출을 만들기 위해 비누 기능을 사용하려고합니다. 나는 그물에 각종보기를 보았지만 나는 가지고있는 자료에 그것들을 어떻게 사용 하는지를 알 수 없었다.노드 JS를 사용하여 비누 웹 서비스 호출

자바 응용 프로그램에서 비누 요청을 받았고 SoapUI 응용 프로그램에서이 비동기 응용 프로그램을 사용했습니다. 방금 wsdl 링크와 XML을 사용했습니다. nodej와 함께 사용하는 방법에 대한 예제가 필요합니다. 미리 감사드립니다.

WSDL - - https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.141.wsdl

XML -

<?xml version="1.0" encoding="UTF-8"?> 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <soapenv:Header> 
     <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"> 
      <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-*****"> 
       <wsse:Username>*****</wsse:Username> 
       <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">*****</wsse:Password> 
      </wsse:UsernameToken> 
     </wsse:Security> 
    </soapenv:Header> 
    <soapenv:Body> 
     <requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.84"> 
      <merchantID>*****</merchantID> 
      <merchantReferenceCode>*****</merchantReferenceCode> 
      <clientLibrary>Java Axis WSS4J</clientLibrary> 
      <clientLibraryVersion>1.4/1.5.1</clientLibraryVersion> 
      <clientEnvironment>Windows NT (unknown)/6.2/Sun Microsystems Inc./1.6.0_20</clientEnvironment> 
      <billTo> 
       <street1>2nd Street</street1> 
       <city>test</city> 
       <state>AL</state> 
       <postalCode>12345</postalCode> 
       <country>US</country> 
      </billTo> 
      <item id="0"> 
       <unitPrice>2650.0</unitPrice> 
       <quantity>1</quantity> 
       <productCode>*****</productCode> 
       <productName>*****</productName> 
       <productSKU>*****</productSKU> 
      </item> 
      <taxService run="true"> 
       <sellerRegistration /> 
      </taxService> 
     </requestMessage> 
    </soapenv:Body> 
</soapenv:Envelope> 

답변

0

그냥 사용 예를 다음과 같이 request를 사용할 수있는 올바른 SOAPAction (에서

다음은 내가 SoapUI 응용 프로그램에 사용되는 세부 사항입니다 wsdl, runTransaction)

보통 더미 샘플 요청을 생성하고 필요한 경우 올바른 SOAPAction 및 기타 헤더를 ​​얻으려면 Boomerang을 사용합니다.

const request = require('request') 

const xml = '<yourxml>' 
const opts = { 
    body: xml, 
    headers: { 
     'Content-Type': 'text/xml; charset=utf-8', 
     SOAPAction: 'runTransaction' 
    } 
} 

const url = 'https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor/CyberSourceTransaction_1.141.wsdl' 

const body = request.post(url, opts, (err, response) => { 
    console.log('response', response.body) 
}) 
+0

감사합니다. 그 덕분에 좋았습니다. 만약 내가 VPN을 테스트하는 경우에 프록시 정보를 전달할 수있는 방법이 있는지 궁금 해서요? –

+0

@PragyandiptaTripathy'request'에 의해 환경 변수를 사용할 수 있습니다 :'HTTP_PROXY','HTTPS_PROXY','NO_PROXY' 또는 옵션에'proxy'를 추가하십시오 –