BIG problem when sending complex datatype to a webservice

Discussion in 'ASP .Net' started by Flare, Oct 30, 2003.

  1. Flare

    Flare Guest

    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
     
    Flare, Oct 30, 2003
    #1
    1. Advertising

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

    "Flare" <> wrote in message
    news:...
    > 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
    >
    >
    >
     
    Chris Brooksbank, Oct 31, 2003
    #2
    1. Advertising

  3. Flare

    Flare Guest

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

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

    Anders
     
    Flare, Oct 31, 2003
    #3
  4. 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" <> wrote in message news:<>...
    > 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
     
    Darren Mombourquette, Nov 8, 2003
    #4
  5. Flare

    Flare Guest

    > 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
     
    Flare, Nov 9, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff
    Replies:
    2
    Views:
    1,155
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Apr 16, 2007
  2. Shaguf
    Replies:
    0
    Views:
    363
    Shaguf
    Dec 24, 2008
  3. Shaguf
    Replies:
    0
    Views:
    459
    Shaguf
    Dec 26, 2008
  4. Shaguf
    Replies:
    0
    Views:
    245
    Shaguf
    Dec 26, 2008
  5. Flare
    Replies:
    4
    Views:
    179
    Flare
    Nov 9, 2003
Loading...

Share This Page