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.
精彩评论