all groups > dotnet web services > march 2006 >
You're in the

dotnet web services

group:

Consistent Types Across Web Services


Consistent Types Across Web Services IanH
3/28/2006 12:20:04 AM
dotnet web services: I am currently experiencing a problem with using web services within .Net 2.0.

My problem is that i have client and server components that interact through
a common class foo. This same class is used extensively through other parts
of the system.When the application is distributed through web services, the
web references provide an alternative class ws.foo which is quite lose but
not the same.

I don't really want to go through the entire application changing the types
from foo to ws.foo so how do i get the web services to expose a identical
RE: Consistent Types Across Web Services Kolbis Guy
3/28/2006 3:42:01 AM
Hi,
This is a problam.
If the problam was with two web services that expose the same type but
different namespaces there is a tool you can use. You can read about it in my
blog:

http://kolbis.blogspot.com/

I had this problam too. I solved it using a mapper class that maps the types
from the web service type to the application type.
If you find another solution please share it.

[quoted text, click to view]
RE: Consistent Types Across Web Services IanH
3/28/2006 3:52:02 AM
Thanks guy, i have been down the generic reflection route, but i feel that i
am missing out on a trick somewhere,

[quoted text, click to view]
Re: Consistent Types Across Web Services Josh Twist
3/28/2006 8:36:27 AM
Hi Ian,

This is tricky. It's actually one of the tenets of Service Orientation
that Web Services share schema (i.e. the shape of the object) and not
type (an implementation).

However, sometimes we developers who are lucky enough to have control
of both sides of the service boundary may want to reuse our classes in
the way you describe. I've done the same thing in the past by
generating the web service proxy myself (using WSDL.exe) and adding it
to my project just like any other .cs file. Then you can simply jump in
and make some gentle changes to use of foo instead of ws.foo. It's that
easy.

Let me know how you get on.

Josh
http://www.thejoyofcode.com/
Re: Consistent Types Across Web Services Kolbis Guy
3/28/2006 9:00:02 AM
Hi Josh,
You are right when you say that they should share schema.
However, what should you do when updating a web reference?
And how can you share schema in this case?

[quoted text, click to view]
Re: Consistent Types Across Web Services IanH
3/28/2006 10:00:04 AM
I have been down the manual wsdl route before and was trying to avoid it again.
Thank for reminding me about the SOA principle, it takes the pain away
slightly, i guess the thing to really do is, just like Kolbis suggests and
implement a facade wrapper to really hide and abstract the entire we service
implementation.

Still seems a little strange as the objects were initially generated from
XML schemas - i think this may be explained by subtle differences between
2003 and 2004 serialisation.

Thanks anyway.

[quoted text, click to view]
Re: Consistent Types Across Web Services Ashish
3/28/2006 5:35:03 PM
you can create a component from SchemaImporterExtension class and
register it on the development machine, look at this article

http://www.microsoft.com/belux/nl/msdn/community/columns/jdruyts/wsproxy.mspx

hth




[quoted text, click to view]
Re: Consistent Types Across Web Services Josh Twist
3/28/2006 11:03:24 PM
Hello again all,

Yes, updating web reference is the caveat to this. If you 'update the
web reference' you need to reimplement your changes.

The new SchemaImporterExtension is something I've been meaning to look
at for a while now and not got round to it (I wanted to enhance this to
automate it such that it scans your .sln for projects with matching
classes but I need to somehow get information from devenv.exe into
wsdl.exe - one day :).

At the end of the day it's all a trade-off, choose which one suits you.
My WSDLs are designed up front so don't change too often, hence I don't
mind reimplimenting a few classes here and there when they do.

Josh
http://www.thejoyofcode.com/
Re: Consistent Types Across Web Services Tobias
3/10/2008 4:16:01 AM
Hello,

I have the same problem and I solved most of it by implementing my own
SchemaImporterExtension class.

However the only type that it doesn't work with are Typed DataSets
This i a really huge problem !

Has anyone been able to solve this ?
I have searched around a lot and can't seem to find any information
that would solve this problem, only unanswered questions about it.
( http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=374848&SiteID=1 )

I would really appreciate any help about this.

Best regards
Tobias
Softronic
(valid MSDN subscription)


[quoted text, click to view]
Re: Consistent Types Across Web Services John Saunders [MVP]
3/10/2008 1:25:14 PM
[quoted text, click to view]

My best advice would be to not use DataSet at all.

See
http://www.hanselman.com/blog/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanAndRepresentsAllThatIsTrulyEvilInTheWorld.aspx
for a point of view similar to mine on the subject.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer

Re: Consistent Types Across Web Services Tobias
3/11/2008 3:18:04 AM
[quoted text, click to view]

Well, thank you for your input ;-)

But unfortunately, it doesn't matter how much I agree with you
because I am in this situation and don't have a choice but to use Typed
DataSets.

Have started to write our own custom tool that "cleans" the proxy class from
DataSets and inserting Using statements instead.

But if anyone has any other ideas ? I would certanly like to hear about them.

AddThis Social Bookmark Button