I am having an issue where I am attempting to pass a non-primitive (and user defined) data type into a WebMethod. Is there a certain way to do this? Here is an example of my code:
[WebMethod]
public bool GetTableRecordCnt(int i, String str, DateTime? lastUpdatedDate, UserDefinedType udt, out FDT_SCHEDULER_STATUS[] schedulerTable)
{
//code
}
When I try to call this function from my client application I get the following error:
“Unable to read data from the transport connection.”
If I replace the UserDefineType parameter with a primitive data type (an int for example) the client is able to get a response from the WebMethod.
Thanks in advance for you help.
EDIT:
Calling code from client application:
UserDefinedType udt = new UserDefinedType();
UserDefinedType1[] tableRecords = ThisApplication.FillArray();
bool result = WebServiceReferenceName.GetTableRecordCnt(1, "tableName", "10/10/2010 12:00:00", udt, out tableRecords);
That is a gross oversimplification of the parameters that are being passed to the web method, but the data that is in each parameter is what would be passed.
OK, so finding out what the problem is has finally given me some relief =)
Apparently there is a limit to the number of characters that a variable can be named when you pass a UserDefinedType to a web method. After testing with each piece that I added for this new function in my code. I found that shortening the following variable name:
to:
is now allowing data to be passed between my windows mobile application and the c# web service. GO FIGURE!
Now, does anyone know if there is a specific numeric limit to the number of characters that can be used to name a variable in a UserDefinedType that will be passed to a Web Method, or could this be an environment issue on my end?