how to send objects with different namespaces to multiple Web Services

I

IanT

I have a problem where i would like to send the same object to 2 or
more different webservices which accept objects with exactly the same
structure. I realise that if we'd been wise we would have used the
same WSDL for each and i will do for future Development but for the
moment i have to consume a clients Service and have to make the best
of what i have.

The problem seems to be in the namespaces. Even though the objects are
structurally exactly the same they are obviously treated as different
types.

I would like to be able to convert a standard object so i can pass it
to both Services and hence avoid duplication.

To get around this i attempted to create a class which inherited from
a site specific class (from the proxy) and then populated itself from
a standard object but when i attempt to call the WebMethod i get the
following error.

"A first chance exception of type 'System.InvalidOperationException'
occurred in n-nbnq0s

Additional information: The type SSS_Generator.schemas.MyType was not
expected. Use the XmlInclude or SoapInclude attribute to specify types
that are not known statically."

This problem is generated by the WebProxy - it never actually gets
sent to the Web Service.

At the moment the only solution open to me is to write a function to
populate the class generated by the WebProxy from another standard
class which is structurally identical.

Does anyone have any other ideas?

many thanks

Ian
 
D

Dino Chiesa [Microsoft]

yes, read the article "sharing types" on MSDN from July 2002.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07162002.asp

That may help.

More generally, the client's WSDL should be architected so that data schema
is independent of the interface. The WSDL should import XSD files that
describe the schema. then you can also have a 2nd WSDL that imports the
same XSD's, as well as other XSDs.

If each XSD is defined with its own namespace, then you will be able to
share the corresponding types across clients, servers, etc.

-D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,815
Latest member
treekmostly22

Latest Threads

Top