473,464 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Custom Serilalizable Object as WebService Param

I have a custom object that I have written which is serializable. I have
put this object in it's own dll which is referenced by both the WebService
and the Application using it. My problem is the WebService Proxy creates
it's own implementation of my CustomObject which is causing issues.

Is there some way to mark my object to use it's own namespace instead of
using the namespace of the object being recreated by the WebService Proxy?

I have a Public Static Method which is used to instantiate a new object,
load some default values and return the new object to be loaded with the
data before passing it to the webservice. The problem is the WebService
Proxy version of my custom object does not have the Public Static Method on
it. Is there a way to resolve this (besides making the constructor public)?
Jun 28 '06 #1
2 1326
Hi pal, as far as i can understand your problem, i see that the point here is that you have a custom class server-side defined, and that class is used and wrapped by 2 different webservices. The other problem is that you can't use the public static constructor client-side.
Well i hope it helps, here is my answer.
First of all, i think you won't be able to use that constructor, because the wrapped classes (objects autogenerated by the WSDL to use as proxies) only have the properties, as member variables, of the server-side custom class and the default constructor i.e. MyClass().
For the other problem the solution is to modify the reference file, because if you use xml namespaces you will continue with the same problem. To explain this let's use an example:
Suppose that you have defined a Serializable MyClass, and two webservices MyService1 and MyService2, and both use MyClass. Then, when you generate the proxies you have MyService1.MyClass and MyService2.MyClass as not compatible or casteable client-side classes. So what you have to do is to edit the reference.cs of one of the webreferences (remember to push the "See all files" button to see this file in the Solution Explorer). Now, in the file, delete de wrapper class MyClass and a "using" directive (using MyClientProject.MyService1;), and the problem is solved, MyClass will be unique for both webservices.

Hope it helps, Bye.
---
Posted via www.DotNetSlackers.com
Jul 4 '06 #2
The public static functionality makes sense as WSDL is simple by design...
My questions is on a slightly different path though. I'm only working with
a single WebService (at this point). I was mainly looking for some
attribute tag or Interface which can be declared in my Serializable
class/object which would cause both the WebService and the Proxy class
generated by WSDL to use the same namespace of my custom object (similar to
a DataSet or a DataTable). This way my client side app which consumes the
WebService can expect the object as intantiated in the WebService instead of
the one created by the Proxy Class via WSDL. In other words when returning
something of type DataTable from a WebService, the Proxy Class actually
creates a return type of System.Data.DataTable and not
CustomWebService.Proxy.DataTable.

<Sebastian Ca?uetowrote in message
news:eC*************@TK2MSFTNGP02.phx.gbl...
Hi pal, as far as i can understand your problem, i see that the point here
is that you have a custom class server-side defined, and that class is
used and wrapped by 2 different webservices. The other problem is that you
can't use the public static constructor client-side.
Well i hope it helps, here is my answer.
First of all, i think you won't be able to use that constructor, because
the wrapped classes (objects autogenerated by the WSDL to use as proxies)
only have the properties, as member variables, of the server-side custom
class and the default constructor i.e. MyClass().
For the other problem the solution is to modify the reference file,
because if you use xml namespaces you will continue with the same problem.
To explain this let's use an example:
Suppose that you have defined a Serializable MyClass, and two webservices
MyService1 and MyService2, and both use MyClass. Then, when you generate
the proxies you have MyService1.MyClass and MyService2.MyClass as not
compatible or casteable client-side classes. So what you have to do is to
edit the reference.cs of one of the webreferences (remember to push the
"See all files" button to see this file in the Solution Explorer). Now, in
the file, delete de wrapper class MyClass and a "using" directive (using
MyClientProject.MyService1;), and the problem is solved, MyClass will be
unique for both webservices.

Hope it helps, Bye.
---
Posted via www.DotNetSlackers.com

Jul 5 '06 #3

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

Similar topics

0
by: Thomas D. | last post by:
Situation: --------------------------- I have an 'export'-wrapper to my regular objects. For each regular object there is also an export object. An export object derives from the regular object...
5
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...
1
by: Sky Sigal | last post by:
(PS: Cross post from microsoft.pulic.dotnet.framework.aspnet.webcontrols) I've been looking lately for a way to keep the Properties panel for Controls 'clean'... My goal is to keep similar...
5
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
3
by: | last post by:
Hi all, I have a question on reflection Lets say I have a custom object called Address. Now, lets say I have a string variable that holds the name of a variable in the object such as...
0
by: Brian Henry | last post by:
Ok I've never implemented a snap location before so I dont really know what im doing wrong here... anyways, I am making a custom slider control that takes dates as its values instead of integers......
8
by: Techno_Dex | last post by:
Has anyone come up with a slick way to make Custom Serializable Objects to behave like DataSets when using WebServices? What I'm looking for is some way to force the WSDL generated code to create...
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...
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,...
1
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.