how to send objects with different namespaces to multiple Web Services

Discussion in 'ASP .Net Web Services' started by IanT, Jun 29, 2004.

  1. IanT

    IanT Guest

    I have a problem where i would like to send the same object to 2 or
    more different webservices which accept objects with exactly the same
    structure. I realise that if we'd been wise we would have used the
    same WSDL for each and i will do for future Development but for the
    moment i have to consume a clients Service and have to make the best
    of what i have.

    The problem seems to be in the namespaces. Even though the objects are
    structurally exactly the same they are obviously treated as different
    types.

    I would like to be able to convert a standard object so i can pass it
    to both Services and hence avoid duplication.

    To get around this i attempted to create a class which inherited from
    a site specific class (from the proxy) and then populated itself from
    a standard object but when i attempt to call the WebMethod i get the
    following error.

    "A first chance exception of type 'System.InvalidOperationException'
    occurred in n-nbnq0s

    Additional information: The type SSS_Generator.schemas.MyType was not
    expected. Use the XmlInclude or SoapInclude attribute to specify types
    that are not known statically."

    This problem is generated by the WebProxy - it never actually gets
    sent to the Web Service.

    At the moment the only solution open to me is to write a function to
    populate the class generated by the WebProxy from another standard
    class which is structurally identical.

    Does anyone have any other ideas?

    many thanks

    Ian
    IanT, Jun 29, 2004
    #1
    1. Advertising

  2. yes, read the article "sharing types" on MSDN from July 2002.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07162002.asp

    That may help.

    More generally, the client's WSDL should be architected so that data schema
    is independent of the interface. The WSDL should import XSD files that
    describe the schema. then you can also have a 2nd WSDL that imports the
    same XSD's, as well as other XSDs.

    If each XSD is defined with its own namespace, then you will be able to
    share the corresponding types across clients, servers, etc.

    -D

    "IanT" <> wrote in message
    news:...
    > I have a problem where i would like to send the same object to 2 or
    > more different webservices which accept objects with exactly the same
    > structure. I realise that if we'd been wise we would have used the
    > same WSDL for each and i will do for future Development but for the
    > moment i have to consume a clients Service and have to make the best
    > of what i have.
    >
    > The problem seems to be in the namespaces. Even though the objects are
    > structurally exactly the same they are obviously treated as different
    > types.
    >
    > I would like to be able to convert a standard object so i can pass it
    > to both Services and hence avoid duplication.
    >
    > To get around this i attempted to create a class which inherited from
    > a site specific class (from the proxy) and then populated itself from
    > a standard object but when i attempt to call the WebMethod i get the
    > following error.
    >
    > "A first chance exception of type 'System.InvalidOperationException'
    > occurred in n-nbnq0s
    >
    > Additional information: The type SSS_Generator.schemas.MyType was not
    > expected. Use the XmlInclude or SoapInclude attribute to specify types
    > that are not known statically."
    >
    > This problem is generated by the WebProxy - it never actually gets
    > sent to the Web Service.
    >
    > At the moment the only solution open to me is to write a function to
    > populate the class generated by the WebProxy from another standard
    > class which is structurally identical.
    >
    > Does anyone have any other ideas?
    >
    > many thanks
    >
    > Ian
    Dino Chiesa [Microsoft], Jun 30, 2004
    #2
    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. PA
    Replies:
    0
    Views:
    388
  2. Alexander Tuchacek
    Replies:
    1
    Views:
    955
    Bjoern Schliessmann
    Nov 25, 2007
  3. Erik Cruz

    Web services and namespaces

    Erik Cruz, Dec 7, 2003, in forum: ASP .Net Web Services
    Replies:
    3
    Views:
    116
    Scott M.
    Dec 9, 2003
  4. John
    Replies:
    4
    Views:
    411
  5. Replies:
    0
    Views:
    184
Loading...

Share This Page