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