473,806 Members | 2,795 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1636
"Al" <Al@discussions .microsoft.comw rote in message
news:28******** *************** ***********@mic rosoft.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(Enabl eSession = 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.comw rote in message
news:28******** *************** ***********@mic rosoft.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
XmlRootAttribut e (in the main class) and XmlElementAttri bute (in the
subclasses).

"Al" <Al@discussions .microsoft.comw rote in message
news:E2******** *************** ***********@mic rosoft.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(Enabl eSession = 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.comw rote in message
news:28******* *************** ************@mi crosoft.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:

[XmlRootAttribut e]
public class Type1 {
string Name_;
public string Name {
get { return Name_; }
set { Name_ = value; }
}
}
[XmlRootAttribut e]
public class Type2 {
string Name_;
public string Name {
get { return Name_; }
set { Name_ = value; }
}
}
[WebMethod(Enabl eSession = true)]
public object[] GetExportObject s() {
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., "ElementNam e") 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
XmlRootAttribut e (in the main class) and XmlElementAttri bute (in the
subclasses).

"Al" <Al@discussions .microsoft.comw rote in message
news:E2******** *************** ***********@mic rosoft.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(Enabl eSession = 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.comw rote in message
news:28******** *************** ***********@mic rosoft.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
36419
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 variable with the "ref" syntax then it gets passed as a reference to the object and any changes to
48
3535
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# and the CLR?" Anders' reply included this comment: "The concept of an immutable object is very useful, but it's just up to the author to say that it's immutable."
0
2757
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 input parameters, I created a function signature that accepts a ParamArray of SqlParameters as well as the name of the stored proc. In the body of the function I loop through the param array and append each object to the Parameters collection of...
14
1543
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 something? Regards /Niklas Public Class Main Shared Sub Main() Dim testPropObj As New MyPropertObject testPropObj.MyInt = 1
1
2424
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 create them is shown below: Dim SQLParam(12) As SqlClient.SqlParameter SQLParam(0) = New System.Data.SqlClient.SqlParameter With SQLParam(0) .ParameterName = "@pkUserIDOriginal"
20
1905
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 point, then I can add attributes any time, and at any place in the program? 2) Are classes typically created like this: class Point:
4
2817
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 objects should be passed by reference using the ref keyword generally speaking because as the writer of code you are conveying your intentions that an Object should/can be modified by your function.
0
927
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 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 workaround the problem by declaring all of the objects in a dummy class and then putting a dummy WebMethod...
11
3272
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 my object is destroyed, I want my object to un-register this event. If I don't then the object would never be destroyed until the object I passed in the constructor is destroyed. I have implemented a Dispose(), Dispose(bool), and ~Finalize...
0
9599
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
10624
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
10371
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...
0
10111
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7650
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
6877
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
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4330
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
3
3010
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.