Hi there.
I've got an app in c# that uses web services (both as consumer and server)
which I wrote some years ago and am now updating.
The server side gets information from SQLServer as XML and serialises the
result into an object tree generated on an XSD file.
The object in question is an Order Batch - a collection of orders.
Recently I needed to slight change the definition of an order, so I changed
the xsd file, rebuilt and then updated the web reference.
What's happening is that two of my methods (the only two which return an
order, rather than an order batch) now return a new type <MethodName>Result.
(this is looking at the object browser in the client)
So GetOrder returns GetOrderResult which is identical in content to an
order, but it isn't!
Methods which return the OrderBatch type work successfully with no change.
During this rebuild, however, all the class names changed from the ones
which were in the xsd classes on the server side (e.g. Order [server xsd] now
seems to be OrderBatchTypeOrder [object browser on the client side]) and I
suspect that this is what is causing the problem. And roughly the names
reflect nesting level in the XML so OrderBatchType contains
OrderBatchTypeOrder which contains OrderBatchTypeOrderPhysicalGoods and so on.
However, if I example the asmx output in a browser it has the original
(OrderBatch, Order) names rather than ones which the client seems to expect
(OrderBatchType, OrderBatchTypeOrder).
Any suggestions would be appreciated.
Iain
Iain - 29 Nov 2007 10:05 GMT
More detail.
What I'm seeing with this problem is that the client side is naming child
classes in a concatenated way rather than sticking to the original names.
So if I have OrderBatch containing Order containing OrderLine (ie OrderBatch
has an Order[] Order variable), Methods which return an OrderBatch generate
class definitions named OrderBatchOrder and OrderBatchOrderLine.
But methods which return an Order generate class definitions named Order and
OrderOrderLine.
And although and OrderOrderLine have exactly the same structure they are, of
course, different types and so incompatible.
What is wierd is that the WSDL looks exactly as I would expect (with
OrderBatch, Order and OrderLine elements). It's something on the client side
which is doing it.
I've tried deleting and re-Adding the Web Service and I've googled till my
fingers are numb, but to no avail.
Help!
Iain