473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Protocols.ScalarFormatter

Hi, All,
I have a web method like this:

[WebMethod]
public string test(int32 i)
{
return i.ToString();
}

and If I pass an empty string to test it by using HTTP POST I got the
following error:

System.ArgumentException: Cannot convert Test to System.Int32.
Parameter name: type ---> System.FormatException: Input string was not in a
correct format.
at System.Number.ParseInt32(String s, NumberStyles style,
NumberFormatInfo info)
at System.String.System.IConvertible.ToInt32(IFormatP rovider provider)
at System.Convert.ChangeType(Object value, Type conversionType,
IFormatProvider provider)
at System.Web.Services.Protocols.ScalarFormatter.From String(String value,
Type type)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.ScalarFormatter.From String(String value,
Type type)
at
System.Web.Services.Protocols.ValueCollectionParam eterReader.Read(NameValueC
ollection collection)
at System.Web.Services.Protocols.UrlParameterReader.R ead(HttpRequest
request)
at System.Web.Services.Protocols.HttpServerProtocol.R eadParameters()
at System.Web.Services.Protocols.WebServiceHandler.In voke()
at System.Web.Services.Protocols.WebServiceHandler.Co reProcessRequest()

This is due to the WebServices framework tries to parse the empty string
into integer which it will be a problem. I tried to use SoapExtension to
modify the SoapMessage before it's deserialized but unfortunately this event
in ProcessMessage happens after the above parameter conversion. Is there
anyway to override this behavior?

I want change the parameter to 0 if it's empty string - where can I do it? I
know we can implement a HTTP handler to get the stream and modify from there
but that's too low level.

Hope MSFT provide an attribute you can apply for that :)

Thanks a lot!

Nov 21 '05 #1
0 1221

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexander Schumann | last post by:
Hello everyone, We are building a new web based e-mail client "Fiezel" that will support IMAP, POP3 and SMTP protocols. Will be written in php4. I am trying to collect all the infomation on SNMP...
0
by: Erik Max Francis | last post by:
Is there any prohibition against mixing different protocols within the same pickle? I don't see anything about this in the Python Library Reference and, after all, the pickle.dump function takes a...
3
by: Efrat Regev | last post by:
Hello, I was wondering whether there are any Python modules for various Internet protocols, e.g., is there something similar to import ftp client = ftpopen(...) and so on.
7
by: rdh | last post by:
Hi all, I am in process of developing a Server in C++ supporting multiple protocols. The server will be exposing various functionalities, and the clients can communicate over any of the...
2
by: Mark Olbert | last post by:
I'm looking to create a blogging component (or find one) that would basically be a "drop in" on an ASP.NET page (i.e., I don't want full blown blog theme management and page configuration...
1
by: Mae Lim | last post by:
Dear all, I'm having problem with C# Web Services, in the Web Services it suppose to call another Web Services to return XmlNode to current Web Services. Below is the sample code :- ...
3
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : ...
1
by: jayhunters14 | last post by:
Hi everyone, i am an undergrad in physics.my thesis is about GPRS.i have a wireless module that sets up a connection to the internet. when i connect to the web server it can communicate using http...
0
by: John H | last post by:
Hi, have read quite a few articles http://www.devx.com/codemag/Article/33655/0/page/6 http://msdn.microsoft.com/en-us/library/bb332338.aspx and still slightly confused as to what protcols can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.