I can't access some classes, but can access others in the same namespace, why?

Discussion in 'ASP .Net Web Services' started by ThunderMusic, Feb 21, 2007.

  1. ThunderMusic

    ThunderMusic Guest

    Hi,
    I have many classes a user may need to call methods on my webservice. Some
    classes are "published" and some are not... I mean, when we do a Web
    reference from another project, we don't have access to some classes
    remotely... Is there something special these classes need so we can use
    them remotely?

    There's an example at the end of the post

    Here, Result is accessible, but ContactData is not... and there are others
    that are not accessible that are not IXmlSerializable, so it's not problem
    (at least, I don't think so)

    Anyone have an idea of what it could be? (btw, everything compiles, all
    types exist in the same namespace)

    And another question... I have exactly the same problem with some enum...
    what are the specs about this? is there a link I could find the info?

    Thanks

    ThunderMusic

    here's an example :
    // This is the web service itself
    [WebService(Namespace = "http://myserv.com/S/NS")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class Contacts : System.Web.Services.WebService
    {
    #region Web Service Methods

    [WebMethod(Description = "Create a Contact.")]
    public Result Create(RemoteID ID, ProjectID Project, ContactData Contact)
    {
    return new Result(true, false);
    }
    }

    in another file, I have all this (all in the same namespace, and in the same
    file) :
    [WebService(Namespace = "http://myserv.com/S/NS")]
    public class Result
    {
    private bool m_Success = true;
    private bool m_AuthenticationError = false;
    private ErrorCodes m_ErrorCode = ErrorCodes.NoError;
    private int m_AffectedRows = 0;

    public bool Success { get { return m_Success; } set { m_Success =
    value; } }
    public bool AuthenticationError { get { return m_AuthenticationError; } set
    { m_AuthenticationError = value; } }
    public ErrorCodes ErrorCode { get { return m_ErrorCode; } set { m_ErrorCode
    = value; } }
    public int AffectedRows { get { return m_AffectedRows; } set {
    m_AffectedRows = value; } }
    }

    [WebService(Namespace = "http://myserv.com/S/NS")]
    public class ContactData : IXmlSerializable
    {
    private List<ContactDataItem> m_ContactDataItems = new
    List<ContactDataItem>();
    [XmlIgnore()]
    public List<ContactDataItem> ContactDataItems { get { return
    m_ContactDataItems; } }

    #region IXmlSerializable Members
    [...] // my IXmlSerializable implementation
    #endregion
    }
     
    ThunderMusic, Feb 21, 2007
    #1
    1. Advertising

  2. ThunderMusic

    ThunderMusic Guest

    ok, we f ound out for the enum that if they are not used (or used by a class
    we can't see), we don't have access to it (the enum)

    So now we must know how to make those classes accessible... So, are
    Generics supported? if they are not, is there a workaround? Are there any
    other consideration to take care?

    thanks

    ThunderMusic

    "ThunderMusic" <> wrote in message
    news:...
    > Hi,
    > I have many classes a user may need to call methods on my webservice. Some
    > classes are "published" and some are not... I mean, when we do a Web
    > reference from another project, we don't have access to some classes
    > remotely... Is there something special these classes need so we can use
    > them remotely?
    >
    > There's an example at the end of the post
    >
    > Here, Result is accessible, but ContactData is not... and there are
    > others that are not accessible that are not IXmlSerializable, so it's not
    > problem (at least, I don't think so)
    >
    > Anyone have an idea of what it could be? (btw, everything compiles, all
    > types exist in the same namespace)
    >
    > And another question... I have exactly the same problem with some enum...
    > what are the specs about this? is there a link I could find the info?
    >
    > Thanks
    >
    > ThunderMusic
    >
    > here's an example :
    > // This is the web service itself
    > [WebService(Namespace = "http://myserv.com/S/NS")]
    > [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    > public class Contacts : System.Web.Services.WebService
    > {
    > #region Web Service Methods
    >
    > [WebMethod(Description = "Create a Contact.")]
    > public Result Create(RemoteID ID, ProjectID Project, ContactData Contact)
    > {
    > return new Result(true, false);
    > }
    > }
    >
    > in another file, I have all this (all in the same namespace, and in the
    > same file) :
    > [WebService(Namespace = "http://myserv.com/S/NS")]
    > public class Result
    > {
    > private bool m_Success = true;
    > private bool m_AuthenticationError = false;
    > private ErrorCodes m_ErrorCode = ErrorCodes.NoError;
    > private int m_AffectedRows = 0;
    >
    > public bool Success { get { return m_Success; } set { m_Success =
    > value; } }
    > public bool AuthenticationError { get { return m_AuthenticationError; }
    > set { m_AuthenticationError = value; } }
    > public ErrorCodes ErrorCode { get { return m_ErrorCode; } set {
    > m_ErrorCode = value; } }
    > public int AffectedRows { get { return m_AffectedRows; } set {
    > m_AffectedRows = value; } }
    > }
    >
    > [WebService(Namespace = "http://myserv.com/S/NS")]
    > public class ContactData : IXmlSerializable
    > {
    > private List<ContactDataItem> m_ContactDataItems = new
    > List<ContactDataItem>();
    > [XmlIgnore()]
    > public List<ContactDataItem> ContactDataItems { get { return
    > m_ContactDataItems; } }
    >
    > #region IXmlSerializable Members
    > [...] // my IXmlSerializable implementation
    > #endregion
    > }
    >
    >
     
    ThunderMusic, Feb 22, 2007
    #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. Èý¹â
    Replies:
    1
    Views:
    573
    William F. Robertson, Jr.
    Jul 29, 2003
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,994
    Smokey Grindel
    Dec 2, 2006
  3. Spiros Bousbouras
    Replies:
    9
    Views:
    345
    David T. Ashley
    Dec 19, 2006
  4. Replies:
    1
    Views:
    269
    Victor Bazarov
    Oct 19, 2005
  5. Travis
    Replies:
    3
    Views:
    362
Loading...

Share This Page