WebMethod and WSDL with optional parameters

Ask a Question related to ASP.NET Web Services, Design and Development.

  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. Similar Questions and Discussions

    1. #40531 [NEW]: mb_substr optional parameters
      From: emwebdev at hotmail dot com Operating system: Windows XP PHP version: 5.2.1 PHP Bug Type: mbstring related Bug...
    2. Making a value-type property optional in WSDL generated by ASP.NET
      Hello all, Is there a way to mark a value-type property on a class as optional when being used as a parameter to a web service? The problem is...
    3. WSDL and Optional Parameters
      Since there's no way to create a c# method with optional, or nullable parameters. And since you can't write an overloaded web method. Is it...
    4. Optional Parameters ASP to SQL stored procedure
      Hi there, Can someone help, this is driving me crazy I have written a stored procedure in sql with input, output and return parameters. This...
    5. Function definition with optional parameters?
      Some of the functions that are part of PHP have optional parameters. Is it possible to define your own function so that it has optional parameters?...
  3. #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" <anonymous@discussions.microsoft.com> schreef in bericht
    news:5AB0DD1B-3AE3-46E8-852E-04240DE1F30D@microsoft.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

Posting Permissions

  • You may not post new threads
  • You may 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