Professional Web Applications Themes

WebMethod and WSDL with optional parameters - ASP.NET Web Services

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...

  1. #1

    Default WebMethod and WSDL with optional parameters

    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 Guest

  2. #2

    Default Re: WebMethod and WSDL with optional parameters

    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: [url]http://weblogs.asp.net/jan[/url]

    "PMCG" <anonymousdiscussions.microsoft.com> schreef in bericht
    news:5AB0DD1B-3AE3-46E8-852E-04240DE1F30Dmicrosoft.com...
    > 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 Guest

Similar Threads

  1. #40531 [NEW]: mb_substr optional parameters
    By emwebdev at hotmail dot com in forum PHP Bugs
    Replies: 1
    Last Post: February 18th, 08:18 AM
  2. Replies: 0
    Last Post: August 4th, 04:48 AM
  3. WSDL and Optional Parameters
    By WHY in forum ASP.NET Web Services
    Replies: 16
    Last Post: August 10th, 08:47 AM
  4. Optional Parameters ASP to SQL stored procedure
    By ross in forum ASP Database
    Replies: 0
    Last Post: May 25th, 02:53 PM
  5. Function definition with optional parameters?
    By Phester in forum PHP Development
    Replies: 4
    Last Post: September 28th, 09:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139