传递xml进行结帐流程

时间:2011-04-06 14:08:40

标签: php asp.net xml api

我对如何使用php创建并将此调用发送到url感到有点困惑....这里是我需要创建的xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mer="http://www.site.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <mer:InitializePayment>
         <mer:request>
            <mer:MerchantID>67779987</mer:MerchantID>
            <mer:Password>XXXXXXXXXXXXXXXX</mer:Password>
            <mer:Invoice>12345</mer:Invoice>
            <mer:TotalAmount>1.03</mer:TotalAmount>
            <mer:TaxAmount>0.50</mer:TaxAmount>
            <mer:AVSAddress>4 Corpor</mer:AVSAddress>
            <mer:AVSZip>30329</mer:AVSZip>
            <mer:TranType>PreAuth</mer:TranType>
            <mer:CardHolderName>John Jamed</mer:CardHolderName>
            <mer:Frequency>OneTime</mer:Frequency>
            <mer:CustomerCode>CustCode123</mer:CustomerCode>
            <mer:Memo>HostedCheckoutMemo</mer:Memo>
            <mer:ProcessCompleteUrl>https://somesite/ordercomplete.aspx</mer:ProcessCompleteUrl>
            <mer:ReturnUrl>https://somesite/ShoppingCart.aspx</mer:ReturnUrl>
            <mer:DisplayStyle>Prent</mer:DisplayStyle>
            <mer:BackgroundColor>#FFFFFF</mer:BackgroundColor>
            <mer:FontColor>#000000</mer:FontColor>
            <mer:FontFamily>FontFamily1</mer:FontFamily>
            <mer:FontSize>Medium</mer:FontSize>
            <mer:LogoUrl>https://somesite/images/DurangoPet2.PNG</mer:LogoUrl>
            <mer:PageTitle>Test SoapUI</mer:PageTitle>
            <mer:SecurityLogo>On</mer:SecurityLogo>
         </mer:request>
      </mer:InitializePayment>
   </soapenv:Body>
</soapenv:Envelope>

这是我需要发送到

的示例网址
  https://someplace.net/tws/TransactionService.asmx?wsdl  

也许我感到困惑,因为我认为拨打api会是这样的

  https://someplace.net/tws/TransactionService.asmx?wsdl?MerchantID=67779987&XXXXXXXXXXXXXXXX

也许有人可以为我解决这个问题

    array(6) { 
[0]=> string(74) "InitializePaymentResponse InitializePayment(InitializePayment $parameters)" 
[1]=> string(62) "VerifyPaymentResponse VerifyPayment(VerifyPayment $parameters)" 
[2]=> string(77) "AcknowledgePaymentResponse AcknowledgePayment(AcknowledgePayment $parameters)"  
[3]=> string(74) "InitializePaymentResponse InitializePayment(InitializePayment $parameters)" 
[4]=> string(62) "VerifyPaymentResponse VerifyPayment(VerifyPayment $parameters)"
[5]=> string(77) "AcknowledgePaymentResponse AcknowledgePayment(AcknowledgePayment $parameters)" } 

1 个答案:

答案 0 :(得分:1)

您需要使用SOAP(在此实例中)http://www.php.net/manual/en/soapclient.dorequest.php来使用wsdl服务(http://en.wikipedia.org/wiki/Web_Services_Description_Language

至于第二部分

通常,您的SOAP标头需要进行身份验证 如你所示的一般XML(请求)

 <mer:MerchantID>67779987</mer:MerchantID>
 <mer:Password>XXXXXXXXXXXXXXXX</mer:Password>