XSD is missing an element

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • huohaodian@gmail.com

    XSD is missing an element

    Hi,

    I am a new to web service world. For the leaning purpose, I have
    created a web service in 2005 with one asmx.cs file, in this file, I
    have one method called GetUser() which returns a custom user object,
    something like

    [WebMethod]
    public User GetUser()

    When I run it from IDE, I noticed after clicking the Service
    Description link that the XSD for my custom object user is missing an
    element id, which is a read only property of object, and it would
    shown if change it to read write.
    1. Why this is happening? any way I can manually or explicitly set the
    XSD for my class object?
    2. It seems that asp.net automatically generate wsdl for me, any way I
    can control the content and element of it?

    Thanks in advance.
  • John Saunders

    #2
    Re: XSD is missing an element

    <huohaodian@gma il.comwrote in message
    news:92022c77-42ed-4179-a545-0e794012fbc8@p2 5g2000hsf.googl egroups.com...
    Hi,
    >
    I am a new to web service world. For the leaning purpose, I have
    created a web service in 2005 with one asmx.cs file, in this file, I
    have one method called GetUser() which returns a custom user object,
    something like
    >
    [WebMethod]
    public User GetUser()
    >
    When I run it from IDE, I noticed after clicking the Service
    Description link that the XSD for my custom object user is missing an
    element id, which is a read only property of object, and it would
    shown if change it to read write.
    1. Why this is happening?
    The XML Serializer only works with public read/write properties. Since your
    property is read-only, it will be ignored.
    any way I can manually or explicitly set the
    XSD for my class object?
    2. It seems that asp.net automatically generate wsdl for me, any way I
    can control the content and element of it?
    Yes. You don't need to have .NET generate the WSDL and schemas for you. You
    can create your own by hand. The only problem is that there is no way that I
    know of to "plug in" to what ASP.NET does when it sees "?WSDL". You will
    have to turn off the "?WSDL" functionality by removing the <documentatio n>
    protocol in web.config.


    --
    John Saunders | MVP - Connected System Developer

    Comment

    • huohaodian@gmail.com

      #3
      Re: XSD is missing an element

      On Jul 11, 11:19 am, "John Saunders" <n...@dont.do.t hat.comwrote:
      <huohaod...@gma il.comwrote in message
      >
      news:92022c77-42ed-4179-a545-0e794012fbc8@p2 5g2000hsf.googl egroups.com...
      >
      Hi,
      >
      I am a new to web service world. For the leaning purpose, I have
      created a web service in 2005 with one asmx.cs file, in this file, I
      have one method called GetUser() which returns a custom user object,
      something like
      >
      [WebMethod]
      public User GetUser()
      >
      When I run it from IDE, I noticed after clicking the Service
      Description link that the XSD for my custom object user is missing an
      element id, which is a read only property of object, and it would
      shown if change it to read write.
      1. Why this is happening?
      >
      The XML Serializer only works with public read/write properties. Since your
      property is read-only, it will be ignored.
      >
      any way I can manually or explicitly set the
      XSD for my class object?
      2. It seems that asp.net automatically generate wsdl for me, any way I
      can control the content and element of it?
      >
      Yes. You don't need to have .NET generate the WSDL and schemas for you. You
      can create your own by hand. The only problem is that there is no way that I
      know of to "plug in" to what ASP.NET does when it sees "?WSDL". You will
      have to turn off the "?WSDL" functionality by removing the <documentatio n>
      protocol in web.config.
      >
      --
      John Saunders | MVP - Connected System Developer

      Thanks a lot for the helps.

      For some reasons I couldn't find the <documentationi n the web.cofig
      file, and I am not sure how would asp.net handles after removing the ?
      wsdl functinality.

      Thanks again.

      Comment

      Working...