gpt4 book ai didi

asp.net-mvc-3 - MVC Paypal 助手错误 : PayPal. Platform.SDK.FATALException

转载 作者:太空宇宙 更新时间:2023-11-03 15:49:41 24 4
gpt4 key购买 nike

我正在使用 PayPal 助手 http://paypalhelper.codeplex.com并且出现错误 PayPal.Platform.SDK.FATALException

在那之后,我也查看了源代码,看看那里发生了什么,在我调试测试项目 public void TestImplicitSimplePay() 中的一个测试后,发现它抛出了一个错误在 SoapEncoder 方法中 Decode96 return (object)serializer.Deserialize(reader);

public static object Decode(string soapEnvelope, Type toType)
{
XmlSerializer serializer = null;

try
{
/// Initializing the XMLSerializer.
serializer = new XmlSerializer(toType);

/// Removing SOAP outer Envelope
soapEnvelope = soapEnvelope.Replace("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body>", string.Empty);
soapEnvelope = soapEnvelope.Replace("</soapenv:Body></soapenv:Envelope>", string.Empty);
soapEnvelope = soapEnvelope.Replace("xmlns:ns2=\"http://svcs.paypal.com/types/ap\"", string.Empty);
soapEnvelope = soapEnvelope.Replace("ns2:", string.Empty);
soapEnvelope = soapEnvelope.Replace("soapenv:", string.Empty);
soapEnvelope = soapEnvelope.Replace("ns3:", string.Empty);
soapEnvelope = soapEnvelope.Replace("xmlns:ns2=\"http://svcs.paypal.com/types/ap\"", string.Empty);

/// Deserializing and Returning the XML
using (MemoryStream reader = new MemoryStream(Encoding.UTF8.GetBytes(soapEnvelope)))
{
return (object)serializer.Deserialize(reader); //Error here
}
}
catch (FATALException)
{
throw;
}
catch (Exception ex)
{
throw new FATALException("Error occurred in SoapEncoder->Decode method", ex);
}
finally
{
serializer = null;
}
}

肥皂信封 xml:

<xml version='1.0' encoding='utf-8'?>
<Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
<Header/>
<Body>
<PayResponse >
<responseEnvelope>
<timestamp>2011-08-09T00:28:53.399-07:00</timestamp>
<ack>Success</ack>
<correlationId>621854fd57929</correlationId>
<build>2012864</build>
</responseEnvelope>
<payKey>AP-1SE162159L922805T</payKey>
<paymentExecStatus>COMPLETED</paymentExecStatus>
</PayResponse>

可能有人遇到过这个问题并知道我能做些什么来解决这个问题?

最佳答案

替换这一行:

soapEnvelope = soapEnvelope.Replace("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header /><soapenv:Body>", string.Empty);

与:

soapEnvelope = soapEnvelope.Replace("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Header/><soapenv:Body>", string.Empty);

Paypal 的响应似乎略有变化,<soapenv:Header />节点在自闭标签结束前不再有空格。

关于asp.net-mvc-3 - MVC Paypal 助手错误 : PayPal. Platform.SDK.FATALException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6992715/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com