如何检查来自 Web Reference 的传入 XML?
我们正在调用 Paypal Soap API 并遇到
{"The specified type was not recognized: name='OptionDetailsType', namespace='urn:ebay:apis:eBLBaseComponents', at <OptionDetails xmlns='urn:ebay:api:PayPalAPI'>."}
“Which is true”,因为 OptionDetailsType
不在 urn:ebay:apis:eBLBaseComponents
中,而是在 <代码>urn:ebay:api:PayPalAPI。我怀疑这是在从 Paypal 传入的 XML 中指定的,但我不确定如何检查传入的 XML。代码在 Reference.cs 中的 Invoke 处终止
[System.Web.Services.Protocols.SoapHeaderAttribute("RequesterCredentials", Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("BMGetButtonDetailsResponse", Namespace="urn:ebay:api:PayPalAPI")]
public BMGetButtonDetailsResponseType BMGetButtonDetails([System.Xml.Serialization.XmlElementAttribute(Namespace="urn:ebay:api:PayPalAPI")] BMGetButtonDetailsReq BMGetButtonDetailsReq) {
object[] results = this.Invoke("BMGetButtonDetails", new object[] {
BMGetButtonDetailsReq});
return ((BMGetButtonDetailsResponseType)(results[0]));
}
一般而言,有什么方法可以检查 Web Reference 中传入的 XML 吗? (VS2010)
We are calling the Paypal Soap API and running into
{"The specified type was not recognized: name='OptionDetailsType', namespace='urn:ebay:apis:eBLBaseComponents', at <OptionDetails xmlns='urn:ebay:api:PayPalAPI'>."}
Which is true, because OptionDetailsType
is not in urn:ebay:apis:eBLBaseComponents
but in urn:ebay:api:PayPalAPI
. I suspect that this is specified in the incoming XML from Paypal, but I'm not sure how to inspect the incoming XML. The code dies at the Invoke in Reference.cs
[System.Web.Services.Protocols.SoapHeaderAttribute("RequesterCredentials", Direction=System.Web.Services.Protocols.SoapHeaderDirection.InOut)]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlElementAttribute("BMGetButtonDetailsResponse", Namespace="urn:ebay:api:PayPalAPI")]
public BMGetButtonDetailsResponseType BMGetButtonDetails([System.Xml.Serialization.XmlElementAttribute(Namespace="urn:ebay:api:PayPalAPI")] BMGetButtonDetailsReq BMGetButtonDetailsReq) {
object[] results = this.Invoke("BMGetButtonDetails", new object[] {
BMGetButtonDetailsReq});
return ((BMGetButtonDetailsResponseType)(results[0]));
}
In general, is there any way to inspect the incoming XML in a Web Reference? (VS2010)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Fiddler 是一个很棒的 HTTP 代理/检查工具,用于检查 HTTP和/或 SOAP 流量。
编辑
有关通过 SSL 进行跟踪的提示此处
Fiddler is a great HTTP proxy/inspection tool for inspecting HTTP and/or SOAP traffic.
Edit
Tips on tracing over SSL here
我再次强调“服务引用与 Web 引用”的原因是,使用服务引用为您提供了一个用于观看 XML 的开箱即用的解决方案。只需使用配置编辑器工具 (SvcConfigEditor.exe) 打开< a href="http://msdn.microsoft.com/en-us/library/ms730064.aspx" rel="nofollow">消息记录。
The reason I was beating on the "Service Reference vs. Web Reference" drum again was that using Service References gives you an out of the box solution for watching the XML. Just use the Configuration Editor Tool (SvcConfigEditor.exe) to turn on Message Logging.