WebMethod and WSDL with optional parameters

Discussion in 'ASP .Net Web Services' started by PMCG, Mar 2, 2004.

  1. PMCG

    PMCG Guest

    Hi
    If i have a simple web service lik
    [WebMethodAttribute()
    public string DoIt(string Name, int Age

    return ""

    and i look at the WSDL i get
    element minOccurs="0" for the string parameter but element minOccurs="1" for the int parameter
    I cannot find any of the Serialization attributes that i could use on the string parameter to indicate it should occour at least once

    If anyone has a solution for this i would appreciate your hel
    Pat
     
    PMCG, Mar 2, 2004
    #1
    1. Advertising

  2. PMCG

    Jan Tielens Guest

    This is because a string is a reference type and a int is a value type.

    I don't know how you could control this... But I think it doesn't make sense
    to change this. Consider this (normal) function:
    public TestMe(string p)
    {}

    There is no way you could prevent an empty string to be passed...

    --
    Greetz,
    Jan
    ________________________
    Read my weblog: http://weblogs.asp.net/jan

    "PMCG" <> schreef in bericht
    news:...
    > Hi,
    > If i have a simple web service like
    > [WebMethodAttribute()]
    > public string DoIt(string Name, int Age)
    > {
    > return "";
    > }
    > and i look at the WSDL i get
    > element minOccurs="0" for the string parameter but element minOccurs="1"

    for the int parameter.
    > I cannot find any of the Serialization attributes that i could use on the

    string parameter to indicate it should occour at least once.
    >
    > If anyone has a solution for this i would appreciate your help
    > Pat
     
    Jan Tielens, Mar 2, 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. Daniel Barisch

    How to use own classes as WebMethod-Parameters?

    Daniel Barisch, Aug 19, 2003, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    169
    Simon Smith
    Sep 1, 2003
  2. Alin Popovici

    Carriage Return in WebMethod parameters

    Alin Popovici, Jan 8, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    305
    Jan Tielens
    Jan 9, 2004
  3. Darren via .NET 247

    Mandatory WebMethod parameters

    Darren via .NET 247, May 5, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    445
    Dino Chiesa [Microsoft]
    May 5, 2004
  4. Bryan
    Replies:
    0
    Views:
    179
    Bryan
    Aug 4, 2005
  5. Enda Mannion

    best way to publish webmethod parameters and return data

    Enda Mannion, Jun 15, 2009, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    777
    Enda Mannion
    Jun 15, 2009
Loading...

Share This Page