473,672 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
+ 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 1350
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.MyCl ass and MyService2.MyCl ass 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.Dat aTable and not
CustomWebServic e.Proxy.DataTab le.

<Sebastian Ca?uetowrote in message
news:eC******** *****@TK2MSFTNG P02.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.MyCl ass and MyService2.MyCl ass 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
1890
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 and has for each property in the base object an extra boolean property. That extra properties tells wether to include the base property in the final export (= webservice) or not. That is because not all the properties may be exposed all the time...
5
5144
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 have a proprietary algorithm split into a webservice.
1
1694
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 public properties of a custom Control neatly tied together -- rather than all over the IDE. One such set of values that will rarely be changed, so should have little priority in the IDE Properties panel, and therefore a good candidate for
5
6908
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
12
5324
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 the custom employee class and have built it as a separate library (employee.dll). This employee.dll is being referenced by both the web service and the windows application. I face the following problem when I send this class to the webservice.
3
1759
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 "State.StateCode". How can I reflect upon the Address object so as to echo the value contained in the string variable. Something like:- Dim add as new Address add.State.StateCode = "TX" Dim str as string = "State.StateCode"
0
1903
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... then taking that date range and finding dates specifiec between them (in a list of dates) and putting snap marks, so if you slide it near one of them it should snap to that tick, but that part i cant figure out. the rest seems ok so far... here...
8
1821
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 a reference to my custom object's namespace instead of creating it's own copy of the object in it's own WS namespace. Either that, or some easy way to move all of the properties from the Custom Serializable Object into the WSDL generated object...
9
3786
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 techniques are not feasible) The question is; Given that I have a Person object with a private set for id. What is the recommended approac in passing that object to the web service
0
8503
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
8944
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
8844
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
8640
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
7469
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6254
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5720
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
4439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1835
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.