Re: Exporting embeded objects passed in object[] parameters

Tech-Archive recommends: Speed Up your PC by fixing your registry



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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:E289420E-F359-4365-90E6-5116DB38A5E9@xxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:288F8E1C-64AF-4F8B-BE45-18DDD2287A20@xxxxxxxxxxxxxxxx
> 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




.



Relevant Pages