BIG problem when sending complex datatype to a webservice

F

Flare

OK. I'll try explain my problem so simple as possible.

I have to send a complex data type to a WebService from a Asp.net
webapplication.

My Data type look like this. (A class with a porperty)

-------------
namespace Elsam.Turabs.ClassLibraries.TurabsLogExeption{
[Serializable]
public class TurabsExceptionCarrier
{
public TurabsExceptionCarrier()
{}

private DateTime m_TimeOccured = DateTime.MinValue;
public DateTime TimeOccured
{
public DateTime TimeOccured
{
set { m_TimeOccured = value; }
get { return m_TimeOccured; } }}
-------------

A method in my webservice rescives this TurabsExceptionCarrier object like
this:
[WebMethod]
public void SaveExceptionToDB(TurabsExceptionCarrier TEC)

In my Asp.net application i have to instantiate a TurabsExceptionCarrier
object, fill it, and send it to my webservice method....

I do this by creating a webreference with Visual studio .net 2003. BUT. the
proxy class's TurabsExceptionCarrier object and the one in my ASP.net
application is in diffrent namespaces now, and is therefor apperently not
compatible. hmmmmmm. Right it try to force them in same namespace...Bang. No
i have to diffenitions on TurabsExceptionCarrier.

the ONLY solution i have found is to make the webreference and manually
remove the TurabsExceptionCarrier wich is created in my proxy. But tha means
i have to do this every time i update my webreference.

Was that clear at all?

REALLY hope someone has a solution.

Regards
Anders, Denmark
 
F

Flare

I think that manually editing Proxys is needed in most cases.

It just seems quite.....stupid....

Anders
 
D

Darren Mombourquette

The problem is becuase when you generate your proxy the type
definition falls under your proxy class namespace. You should use this
type instead when passing it up to the webservice. The webservice will
figure the rest out.
We had the same problem when we tried to create an assembly that
contained nothing but type definitions on both the client side and the
server side. But because the proxy puts the types in it's own
namespace we couldn't pass our known type in the assembly to the proxy
because it expected it's own type in it's own namespace.
So simply expose your webservice and create a proxy for it. Then on
the client use the type definition for your object that will be
created within the proxy namespace.
If you absolutly need them to fall in the same namespace you will have
to modify the proxy each time you re-generate it. To modify the proxy
simply delete your type definition from it and add a 'using
MyAssembly' at the top of the class.

Darren Mombourquette.
 
F

Flare

The problem is becuase when you generate your proxy the type
definition falls under your proxy class namespace. You should use this
type instead when passing it up to the webservice. The webservice will
figure the rest out.
We had the same problem when we tried to create an assembly that
contained nothing but type definitions on both the client side and the
server side. But because the proxy puts the types in it's own
namespace we couldn't pass our known type in the assembly to the proxy
because it expected it's own type in it's own namespace.
So simply expose your webservice and create a proxy for it. Then on
the client use the type definition for your object that will be
created within the proxy namespace.
If you absolutly need them to fall in the same namespace you will have
to modify the proxy each time you re-generate it. To modify the proxy
simply delete your type definition from it and add a 'using
MyAssembly' at the top of the class.

Ok. Could sound like an solution. Ill try that tomorrow on work. Thx alot
for now :)

Anders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top