views:

101

answers:

1

Hello everyone.

I have two "identical" webservices (Soap) on two different servers. Don't ask why :-)

WebService-1 decides if it handels the request itself or if it passes the request to WebService-2. If so, the response of WebService-2 should directly be returned from WebService-1.

The response datatype is complex and self defined. With simple datatypes like 'int or 'string' there would be no problem.

The response of WebService-2 is a serialized object (I think it is called "stubs") and theredore it is not possibel to pass this object through as the response of WebService-1 because the type of the objects doesn't match.

Is there a simple way to convert the serialised datatype into its original type without buiding a complex converter?

+1  A: 

Yes - how to achieve this differs depending on whether you are using WCF or old-style Web Services.

Essentially, you want the web reference tools (svcutil.exe or wsdl.exe, respectively) to identify that the result of the webservice is actually a "well-known" object type - much as it does for many of the core framework objects.

Within WCF, this is normally achieved by ensuring that your contracts are held in a referenced assembly, and are decorated with namespace attributes. If you do this, when you add a reference to your webservice it should use your class natively instead of generating a similar proxy class.

If you are using old-style web-services, you will have to look into using a SchemaImporter project - this will allow the wsdl.exe tool to recognise your types and correctly utilise them. It should be mentioned that this is only required at design-time - no such measures are required during deployment.

Gareth Saul
Thanks for the quick answer, but how can I implement the KnownType-Attribute in a old-style webservice? I can only find it in connection with WCF. Maybe you have code snippet for me? Thanks!
Marc
Misled you slightly - what you are actually looking for is a Schema Importer Extension. Haven't done one since 2005-ish, so forgive my poor memory. Instructions here: http://www.microsoft.com/belux/msdn/nl/community/columns/jdruyts/wsproxy.mspx
Gareth Saul