473,224 Members | 1,383 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,224 software developers and data experts.

Exporting embeded objects passed in object[] parameters

Hello,

I'm writing a service using VS2005 and C#. I've found that only the objects
used as parameters in WebMethods get exported to proxy dlls and the Service
Description. I'd like my service clients to be able to use the objects I've
defined in messages to the service and send them as "object" parameters or as
embeded items in other objects.

I can work around the problem by declaring all of the objects as public
members of a dummy class and then putting a dummy WebMethod on my service
class that takes a reference to the dummy class. If I do this the xml Service
Description contains all of the type information and WSDL.EXE emits the
correct information into the proxy dll. It occurs to me, though, that there
must be some type of directive or something that lets you tell the proxy and
Service Description generator that you want certain items included in their
output.

Can anyone tell me the correct way to do this?

Thanks
Al

--
Al
Feb 1 '07 #1
4 1611
"Al" <Al@discussions.microsoft.comwrote in message
news:28**********************************@microsof t.com...
Hello,

I'm writing a service using VS2005 and C#. I've found that only the
objects
used as parameters in WebMethods get exported to proxy dlls and the
Service
Description. I'd like my service clients to be able to use the objects
I've
defined in messages to the service and send them as "object" parameters or
as
embeded items in other objects.

I can work around the problem by declaring all of the objects as public
members of a dummy class and then putting a dummy WebMethod on my service
class that takes a reference to the dummy class. If I do this the xml
Service
Description contains all of the type information and WSDL.EXE emits the
correct information into the proxy dll. It occurs to me, though, that
there
must be some type of directive or something that lets you tell the proxy
and
Service Description generator that you want certain items included in
their
output.

Can anyone tell me the correct way to do this?
I don't understand. You have defined some classes which are not used as
parameters to or return types from your web service. Yet you want the
clients of your web service to be able to use them? What will they be using
them _for_?

John
Feb 2 '07 #2
Let's say you have a customer object that includes finance information and
inventory information. In this case the customer object has a reference to a
finance object and an inventory object. The client creates and initializes a
finance object and an inventory object. Then it creates the client object and
initializes the client object with the finance and inventory object.

The web method signature might be

class ClientInfo
{
FinanceInfo financeInfo;
InventoryInfo inventoryInfo;
}

[WebMethod(EnableSession = true)]
public void SendClientInfo(ClientInfo clientInfo)
{
...
}

This is an example; whether or not you'd design the class hierarchy like
this isn't important.

FinanceInfo and InventoryInfo won't appear in the proxy dll or the document
description.

I hope this answers your question. At least they don't in mine.
--
Al
"John Saunders" wrote:
"Al" <Al@discussions.microsoft.comwrote in message
news:28**********************************@microsof t.com...
Hello,

I'm writing a service using VS2005 and C#. I've found that only the
objects
used as parameters in WebMethods get exported to proxy dlls and the
Service
Description. I'd like my service clients to be able to use the objects
I've
defined in messages to the service and send them as "object" parameters or
as
embeded items in other objects.

I can work around the problem by declaring all of the objects as public
members of a dummy class and then putting a dummy WebMethod on my service
class that takes a reference to the dummy class. If I do this the xml
Service
Description contains all of the type information and WSDL.EXE emits the
correct information into the proxy dll. It occurs to me, though, that
there
must be some type of directive or something that lets you tell the proxy
and
Service Description generator that you want certain items included in
their
output.

Can anyone tell me the correct way to do this?

I don't understand. You have defined some classes which are not used as
parameters to or return types from your web service. Yet you want the
clients of your web service to be able to use them? What will they be using
them _for_?

John
Feb 2 '07 #3
I believe that you will need decorate all the classes with the attributes
XmlRootAttribute (in the main class) and XmlElementAttribute (in the
subclasses).

"Al" <Al@discussions.microsoft.comwrote in message
news:E2**********************************@microsof t.com...
Let's say you have a customer object that includes finance information and
inventory information. In this case the customer object has a reference to
a
finance object and an inventory object. The client creates and initializes
a
finance object and an inventory object. Then it creates the client object
and
initializes the client object with the finance and inventory object.

The web method signature might be

class ClientInfo
{
FinanceInfo financeInfo;
InventoryInfo inventoryInfo;
}

[WebMethod(EnableSession = true)]
public void SendClientInfo(ClientInfo clientInfo)
{
...
}

This is an example; whether or not you'd design the class hierarchy like
this isn't important.

FinanceInfo and InventoryInfo won't appear in the proxy dll or the
document
description.

I hope this answers your question. At least they don't in mine.
--
Al
"John Saunders" wrote:
>"Al" <Al@discussions.microsoft.comwrote in message
news:28**********************************@microso ft.com...
Hello,

I'm writing a service using VS2005 and C#. I've found that only the
objects
used as parameters in WebMethods get exported to proxy dlls and the
Service
Description. I'd like my service clients to be able to use the objects
I've
defined in messages to the service and send them as "object" parameters
or
as
embeded items in other objects.

I can work around the problem by declaring all of the objects as public
members of a dummy class and then putting a dummy WebMethod on my
service
class that takes a reference to the dummy class. If I do this the xml
Service
Description contains all of the type information and WSDL.EXE emits the
correct information into the proxy dll. It occurs to me, though, that
there
must be some type of directive or something that lets you tell the
proxy
and
Service Description generator that you want certain items included in
their
output.

Can anyone tell me the correct way to do this?

I don't understand. You have defined some classes which are not used as
parameters to or return types from your web service. Yet you want the
clients of your web service to be able to use them? What will they be
using
them _for_?

John
Feb 2 '07 #4
Thanks for your reply, Mariano. I tried different combinations of the
attributes you mentioned without any success. Here's a simplified version of
what I'd like to do. If I could get this working I could probably figure out
the embeded versions. I have the following classes and method declared
inside my WebService derived class:

[XmlRootAttribute]
public class Type1 {
string Name_;
public string Name {
get { return Name_; }
set { Name_ = value; }
}
}
[XmlRootAttribute]
public class Type2 {
string Name_;
public string Name {
get { return Name_; }
set { Name_ = value; }
}
}
[WebMethod(EnableSession = true)]
public object[] GetExportObjects() {
Type1 t1 = new Type1();
t1.Name = "Pozo";
Type2 t2 = new Type2();
t2.Name = "Lucky";
object[] objects = new object[] {t1, t2};
return objects;
}

Neither Type1 nor Type2 show up in my web document. I tried this with
various properties (e.g., "ElementName") but it didn't have any affect.

I'd appreciate any other suggestions you might have.

--
Al
"Mariano Omar Rodriguez" wrote:
I believe that you will need decorate all the classes with the attributes
XmlRootAttribute (in the main class) and XmlElementAttribute (in the
subclasses).

"Al" <Al@discussions.microsoft.comwrote in message
news:E2**********************************@microsof t.com...
Let's say you have a customer object that includes finance information and
inventory information. In this case the customer object has a reference to
a
finance object and an inventory object. The client creates and initializes
a
finance object and an inventory object. Then it creates the client object
and
initializes the client object with the finance and inventory object.

The web method signature might be

class ClientInfo
{
FinanceInfo financeInfo;
InventoryInfo inventoryInfo;
}

[WebMethod(EnableSession = true)]
public void SendClientInfo(ClientInfo clientInfo)
{
...
}

This is an example; whether or not you'd design the class hierarchy like
this isn't important.

FinanceInfo and InventoryInfo won't appear in the proxy dll or the
document
description.

I hope this answers your question. At least they don't in mine.
--
Al
"John Saunders" wrote:
"Al" <Al@discussions.microsoft.comwrote in message
news:28**********************************@microsof t.com...
Hello,

I'm writing a service using VS2005 and C#. I've found that only the
objects
used as parameters in WebMethods get exported to proxy dlls and the
Service
Description. I'd like my service clients to be able to use the objects
I've
defined in messages to the service and send them as "object" parameters
or
as
embeded items in other objects.

I can work around the problem by declaring all of the objects as public
members of a dummy class and then putting a dummy WebMethod on my
service
class that takes a reference to the dummy class. If I do this the xml
Service
Description contains all of the type information and WSDL.EXE emits the
correct information into the proxy dll. It occurs to me, though, that
there
must be some type of directive or something that lets you tell the
proxy
and
Service Description generator that you want certain items included in
their
output.

Can anyone tell me the correct way to do this?

I don't understand. You have defined some classes which are not used as
parameters to or return types from your web service. Yet you want the
clients of your web service to be able to use them? What will they be
using
them _for_?

John
Feb 2 '07 #5

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

Similar topics

5
by: Andy | last post by:
Hi Could someone clarify for me the method parameter passing concept? As I understand it, if you pass a variable without the "ref" syntax then it gets passed as a copy. If you pass a...
48
by: Andrew Quine | last post by:
Hi Just read this article http://www.artima.com/intv/choices.html. Towards the end of the dicussions, when asked "Did you consider including support for the concept of immutable directly in C#...
0
by: Elliot M. Rodriguez | last post by:
I implemented a very small, basic data access layer for my web application. It works just fine, except for this one bug. One of my methods returns an abstracted dataset. To accomodate X number of...
14
by: Niklas | last post by:
Hi What I have learned is that a variable is just a reference when dealing with Objects. Are you supposed to use ByVal or ByRef in functions? They produce the same result or have I missed...
1
by: BobRoyAce | last post by:
I have a class that has several Subs that do DB things, some of which require the same set of parameters to be passed to a stored procedure. One class has 12 parameters and part of code used to...
20
by: walterbyrd | last post by:
Reading "Think Like a Computer Scientist" I am not sure I understand the way it describes the way objects work with Python. 1) Can attributes can added just anywhere? I create an object called...
4
by: Deckarep | last post by:
Hello fellow C# programmers, This question is more about general practice and convention so here goes: I got into a discussion with a co-worker who insisted that as a general practice all...
0
by: Al Santino | last post by:
Hello, I'm writing a service using VS2005 and C#. I've found that only the objects used as parameters in WebMethods get exported to proxy dlls and the Service Description. My service clients can...
11
by: MikeT | last post by:
This may sound very elementary, but can you trap when your object is set to null within the object? I have created a class that registers an event from an object passed in the constructor. When...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

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.