tags:

views:

494

answers:

2

I use svcutil to generate my wcf proxy that is calling a WSE2 web service.

The problem comes when the web service author changes the order of fields in the proxy.

I examined the generated proxy and sees that the public attributes are adorned with the XmlElementAttribute(Order=0) .. Order=1, etc for each field.

Is there a way to generate WCF proxies that can still function after the web service has changed?

Because right now I will need to regenerate the proxy and recompile.

Thanks in Advance

A: 

You can manually change the generated file, which is probably the best solution if the only thing that changed was the order of the fields. But you will have to recompile.

Otherwise, you can use use a channel factory to create the channel, but you will still have to change the data contract => you will have to recompile.

Keep the proxy in a separate assembly?

Philippe
A: 

The basic normal proxy generated by svcutil will use the DataContractSerializer, which uses these Order=x attributes.

If you wish, you could also use the straight XmlSerializer instead, which will not decorate your properties with an Order=x attribute.

Use:

  svcutil ........ /serializer:XmlSerializer

to achieve this.

Marc

marc_s
This didn't work for me, its using XmlSerializer by default and its generating those Order attributes.
hhmm..... ok ...... not sure why not - worked in my case.
marc_s