使用Javascript发送SOAP请求

时间:2014-02-14 07:53:08

标签: javascript web-services soap

我想使用JavaScript将SOAP请求发送到Web服务。我是JavaScript的新手。任何帮助(JavaScript代码)将不胜感激。编辑:JavaScript不会在网站上运行,而是在Parse Cloud Code服务器上运行。

以下是SOAP XML的示例(此XML中的所有密钥,用户名,密码等均用于演示目的,不属于任何人或任何帐户):

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://soap.api.controller.web.payjar.com/" xmlns:ns2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
  <SOAP-ENV:Header>
   <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <wsse:UsernameToken wsu:Id="UsernameToken-9" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
     <wsse:Username>Staging Integration Store 1</wsse:Username>
     <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">78cXrW1W</wsse:Password>
    </wsse:UsernameToken>
   </wsse:Security>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
   <ns1:doTransaction>
    <Api>ONE_ZERO</Api>
    <Safekey>{45D5C765-16D2-45A4-8C41-8D6F84042F8C}</Safekey>
    <TransactionType>FINALIZE</TransactionType>
    <AdditionalInformation>
     <merchantReference>mercRef_1350047403</merchantReference>
     <payUReference>11999149347</payUReference>
    </AdditionalInformation>
    <Customer>
     <email>
</email>
    <firstName>John</firstName>
    <lastName>Doe</lastName>
    <merchantUserId>1350047403</merchantUserId>
    <mobile>
</mobile>    
   </Customer>
   <Basket>
    <amountInCents>6235</amountInCents>
    <currencyCode>ZAR</currencyCode>
   </Basket>
   <Creditcard>
    <amountInCents>6235</amountInCents>
   </Creditcard>
  </ns1:doTransaction>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

0 个答案:

没有答案