473,406 Members | 2,378 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,406 software developers and data experts.

Error: System.ArgumentException: Cannot convert to System.Int32.

I have created a web service, which when I call in my browser presents the
text form etc. When I click the button, I get this error:

System.ArgumentException: Cannot convert 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(NameValu
eCollection
collection)
at
System.Web.Services.Protocols.HtmlFormParameterRea der.Read(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
seems to happen only when I have parameters of different data types, e.g.:

Works:
======
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As String) As
DataSet

Causes Error:
===========
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As Integer) As
DataSet

Any ideas/suggestions will be much appreciated.

Regards,

Simon.

--
I am using the free version of SPAMfighter for private users.
It has removed 2053 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
Nov 19 '05 #1
2 10867
Hi Simon,

Are you able to show some of the code that is calling this Web service?

If the SOAP defaults the type to a string, your Web service is going to have
the problem you're seeing if it expects an integer.

Ken
MVP [ASP.NET]

"Simon Harris" <to***********@makes-you-fat.com> wrote in message
news:Ol**************@TK2MSFTNGP15.phx.gbl...
I have created a web service, which when I call in my browser presents the
text form etc. When I click the button, I get this error:

System.ArgumentException: Cannot convert 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(NameValu
eCollection
collection)
at
System.Web.Services.Protocols.HtmlFormParameterRea der.Read(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
seems to happen only when I have parameters of different data types, e.g.:

Works:
======
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As String) As
DataSet

Causes Error:
===========
<WebMethod()> _
Public Function GetAddresses(ByVal a As String, ByVal b As Integer) As
DataSet

Any ideas/suggestions will be much appreciated.

Regards,

Simon.

--
I am using the free version of SPAMfighter for private users.
It has removed 2053 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!

Nov 19 '05 #2
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi Simon,

Are you able to show some of the code that is calling this Web service?

If the SOAP defaults the type to a string, your Web service is going to
have the problem you're seeing if it expects an integer.

Ken
MVP [ASP.NET]


Hi Ken,

I solved it earlier - You were correct, it was expecting an Int, I was
passing it null.

Many Thanks for your reply.

Simon.
Nov 19 '05 #3

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

Similar topics

0
by: Simon Harris | last post by:
I have created a web service, which when I call in my browser presents the text form etc. When I click the button, I get this error: System.ArgumentException: Cannot convert to System.Int32....
1
by: VB Programmer | last post by:
On this line of code: objStreamReader = File.OpenText(FILENAME) I get this error: URI formats are not supported. Description: An unhandled exception occurred during the execution of the...
16
by: | last post by:
Hi all, I have a website running on beta 2.0 on server 2003 web sp1 and I keep getting the following error:- Error In:...
20
by: MadCrazyNewbie | last post by:
Hey group, I keep getting the following error: "An unhandled exception of type 'System.IndexOutOfRangeException' occurred in system.data.dll Additional information: There is no row at...
3
by: Will Chamberlain | last post by:
I am running into a strange error when I try debugging my current application. A form loads up with a dynamically-populated textbox full of software titles. Upon selection of a software title and...
2
by: Dabbler | last post by:
I'm getting the following error when I try and insert a row using FormView, ObjectDataSource and stored procedure. The form has 40+ columns on it and I'm not sure how to diagnose where the problem...
0
by: Angel | last post by:
I created a Dataset Type on one project which generates a DLL. I have a web project . I created a webpage with a gridview. I attached an ObjectDatasource to the Dataset type from my other project....
1
by: sranger | last post by:
When I try to use a System.IO.Ports.SerialPort object to read from a serial port, half of the time I have no problems. However, after I successfully read from the serial port, then close the...
1
by: GS | last post by:
I am perplexed . I thought it is easy to fix the binding error on cvtDtFrom. I only used the cvtDtFrom a couple of places but I found out the error occurred before form loading. I tried...
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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.