“错误序列化的身体”。问题通过.NET 3.5致电联邦快递的web服务 [英] 'Error serializing body'. Problem calling Fedex webservice through .NET 3.5

查看:234
本文介绍了“错误序列化的身体”。问题通过.NET 3.5致电联邦快递的web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用联邦快递的网络服务,却得到了恼人的错误直到前之前,我其实可以随时随地。

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

有在序列化消息addressValidationRequest1身体的错误:无法生成临时类(结果= 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 =新...;

在这个类我做我的web服务电话:

on this class I make my web service call:

addressValidationService.addressValidation(要求);

这是当我得到这个错误。

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致电联邦快递的web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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