Web Service, arrays and HTTP POST method

A

adlionel

Hi,

I'm using .net Framework 2.0 Beta 2.

I've developed a Web Service in C#. One of the Web Methods of this web
service takes a string array as parameter. With SOAP call it's working
flawessly with both empty and non empty arrays.

Now I want to call this web service with POST (from a classic ASP
client). When my string array is not empty there is no problem (for
example A=value1&A=value2). But when this array is empty (let's call it
A), I'm passing no A parameter in the "POST query string" (sounds logic
for me). Then the following error occurs:

System.NullReferenceException: Object reference not set to an instance
of an object. at
System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection
collection) at
System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest
request) at
System.Web.Services.Protocols.HttpServerProtocol.ReadParameters() at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

So my question is : is this error a .Net bug? Or shall I provide a
specific syntax to explicitly tell that the A array is empty?

If this is a bug, is it corrected in the .net 2.0 final version or is
there a way to avoid it? (I don't want to pass A=&otherparam as empty
string for a specific array entry is different of an empty array)

Thanks for your answers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top