473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Passing a "custom object" to a webservice?

Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object,
"Stroke" to the webservice, which will be located in a different computer.

-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)
-The custom class seems to be serialized in the client:

[Serializable] public class Stroke { .... }
Question:

-How do I let the webservice project know about Stroke? The class template
in the client is quite large
Thanks!

Jorge
Nov 16 '05 #1
5 5118
Jorge,

You actually don't have to do much. You just have to make sure that
your type works with XmlSerialization. XmlSerialization isn't the same as
normal serialization. XmlSerialization works by getting all of the
publically available values from the class (public fields and properties)
and sends those.

If your class can expose its state through only publically available
members, then you should be fine (assuming they are not read only).

Once you do that, you just have to expose your method, and when you
generate a proxy, the type information for Stroke will be exposed through
the WSDL, which will be exposed in the client-side proxy that will be used.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"hellrazor" <jo***@another-world.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object,
"Stroke" to the webservice, which will be located in a different computer.

-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)
-The custom class seems to be serialized in the client:

[Serializable] public class Stroke { .... }
Question:

-How do I let the webservice project know about Stroke? The class template
in the client is quite large
Thanks!

Jorge

Nov 16 '05 #2
Jorge,

You actually don't have to do much. You just have to make sure that
your type works with XmlSerialization. XmlSerialization isn't the same as
normal serialization. XmlSerialization works by getting all of the
publically available values from the class (public fields and properties)
and sends those.

If your class can expose its state through only publically available
members, then you should be fine (assuming they are not read only).

Once you do that, you just have to expose your method, and when you
generate a proxy, the type information for Stroke will be exposed through
the WSDL, which will be exposed in the client-side proxy that will be used.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"hellrazor" <jo***@another-world.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object,
"Stroke" to the webservice, which will be located in a different computer.

-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)
-The custom class seems to be serialized in the client:

[Serializable] public class Stroke { .... }
Question:

-How do I let the webservice project know about Stroke? The class template
in the client is quite large
Thanks!

Jorge

Nov 16 '05 #3
You cannot send an object to a webservice. Webservice's receive messages (data in other words) not behaviour. Therefore, you can send the state of the stroke but you can't send the methods. Those will have to coded at the webservice, or it will need access to the stroke type (via its assembly) on the server and use the state passed to instantiate a new stroke object that has the methods.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<Xn**********************************@207.46.248.1 6>

Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object,
"Stroke" to the webservice, which will be located in a different computer.

-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)

Nov 16 '05 #4
You cannot send an object to a webservice. Webservice's receive messages (data in other words) not behaviour. Therefore, you can send the state of the stroke but you can't send the methods. Those will have to coded at the webservice, or it will need access to the stroke type (via its assembly) on the server and use the state passed to instantiate a new stroke object that has the methods.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<Xn**********************************@207.46.248.1 6>

Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object,
"Stroke" to the webservice, which will be located in a different computer.

-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)

Nov 16 '05 #5
If the class is part of an assembly that is available to both webservice and
client can the object be reformed in the webservice using the serialized
data?

MattC

"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in
message news:OG**************@TK2MSFTNGP15.phx.gbl...
You cannot send an object to a webservice. Webservice's receive messages (data in other words) not behaviour. Therefore, you can send the state of
the stroke but you can't send the methods. Those will have to coded at the
webservice, or it will need access to the stroke type (via its assembly) on
the server and use the state passed to instantiate a new stroke object that
has the methods.
Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<Xns959C7
71**************************@207.46.248.16>
Hi there,

I'm very new to dot net programming and webservices programming. I've
managed to create simple webservices so far.

Here's my problem:

-I've been given a project which needs to have a proprietary algorithm
split into a webservice.

-The program consuming the webservice needs to send a custom class object, "Stroke" to the webservice, which will be located in a different computer.
-The webservice needs to have access to a couple of the "Stroke" members,
run some algorithms, and modify a member of the Stroke instance. The
modified Stroke instance needs to be sent back to the "Client" (the
consumer)

Nov 16 '05 #6

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

Similar topics

1
by: Alex | last post by:
I created a page to show RealEstate Data with images retrived from the MSSQL 2000. I am using a DataGrid control: <asp:datagrid AllowPaging="True" OnPageIndexChanged="Pageindexchanged" > ...
1
by: charliewest | last post by:
Is it possible to use the custom validation control to validate a calendar control via client-side script (in jscript)? I'm familiar with custom validation and client side script, and i am aware...
5
by: Christian Hvid | last post by:
What is the easiest way to get the "row object" or "item object" when a datagrid is clicked? I have web form with a datagrid. And I have an array of something called BlogEntry that I bind to the...
3
by: hellrazor | last post by:
Hi there, I'm very new to dot net programming and webservices programming. I've managed to create simple webservices so far. Here's my problem: -I've been given a project which needs to...
2
by: cathywigzell | last post by:
I have a web service which exposes a method... public Object Invoke(Object obj) { ... } both the input param and the return value objects can, in reality, be anything. Howver, if I call...
2
by: prabhupr | last post by:
Hi Folks I was reading this article (http://www.dotnetbips.com/articles/displayarticle.aspx?id=32) on "Custom Attribute", written by Bipin. The only thing I did not understand in this article...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
5
by: Frederick Gotham | last post by:
If we have a simple class such as follows: #include <string> struct MyStruct { std::string member; MyStruct(unsigned const i) {
2
by: Okko Willeboordse | last post by:
To get the "code object" c of my_class I can do; c = compile(inspect.getsource(my_class), "<script>", "exec") This fails when inspect can't get hold of the source of my_class, for instance...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.