The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

WSDL's, Schemas and contract first dev (or something...)

Hi All,

having a bit of a problem, wondering if there is a solution. Am currently involved in building a fairly large complex-ish system. Weblogic/Java server side, .Net client, Web services and a message bus in-between. There is also some .Net middleware but ignore that for the moment.

We have one large XSD that describes our data entities on the server side, on the client side and on the bus. We keep all systems in sync. We use (an extended) version of .Net’s xsd codegen to generate classes from this XSD which we use throughout the client. Let’s say these classes have a base namespace of Company.System.Client.Messages. (A)

The web services exposed by the server side uses some (not all) of the objects as described in the large XSD as parameters and return types. When using VS2005 to add a web reference to a project, there is an auto created wsdl and, which generates code / classes (reference.cs) to be used against the web services. These classes have a namespace Company.System.Clent.DAL.WebService. (B)

Now the problem is that, although these classes from (A) and (B) are exactly the same structure, from a serialization point of view*, they are completely unrelated, from an OO pov. So while we are working with classes from (A), when we want to call a web service we have to convert them to their corresponding type in (B) before calling, and then convert the return type back to (A).

Our current solution is, as we obviously can’t cast, is to serialize object from (A) into an xml string in a MemoryStream, and then deserialize it back to it’s corresponding type from (B).

This works fine, but I am thinking there has to be a better way? It there a way to tell the web reference that the method parameters / return type, are (A) and not those defined in reference.cs (B)?  Any ideas?

(Afaik, there are similar issues with the server side.)


*we’ve extended the codegen to do other things such as using generic lists instead of arrays for collections, so the classes are not *exactly* the same. They serialize to each other fine.
Thursday, August 03, 2006
Anonymous poster
Thursday, August 03, 2006
We've done a .NET2.0 app connecting with huge j2ee/weblogic system. Our experience is that the reference.cs MUST be hand massaged, especially when the wsdl coming from the j2ee system is a lie. The reference.cs will need to be carefully preserved as it will be autodestroyed everytime someone accidentally refreshes the web reference, or adds a new one.

It took 4 people working 2 weeks to uncover what we needed to do, and SiteScope from Mindreef was the key. I can't get the company to pay for a license, and since I'm a contractor, not a full time employee, I'm not paying the $300/year out of my pocket for SiteScope.

I've not found a setting to prevent VS2005 from autodestroying the reference.cs. Perhaps there is one somewhere. There are a bazillion settings.
Thursday, August 03, 2006
I think I kind of concur with Peter ... I think you'll need to get in there and tweak the created reference.cs yourself, or alternatively, create your own web references (not that hard) ....
Friday, August 04, 2006
Yep, I'm thinking the same. Think I'll need to hand code the references.cs..
Monday, August 07, 2006

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz