Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
798 views
in Technique[技术] by (71.8m points)

web services - 'Error serializing body'. Problem calling Fedex webservice through .NET 3.5

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

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.

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.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

In Reference.cs change

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...