[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

How to define paramter-types for WebMethods AND Client?

Daniel Barisch

8/22/2003 9:44:00 AM

How to define a class within an external DLL, that can be used as parameter
for a WebMethod and in Client-Projects?

I mean:

<WebService()>
public Class WServer
<WebMethod()>_
Public Function getXYZ(myDataSet as System.DataDataSet) as xyz...
....
end class

= Client =
....
dim ws as new WebServiceProxy.WServer
dim ds as new System.Data.DataSet
dim rc as xyz
rc = ws.getXYZ(ds)

That works fine. But changing the type of "ds" to a class defined in an
external DLL (reference in WebService- and client-project) the following
happens ...

<WebMethod()>_
Public Function getXYZ(myClass As ExternalDLL.MyClass) as xyz ...

dim ws as new WebServiceProxy.WServer
dim ds as new ExterneDLL.MyClass
dim rc as xyz
rc = ws.getXYZ(ds)

>> 'The Value of "ExternalDLL.MyClass" can't be converted to
"WebServiceProxy.MyClass"!' (paramter "ds")

How to get the client clear, that it is exactly the same class? Is there
something special, I have to define in "ExternalDLL.MyClass"
(serialisation)?

Thanks D.Barisch


1 Answer

Christian Weyer

8/22/2003 9:58:00 AM

0

Hi Daniel :-)
http://weblogs.asp.n...posts...
---
Common types and 'Type Fidelity?':
This sample solution shows you how to make it possible to use a common types library (assembly DLL) which holds the types/classes for your tiered applications in a Web Services world. It uses a small helper library which has essentially one method to 'safely' convert the original Web Service proxy's type to your targeted common type.
---


Cheers,
--
Christian Weyer
Microsoft .NET & Service Oriented Architectures

[Microsoft Regional Director, Germany]
http://www.regionaldir...

* XML Web Services: http://www.xmlwebse...
* Weblog: http://weblogs.asp.n...


> How to define a class within an external DLL, that can be used as parameter
> for a WebMethod and in Client-Projects?
>
> I mean:
>
> <WebService()>
> public Class WServer
> <WebMethod()>_
> Public Function getXYZ(myDataSet as System.DataDataSet) as xyz...
> ....
> end class
>
> = Client =
> ....
> dim ws as new WebServiceProxy.WServer
> dim ds as new System.Data.DataSet
> dim rc as xyz
> rc = ws.getXYZ(ds)
>
> That works fine. But changing the type of "ds" to a class defined in an
> external DLL (reference in WebService- and client-project) the following
> happens ...
>
> <WebMethod()>_
> Public Function getXYZ(myClass As ExternalDLL.MyClass) as xyz ...
>
> dim ws as new WebServiceProxy.WServer
> dim ds as new ExterneDLL.MyClass
> dim rc as xyz
> rc = ws.getXYZ(ds)
>
> >> 'The Value of "ExternalDLL.MyClass" can't be converted to
> "WebServiceProxy.MyClass"!' (paramter "ds")
>
> How to get the client clear, that it is exactly the same class? Is there
> something special, I have to define in "ExternalDLL.MyClass"
> (serialisation)?
>
> Thanks D.Barisch
>
>