ASP.NET SOAP请求

时间:2014-05-20 09:02:16

标签: soap

我已成功向支付网关发送肥皂请求,如下所示。但无法以有意义的方式从网关获取响应(只使用下面显示的最后一行代码的值字符串)。什么是最好的方法?感谢。

    Dim manualWebClient As New System.Net.WebClient()

    manualWebClient.Headers.Add("Content-Type", "text/xml;  charset=utf-8")

    Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes( _
        "<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & System.Environment.NewLine & _
        "   <soap:Body>" & System.Environment.NewLine & _
        "       <CrossReferenceTransaction xmlns=""https://www.blahblah.net/"">" & System.Environment.NewLine & _
        "           <PaymentMessage>" & System.Environment.NewLine & _
        "               <MerchantAuthentication MerchantID=""blahblah"" Password=""blahblah"" />" & System.Environment.NewLine & _
        "               <TransactionDetails Amount=""5000"" CurrencyCode=""826"">" & System.Environment.NewLine & _
        "                   <MessageDetails TransactionType=""COLLECTION"" NewTransaction=""TRUE"" CrossReference=""140519132324310202778936"" />" & System.Environment.NewLine & _
        "                   <OrderID>order12345</OrderID>" & System.Environment.NewLine & _
        "                   <OrderDescription>Monthly Subscription</OrderDescription>" & System.Environment.NewLine & _
        "                   <TransactionControl>" & System.Environment.NewLine & _
        "                       <EchoCardType>TRUE</EchoCardType>" & System.Environment.NewLine & _
        "                       <EchoAVSCheckResult>TRUE</EchoAVSCheckResult>" & System.Environment.NewLine & _
        "                       <EchoCV2CheckResult>TRUE</EchoCV2CheckResult>" & System.Environment.NewLine & _
        "                       <EchoAmountReceived>TRUE</EchoAmountReceived>" & System.Environment.NewLine & _
        "                       <DuplicateDelay>60</DuplicateDelay>" & System.Environment.NewLine & _
        "                   </TransactionControl>" & System.Environment.NewLine & _
        "               </TransactionDetails>" & System.Environment.NewLine & _
        "           </PaymentMessage>" & System.Environment.NewLine & _
        "       </CrossReferenceTransaction>" & System.Environment.NewLine & _
        "   </soap:Body>" & System.Environment.NewLine & _
        "</soap:Envelope>")

    Dim bytRetData As Byte() = manualWebClient.UploadData("https://blahblahblah.com:4430", "POST", bytArguments)

    Response.Write(System.Text.Encoding.ASCII.GetString(bytRetData))

0 个答案:

没有答案