Issues with web references and proxy classes.

Discussion in 'ASP .Net Web Services' started by Joe G, May 3, 2004.

  1. Joe G

    Joe G Guest

    Good Morning;

    When the WSDL.exe and/or webreference generates a proxy class for a webservice which receives/returns a custom object the class representation within the proxy class is incomplete. When the proxy class imports the object definition it leaves the root node attributes off the object root node which causes the code to blow up. (below is the example). Is there a way to foce the inclusion of the root node definition from the object class? Seems sloppy to have to modify the proxy class and/or include code to fix the root node (on very bottom). Any help would be very very appreciated.

    There are 2 ways to solve the problem I know of which neither I like and was wondering if anyone knew a better solution.

    Proxy class modification....

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://MySchema.Name";)]
    [System.Xml.Serialization.XmlRoot(Namespace"http://MySchema.Name";)] // <--- I HAD TO ADD THIS TO MAKE IT
    public class Entities {
    // ..............
    }

    //------------------------------------------------------------------------
    // Code change
    //------------------------------------------------------------------------
    XmlRootAttribute xmlRoot = new XmlRootAttribute();
    XmlAttributes attrs = new XmlAttributes();
    XmlAttributeOverrides overrides = new XmlAttributeOverrides();
    xmlRoot.Namespace = "http://MySchema.Name";;
    attrs.XmlRoot = xmlRoot;
    overrides.Add(typeof(KeyIDAccess.Entities), attrs);
    serializer = new XmlSerializer(typeof(KeyIDAccess.Entities), overrides);
    //
    //------------------------------------------------------------------------
    Joe G, May 3, 2004
    #1
    1. Advertising

  2. See my reply to your post of 29 April.

    I am having trouble understanding just what you are doing, and what is going
    wrong. I am guessing that others on this group are having similar
    troubles, and this is why you got no response the first time 'round. It's
    not that no-one saw your post (so re-posting the exact msg does not help).
    It's that we don't get it.

    We're here to help but you need to spell it out more simply to us,
    sometime.s
    -D

    "Joe G" <> wrote in message
    news:...
    > Good Morning;
    >
    > When the WSDL.exe and/or webreference generates a proxy class for a

    webservice which receives/returns a custom object the class representation
    within the proxy class is incomplete. When the proxy class imports the
    object definition it leaves the root node attributes off the object root
    node which causes the code to blow up. (below is the example). Is there a
    way to foce the inclusion of the root node definition from the object class?
    Seems sloppy to have to modify the proxy class and/or include code to fix
    the root node (on very bottom). Any help would be very very appreciated.
    >
    > There are 2 ways to solve the problem I know of which neither I like and

    was wondering if anyone knew a better solution.
    >
    > Proxy class modification....
    >
    >

    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://MySchema.Name";
    )]
    > [System.Xml.Serialization.XmlRoot(Namespace"http://MySchema.Name";)] //

    <--- I HAD TO ADD THIS TO MAKE IT
    > public class Entities {
    > // ..............
    > }
    >
    > //------------------------------------------------------------------------
    > // Code change
    > //------------------------------------------------------------------------
    > XmlRootAttribute xmlRoot = new XmlRootAttribute();
    > XmlAttributes attrs = new XmlAttributes();
    > XmlAttributeOverrides overrides = new XmlAttributeOverrides();
    > xmlRoot.Namespace = "http://MySchema.Name";;
    > attrs.XmlRoot = xmlRoot;
    > overrides.Add(typeof(KeyIDAccess.Entities), attrs);
    > serializer = new XmlSerializer(typeof(KeyIDAccess.Entities), overrides);
    > //
    > //------------------------------------------------------------------------
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    Dino Chiesa [Microsoft], May 4, 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. Roger Leigh
    Replies:
    8
    Views:
    420
    Karl Heinz Buchegger
    Nov 17, 2003
  2. Replies:
    3
    Views:
    438
    Victor Bazarov
    Nov 10, 2004
  3. Karsten Wutzke
    Replies:
    1
    Views:
    871
    Steven Simpson
    Aug 20, 2007
  4. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    139
    Alejandro Molina
    Jul 15, 2004
  5. yoxoman
    Replies:
    0
    Views:
    207
    yoxoman
    Dec 31, 2011
Loading...

Share This Page