473,722 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question for all of you EXPERT.NET architects

Question: How do you develop a web service that uses unknown types?

The ideas is that my web service performs a generic function. I want
anyone to be able to consume it, but I can't know what type of objects
they are going to pass to in (like I said it performs some generic
functionality - I don't want to recompile it ever).

So I create a simple web service with with a method like:

string GetTypeInfo(obj ect t){
return t.GetType().ToS tring();
}

I want to consume it with something like:

string s = WebService.GetT ypeInfo(new Widget());

Now the big question:
The Widget type is NOT referenced in the web service (the whole point
is its generic remember). Now to me it makes sense that the client
(web service consumer) would serialize the object to xml, and pass the
xml and xsd describing the object over the wire via soap. The server,
would deserialize the xml to an object using the xsd by doing the
following: if the type is unknown, the deserializer could define a new
type via system.refelect ion.emit and then create an instance of it and
populate it. Does this make any sense? Is there something built into
the webservices to do this? If not, has anyone tried to roll your
own?

So why would I want to do this? Because lets say you have a business
tier and a data tier that are loosely coupled. My business tier holds
my model and my data tier populates the model (using a persistance
framework like hibernate). I don't want to recompile my data tier
simply because my model changes - I want it to be LOOSELY coupled, but
I don't want to be tied to simple value types and strings (I want to
do something useful).

Thanks for taking to read and answer my question.
Mike
Nov 21 '05 #1
6 1426
Mike Mille wrote:
Question: How do you develop a web service that uses unknown types?


I'm posting my response of list to avoid starting a holy war. I don't
believe in the no-win scenario...

http://sqljunkies.com/WebLog/ktegels...8/04/3768.aspx

Thanks!

Kent Tegels

SQL Sever Express Blog (Good for FAQs): http://tinyurl.com/6r4gb

SQL Server Express BOL (The docs you need): http://tinyurl.com/4ctjx

Kent's Blog: http://www.tegels.org/
Nov 21 '05 #2
Ken the link you sent is not working? I was not trying to start a
holy war just get a answers to a question (the more input the better).
The scenerio I mentioned is just one of many for me and solving this
problem would be huge.

Thanks,
Mike
"Kent Tegels" <ke**@tegels.or g> wrote in message news:<#u******* ******@TK2MSFTN GP10.phx.gbl>.. .
Mike Mille wrote:
Question: How do you develop a web service that uses unknown types?


I'm posting my response of list to avoid starting a holy war. I don't
believe in the no-win scenario...

http://sqljunkies.com/WebLog/ktegels...8/04/3768.aspx

Thanks!

Kent Tegels

SQL Sever Express Blog (Good for FAQs): http://tinyurl.com/6r4gb

SQL Server Express BOL (The docs you need): http://tinyurl.com/4ctjx

Kent's Blog: http://www.tegels.org/

Nov 21 '05 #3
It appears that both DNJ and SQLJ are down at this time. Give 'em a
couple of hours to sort that out.

Thanks!

Kent Tegels

SQL Sever Express Blog (Good for FAQs): http://tinyurl.com/6r4gb

SQL Server Express BOL (The docs you need): http://tinyurl.com/4ctjx

Kent's Blog: http://www.tegels.org/
Nov 21 '05 #4
You could set up the object, conceivably, by using System.Reflecti on.Emit,
but you leave a lot of possibilities when you except any type of object.
While you may receive a factory and build your own factory, you might find
that there factory was a mill, while yours looks more like a car factory.

This is not a major problem if you are merely dinking around with the
variables and sending it back in the same serialization method. But, in
those cases, the factory object is a BS concept you made up simply to dink
around with properties. If that is all you are doing, why deserialize the
stupid class anyway, as you can consume the serialized XML and change things
and bounce it back.

Apologies if I appear a bit snarky on this one, but I, like Kent, believe
you should know what your app is doing. If someone wants to fire some
generic BS that you are not going to officially handle, it is better to
leave it as an XML string and store it that way than it is to create a
complete BS object simple to pretend you are talking the same language.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ***
Think Outside the Box!
*************** *************** *************** ***
"Mike Miller" <mm*****@bluecy press.net> wrote in message
news:f2******** *************** ***@posting.goo gle.com...
Question: How do you develop a web service that uses unknown types?

The ideas is that my web service performs a generic function. I want
anyone to be able to consume it, but I can't know what type of objects
they are going to pass to in (like I said it performs some generic
functionality - I don't want to recompile it ever).

So I create a simple web service with with a method like:

string GetTypeInfo(obj ect t){
return t.GetType().ToS tring();
}

I want to consume it with something like:

string s = WebService.GetT ypeInfo(new Widget());

Now the big question:
The Widget type is NOT referenced in the web service (the whole point
is its generic remember). Now to me it makes sense that the client
(web service consumer) would serialize the object to xml, and pass the
xml and xsd describing the object over the wire via soap. The server,
would deserialize the xml to an object using the xsd by doing the
following: if the type is unknown, the deserializer could define a new
type via system.refelect ion.emit and then create an instance of it and
populate it. Does this make any sense? Is there something built into
the webservices to do this? If not, has anyone tried to roll your
own?

So why would I want to do this? Because lets say you have a business
tier and a data tier that are loosely coupled. My business tier holds
my model and my data tier populates the model (using a persistance
framework like hibernate). I don't want to recompile my data tier
simply because my model changes - I want it to be LOOSELY coupled, but
I don't want to be tied to simple value types and strings (I want to
do something useful).

Thanks for taking to read and answer my question.
Mike

Nov 21 '05 #5
I guess I am attemping the wrong approach for a service oriented
architecture - although I think I have correct end goals in mind. I
think everything said so far is valid. So is anyone building things
like generic core services for the enterprise that can be consumed by
multiple applications. I am talking about things like logging and
auditing, configuration, search, and persistance. Things every
application needs, but in many cases most don't care how they are
implemented, simply that they work. Most of these services will be
wrapped with functionality in the application to meet the business
requirements, they are simply building blocks to get there faster,
without coping and recompiling the same old code blocks over and over
again. If you are using these types of services how are you passing
data (xml that conforms to a xsd the service publishes)? If your not
what is your approach?

Thanks for all the input-
Mike
Nov 21 '05 #6
Mike, I think you nailed the issue in the first sentence of your most recent
post:

"I guess I am attemping the wrong approach for a service oriented
architecture - although I think I have correct end goals in mind."

SOA is based on the concept of qualified (i.e., well-defined) message
exchange between Web service endpoints. This is not incompatible with your
goals, because SOA does not dictate what the inner workings of a Web service
how. However, SOA does dictate that the messages being exchanged must be
well qualified. This is why you are attempting the wrong approach for SOA.

That being said, why can't you use a more generic, collection-based custom
object to transmit your Web service requests if you really don't want to be
pinned down to specific custom data types. For example, the ADO.NET DataSet
is simply a fancy collection of rows. There's nothing to stop you from
implementing a collection-oriented custom data type that is, say, a
collection of strings, where each string is a particular generic command to
the Web service.

But whichever way you cut it, you will find that you can't clearly explain
to your clients how to call your Web service. If you tell them to pass in a
"generic collection of input parameters" then you leave the door open for
them to make mistakes, to send you improperly formatted Web service
requests, and then things could get ugly! So, my perspective is that SOA's
enforcement of qualified types is ultimately in your favor. And don't
forget, you can always upgrade your Web service interface if the
functionality changes... you just then need to publish 2 different versions
of the WSDL document for the Web service.

Jeffrey Hasan, MCSD
President, Bluestone Partners, Inc.
-----------------------------------------------
Author of: Expert SOA in C# Using WSE 2.0 (APress, 2004)
http://www.bluestonepartners.com/soa.aspx
"Mike Miller" <mm*****@bluecy press.net> wrote in message
news:f2******** *************** ***@posting.goo gle.com...
I guess I am attemping the wrong approach for a service oriented
architecture - although I think I have correct end goals in mind. I
think everything said so far is valid. So is anyone building things
like generic core services for the enterprise that can be consumed by
multiple applications. I am talking about things like logging and
auditing, configuration, search, and persistance. Things every
application needs, but in many cases most don't care how they are
implemented, simply that they work. Most of these services will be
wrapped with functionality in the application to meet the business
requirements, they are simply building blocks to get there faster,
without coping and recompiling the same old code blocks over and over
again. If you are using these types of services how are you passing
data (xml that conforms to a xsd the service publishes)? If your not
what is your approach?

Thanks for all the input-
Mike

Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1789
by: Blackbaud | last post by:
Blackbaud has several permanent, full-time openings in the Product Development department including Software Engineers, Software Architects and Application Developers. All positions are based at Blackbaud's headquarters in Charleston, SC and applicants must be willing to relocate. Candidates must be authorized to work in the US on their first day of employment. Desired Experience and Requirements: 4-8 years in packaged software...
33
3156
by: John Timbers | last post by:
I'd like to purchase Visual C# .Net for learning purposes only since it's a lot cheaper than Visual Studio (note that I'm a very experienced C++ developer). Can someone simply clarify the basic differences. Ok, Visual Studio has C++, VB and J++ thrown in plus some extra bells and whistles (I already have some minimal experience) but are both IDE's essentially the same (including the same IDE support for creating forms, ADO.NET DataSets,...
43
2662
by: nospam | last post by:
I got three (3) files (1) Untitled.aspx (2) Untitled.aspx.1.cs (3) Untitled.aspx.2.cs These three files must be used together to make file #1, Untitled.aspx, page work via J.I.T. when the User first hits Internet Explorer 6.0 on your browser.
62
9181
by: ROSY | last post by:
hello experts plz answer following questions::: thanks in advance. 1. Out of fgets() and gets() which function is safe to use and why? 2. What is a far pointer? where we use it? 3. What does the error 'Null Pointer Assignment' mean and what causes this error? 4. What is near, far and huge pointers? How many bytes are occupied by them? 5. How would you obtain segment and offset addresses from a far address of a memory location?
13
1479
by: Ghislain Tanguay | last post by:
I have a compiled vb.net app and I want to give the user a choice to launch it from the start line command and pass it a parameter or not. How can I do that in my code? Is it possible? Ex. : MyApp.exe "Go"
1
296
by: HS1 | last post by:
Hello I use a DataGrid to present data of a table ("Jobs") through a DataSet (ds) using a DataAdapter (da) I use the query for DataAdapter (da):
0
905
by: TomasFloyd | last post by:
Hi all I'm using VS 2003 and I want to create ERD's that I can forward engineer. My Visio 2003 doesn't support this. But I cant seem to find the Visio for Enterprise Architects component/tool in VS. Any help would greatly be appreciated. Thanks Tomas
6
365
by: spibou | last post by:
In page 81 of N1124 in footnote 87 we read: If the value of the expression is represented with greater precision or range than required by the type named by the cast (6.3.1.8), then the cast specifies a conversion even if the type of the expression is the same as the named type. Can someone give me an example of what this means ?
1
1367
by: templesystems | last post by:
Urgent opening: 1+ yr contracts, Minneapolis, MN .Net Technical Architects (C#, VS, VB, SQL). Must be Architects, not designers or developers. Multiple openings Submit your resumes along with the desired sal range ASAP to templesystems@gmail.com
0
8863
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9384
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9238
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.