开发者

Web Service Call - Auto Generated attributes

开发者 https://www.devze.com 2023-02-11 05:35 出处:网络
I\'m trying to call a Soap Web Service, and I need to pass an Address Object to the Server. I can pass an existing address.Id to update an existing address, or if I leave the address.Id empty, it shou

I'm trying to call a Soap Web Service, and I need to pass an Address Object to the Server. I can pass an existing address.Id to update an existing address, or if I leave the address.Id empty, it should be saved as开发者_高级运维 a new Address. The Problem is that the Id is of long type, and it allways has a value of 0.

And this makes problems for the server, because even if the Id=0, the Server Side function will take the Address as Existing one, and it will start to search on the Database for an Address with Id=0. Of course there is no such address, and it throws an error. When I try to call the Web Service with WebService Studio or SoapUI, and I delete the id manually, then It works as expected, as soon as I put then it returns me an error - Address with Id=0 not found.

So the question is, how to change the webservice definitions, or the proxy classes so that it does not generates this id="0" at all?

Any Help would be great.

P.S. I cannot change the Server Side method, it would have been the easiest solution, but unfortunatelly is not possible.

Thanks


If you are using the default .NET serializers, you may try with using the XmlIgnore attribute

If you are using other serializers there are normally attributes to control how the serialization occurs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号