"Dynamic" Web Services, "Dynamic" Parameters

This is a follow-up discussion from http://forums.asp.net/t/1332722.aspx?PageIndex=2. I noticed we stopped talking about Peter's problem some time ago.

The discussion had become one of passing "XML strings" to a web service in order to permit optional parameters, a dynamic web service, and things like that.

My contention is that this is a solution without a requirement. It is something that we can do, which does not imply that anyone needs us to do it.

First of all, if you need to send XML, then send XML. Do not send a string that happens to have XML embedded in it. ASMX web services may accept parameters of type XmlElement or XmlDocument, and may return the same. I've done this in a commercial web service, when it was easier to implement the service this way than by creating a very large complicated class to hold the same data. The internal processing of this service was also more convenient to implement using XML. The clients have no idea that XML is being used - it's an implementation technique only. I wrote my own WSDL and XML Schemas, and that's what they see and use. I did not force them to play with XML.

There are also a very few good reasons for creating a "dynamic" web service that operates on XML. For instance, if the service performs an XML Transform or XQuery operation against the incoming XML and returns the result. In this case, the client code was written in terms of XML, so it is natural for the client code to send XML.

It is also possible to create automated tests for such a service, because the operation of service is an operation on XML. It's easy to see if the service does the right thing, and to see how it handles invalid XML.

But as soon as you start talking about a service being written to handle data that it doesn't know how to handle, then I start worrying about how you can prove that it "doesn't handle it" in the correct way!

Anyway, if more discussion is necessary, then let's have it here.

John Saunders | MVP – Connected System Developer
10/15/2008 6:26:17 PM
asp.net.networking-webservices 2181 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 14

My whole idea of passing a string which happens to have XML tags in it was based on the Fetch method for the Microsoft CRM web service (http://msdn.microsoft.com/en-us/library/aa680903.aspx). There, the callers will have to send a well defined XML request inside a string and get some response back. Now, in that scenario, they have a schema definition for the XML tags that are going to come from the string (http://msdn.microsoft.com/en-us/library/aa681833.aspx). So, my question here is that, shouldn't the web service either error out when it gets an XML that is different than that is required? OR, parse the tags that are defined in the schema definition and ignore the tags that are supposedly NEW?

So, in effect, if you have a schema definition for the XML tags that are going to come from the string, isn't your web service automatically capable enough to handle things that are not defined in the schema definition and ignore them or error out?

10/16/2008 1:41:51 AM

Dumb is dumb, even if it's in a product that Microsoft acquired. They didn't write it, remember?

Look at that MSDN page again. Does that look like the kind of API you'd be proud to expose your customers to? Remember, these are people who are paying you money - you're supposed to be nice to them, not to make them get the quoting right on "XML Strings".

And I may have missed it, but I didn't notice any examples of processing the responses, which were, again, "XML strings". That's likely for the same reason they didn't show examples of using the .NET XML APIs to create the requests, but instead showed the use of literal strings - they have created an API which is too difficult for their users to use, or for them to explain to their users. They seem to have created an API that requires their users to be savvy enough to construct an XML document and send it, then to parse an XML document on receipt. It's a bad idea, and indicates that they have a better idea of their own requirements as developers of the query functionality than they do of their customers requirements in using that functionality.

I hope there's a UI on top of that query language.

John Saunders | MVP – Connected System Developer
10/16/2008 11:51:02 AM

Similar Artilces:

Precedence of "where" ("of", "is", "will")?
Nobody on #perl6 today could answer this one. Is: Str | Int where { $_ } the same as: (Str | Int) where { $_ } or: Str | (Int where { $_ }) ? Followup questions, Mr. President: What kind of operators are "where", "of", "is", and "will"? Is there a reason that S03 doesn't list them? What are their precedence(s)? -- Chip Salzenberg - a.k.a. - <chip@pobox.com> Open Source is not an excuse to write fun code then leave the actual work to others. Chip Salzenberg writes: &...

.ALLCOL("%COLUMN%", " ", ", ", ", ")
Do you know anyway for me to exclude a subset of columns returned by this function. We have two columns (rec_user and rec_datetime) which are in all of our tables, but when generating triggers I want automatically generate a script which does not include those two columns but does include all other columns in that table. Bruce I should add that I am using PD Bruce "Bruce Lamb" <lamb.bruce@mayo.edu> wrote in message news:6HgI315nCHA.155@forums.sybase.com... > Do you know anyway for me to exclude a subset of columns returned by this > function. ...

quotes, quotes, quotes...
I am getting this error and I know what is causing it, but I have no idea how to fix it, any help would be great. The script steps through the /var/log/messages file on a linux server and puts The entries into a mysql database. However when it gets to the 'hlt' line in the messages file it just barfs. The single quotes are freaking it out. I know about quotes but not how to use in this situation. Thanks, Paul Error: May 27 17:53:00 localhost kernel: Checking 'hlt' instruction... OK. <----- doesn't like this in the messages file DBD::mysql::st exec...

"Using" or "With"
Hi all Please can someone enlighten to me as regards the difference with the "Using" and "With" statement when accessing data - which is better, what are the limitations and/or any pointers. Many thanks. Regards DaveDavid WinchesterPlease mark as answer if this is the solution.  using gives you the ability to use the connection and it closes the connection directlly after you finish using it. and there is no need to try- cach - finaly. there is no limitation on using USING keywordMuhanad YOUNISMCSD.NETMy Blog || My Photos || LinkedIn I have a dataobject the re...

"Me" is better than "You"
Yes I know, strings are frozen. But let me talk about it, I really can't get through the idea of a PC talkin to me. I consider my PC as an extension of myself, not a dumb companion who addresses Me as You. Yes there are times when I get angry with Him while I work and get wrong calculations etc.., but it really is my fault, Me using wrong istructions and eventually wanting to find someone else to blame, but it's Me. And yes, I consider Thunderbird my mail program, reading my mail on my PC as Me. So I personally like to have Me in the header bar as a compact address ...

"-" not "_"
I wrote a SQL statement in the data tab. I wrote a bunch of alaises as example ' word-type ' but when I hit the layout tab it converts the "-" to "_". So now my field name is ' word_type '. Is there any way to prevent this? CardGunner Don' use a hypen ( - ).  It isn't a valid character for column names.   See http://searchsqlserver.techtarget.com/expert/KnowledgebaseAnswer/0,289625,sid87_gci1188931,00.html   Here's an excerpt about column names: Letters as defined in the Unicode Standard 2.0 Decimal numbers from either B...

replace the "." with a ","
Oi.... I need to build a small programm in ASP.NET and chose to use C# for it.Now i got everything working but there's one little problem.the first textbox is a double. I need to make it so that when someone enters a "." then it gets replaced by a ","any ideas?Ghan  string blah = "";blah = blah.Replace(".", ",");Ryan Ryan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question...

Using "+" or "||"
Using SQLAnywhere 5.5.04, I've gotten into the habit of using "||" in ISQL to indicate a string concatenation. I needed to paste my SQL statement into the PowerBuilder script painter for some embedded SQL, and PB didn't like the "||" very much at all. I changed it to "+" and it seems to be ok. Do these two operators indicate ~exactly~ the same thing? moin, afaik these two's are not the same! if you're using "||" and any term is NULL then in the resultstring the term will be ignored if you use "+" then the resu...

double quote
hello there...  i tried everything of think but not working the way i wanted to be... not sure what i'm missing...i'm generating a <span> in code behind and then using in javascript.... here is what i'm doing code behind: int i=0string _keywordID = "keyword";string _name = row["visit_info_nm"].ToString().Trim(); String _getElementByID = String.Format("<span id='{0}' OnClick = \"document.getElementById('{1}').value='{2}';\">{3}</span><br>", i, _keywordID, _name, _name); here is what it generate : <span id='1' OnClick = \"document.getElementById('keyword')...

Replacing "\\" with "\"
Hi all I'm getting this value from a CheckBoxList control - a location of file, i have to remove "\\" and replace it with "\" and pass it to Query, how to do it, i tried with Replace, but coud'nt suceed. "\\\\Blaze10xp\\BLZ_SFS_07\\Sample Excel Files\\Excel Files\\report2.xls" thank's in advance - Prakash.C you tried Replace like this? string newstring = oldstring.Replace(@"\\",@"\");Plese, do not forget to click "Mark as Answer" on the post that helped you. Thanx!My blog: Scenes From A Developer Memory yes i tr...

"To" and "From" missing
When I print emails, the words "To" and "From" are blank, even though the "To" name and "From name (addresser, addressee) do show up. This is not a problem for other users on my system. Suggestions In mailbox right click, view. On the message window, right click and choose print options. Make sure print header is checked. -- Barry Merchant NSC Volunteer SysOp *** no email unless requested please!! *** > In mailbox right click, view. On the message window, right click and > choose print options. Make sure prin...

Please compare "web service" and "remote services"
Somebody, please tell me the different beetween "web services" and "remote services". So, "web services" and "remote services" which one is better? Please tell me This might provide some insight. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetremotearch.asp The really question at hand is what kind of project? Frank ...

Regular Expression to remove "/", "\", "<", ">" and "="
Can anyone please show me the regular expression to reject a string ("<blue", "right>" etc.) which has the following expression in it: "/", "\", "<", ">" and "="  hi, It may Help u.. it is in Class file u may use this expressin in validation controls also. Regex objReg = new Regex(@"^[^,.?/\~|`;:'<>]*$", RegexOptions.Singleline); Regex objReg = new Regex(@"^[^,][^.][^?][^/][^\][^~|][^`][^;][^:][^'][[^<][^>]$", RegexOptions.IgnoreCase);Thanks &...

"JROC" / "JROK" / "JROCK" / "JROQ"
I just started a new contract and the tech lead told me that he wanted me to become familiar with something called "JROC" (among some other tools). I've been searching the web and I haven't found any dev tool called "JROC." Based on the name of the tool, it sounds like it encapsulates some javascript functionality. I have tried searching for different spellings - "JROK" / "JROCK" / "JROQ" but I haven't found any matches. Have you ever heard of a dev tool by this name?...

Web resources about - "Dynamic" Web Services, "Dynamic" Parameters - asp.net.networking-webservices

Resources last updated: 12/18/2015 1:17:26 AM