I have two web service functions which have the exact same interface (calling from C#/Winform application):
string[] f1(int, string[]) and string[] f2(int, string[])
to which I’m sending the exact same data. When I call f1, it works just fine and returns a string[], however, when I call f2, I get a SOAPException saying that the “input string is not a correct format”.
What could be causing one to work and the other not to work?
private void backgroundWorkerUploadNew_DoWork(object sender, DoWorkEventArgs e)
{
List<String> submittedList = new List<String>();
StreamReader reader = new StreamReader(this.textBoxFilename.Text);
String data;
while ((data = reader.ReadLine()) != null)
{
submittedList.Add(data);
}
reader.Close();
// Send array of handset names to service
int channelId = 0;
string[] listToSubmit = submittedList.ToArray();
channelId = AppStatus.CurrentChannel.ChannelID;
String[] newHandsetsList = service.Function2(channelId, listToSubmit);
...
}
The web service method
public List<String> Function2(int integer, List<String> strings)
{
List<String> newList = new List<string>();
DataTable tempDt = null;
foreach (String s in strings)
{
String q = @"** SOME QUERY **";
tempDt = Database.RunSql(q);
...
}
return newList;
}
That message comes from the Parse method (for numeric types, DateTime, etc.). If the computers are using different cultures, the correct format would be different. If that is the problem, you might be able to solve it by using the invariant culture.