470,870 Members | 1,388 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,870 developers. It's quick & easy.

Help - multiple web service methods map to a single implementation?

We are starting to setup some Web Services to provide our customers
with a way to programatically interact with our application, and some
of our customers have slightly different requirements in the structure,
format, and representation of the results for common requests. Of
course, we have to comply with their formats, but it seems to be a bit
of overkill to have multiple implementation methods and/or data objects
that represent the different data representation needs when the data
content itself is the same. Is there a standard approach in .NET Web
Services to provide multiple client-facing web service methods that
(somehow) internally map to a single data representation and
implementation method using XSLT or something? If not, is there a
pattern to follow that would hopefully reduce some of the duplication
of effort and error-prone code in mapping different data object
representations?

Thanks in advance

Mar 1 '06 #1
2 1089
Hi jjouett!

This is the sort of thing that BizTalk does in it's sleep. Granted, it may
be overkill for your particular situation, so here's a bespoke way to do it.

Firstly, you need to decide exactly how different the schemas for the
incoming data are going to be. If they're vastly different, I'd advise
setting up your webservice to take the entire XML document in as a string.
From there, you would have some sort of logic to work out which schema the
document should conform to. You might be able to do this by IP or by making
the sender provide credentials to the webservice.

For each different schema, you'll need an XSLT to map back to your internal
schema.

Load the string into an XMLDocument and process to your internal schema
using the XSLT.

Unfortunately, by using this method, you're losing a lot of your type-safety
as the WSDL won't reflect the underlying datatype requirements (due to the
xml being received as a string).

HTH,

Adam

--
Adam May
Sydney, Australia
MCSD.Net
"jjouett" wrote:
We are starting to setup some Web Services to provide our customers
with a way to programatically interact with our application, and some
of our customers have slightly different requirements in the structure,
format, and representation of the results for common requests. Of
course, we have to comply with their formats, but it seems to be a bit
of overkill to have multiple implementation methods and/or data objects
that represent the different data representation needs when the data
content itself is the same. Is there a standard approach in .NET Web
Services to provide multiple client-facing web service methods that
(somehow) internally map to a single data representation and
implementation method using XSLT or something? If not, is there a
pattern to follow that would hopefully reduce some of the duplication
of effort and error-prone code in mapping different data object
representations?

Thanks in advance

Mar 1 '06 #2
Thanks for the quick reply. I have considered this type of approach,
but I was really hoping that there would be a solution that would
preserve the datatypes in the interface. If anyone else has
suggestions, I would be very grateful.

Thanks

Mar 1 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Quiet Man | last post: by
29 posts views Thread by MAHESH MANDHARE | last post: by
11 posts views Thread by John | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.