'序列化正文'时出错.通过.NET 3.5调用Fedex Webservice时出现问题 [英] 'Error serializing body'. Problem calling Fedex webservice through .NET 3.5

查看:50
本文介绍了'序列化正文'时出错.通过.NET 3.5调用Fedex Webservice时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Fedex的Web服务,并且在我实际到达任何地方之前就遇到了一个烦人的错误.

I'm using Fedex's web services and getting an annoying error right up front before I can actually get anywhere.

序列化消息addressValidationRequest1的正文时出错:'无法生成临时类(result = 1).错误CS0030:无法将类型"FedEx.InterOp.AddressValidationServiceReference.ParsedElement []"转换为"FedEx.InterOp.AddressValidationServiceReference.ParsedElement"错误CS0029:无法将类型'FedEx.InterOp.AddressValidationServiceReference.ParsedElement'隐式转换为'FedEx.InterOp.AddressValidationServiceReference.ParsedElement []''.有关更多详细信息,请参见InnerException.

There was an error in serializing body of message addressValidationRequest1: 'Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'FedEx.InterOp.AddressValidationServiceReference.ParsedElement[]' to 'FedEx.InterOp.AddressValidationServiceReference.ParsedElement' error CS0029: Cannot implicitly convert type 'FedEx.InterOp.AddressValidationServiceReference.ParsedElement' to 'FedEx.InterOp.AddressValidationServiceReference.ParsedElement[]' '. Please see InnerException for more details.

我正在使用.NET 3.5并为我生成一个可怕的命名类(我不确定为什么它不仅是AddressValidationService):

I'm using .NET 3.5 and get a horrible named class generated for me (I'm not sure why it isn't just AddressValidationService):

AddressValidationPortTypeClient addressValidationService = new ...;

在该课程中,我进行网络服务呼叫:

on this class I make my web service call:

addressValidationService.addressValidation(request);

这是我收到此错误的时间.

This is when I get this error.

我可以找到的唯一对此错误的参考来自古老的1.1项目.就我而言,我的DLL引用了System.Web和System.Web.Services,这在当时似乎是个问题.

The only references I can find to this error come from ancient 1.1 projects. In my case my DLL has references to System.Web and System.Web.Services which seemed to be an issue back then.

推荐答案

您只需要更改[] [],而无需更改单个[].

You only need change the [][], not the single [].

在Reference.cs中更改

In Reference.cs change

private ParsedElement[][] parsedStreetLineField;
to
private ParsedElement[] parsedStreetLineField;
and
public ParsedElement[][] ParsedStreetLine {
to
public ParsedElement[] ParsedStreetLine {

这篇关于'序列化正文'时出错.通过.NET 3.5调用Fedex Webservice时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆