2
我使用贝宝助手http://paypalhelper.codeplex.com,并得到一个错误PayPal.Platform.SDK.FATALException
MVC贝宝助手错误:PayPal.Platform.SDK.FATALException
之后,我把源代码也有看看正在发生的事情有后,我一个调试在测试项目public void TestImplicitSimplePay()
的测试,并发现它是在类SoapEncoder
的方法Decode
排队抛出一个错误96 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;
}
}
的SoapEnvelope 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>
可能有人遇到这种情况,并知道我能做些什么来解决这个问题?