By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,918 Members | 1,662 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,918 IT Pros & Developers. It's quick & easy.

BIG problem when sending complex datatype to a webservice

P: n/a
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

Nov 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I think that manually editing Proxys is needed in most cases.

"Flare" <dc*******@hotmail.com> wrote in message
news:uW**************@TK2MSFTNGP10.phx.gbl...
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

Nov 17 '05 #2

P: n/a
> I think that manually editing Proxys is needed in most cases.

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

Anders
Nov 17 '05 #3

P: n/a
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.

"Flare" <dc*******@hotmail.com> wrote in message news:<uW**************@TK2MSFTNGP10.phx.gbl>...
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

Nov 17 '05 #4

P: n/a
> 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
Nov 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.