0

I have to apologize the question does not fully address my issue. This is a C# issue dealing with passing a UDT object to a c# webservice. The client end is a windows mobile forms application.

I currently have a UDT that I personally defined and have now added a new member to (a variable named schedulerRecordCount, the property is named SchedulerRecordCount). Before adding this new member I was able to pass an instance of this object to a web service method without issue. After adding the new member I was unable to get a response from my web method. After calling the webmethod and passing the object I would get an exception that says "unable to read from the transport connection".

I tried many things to trouble shoot, and in a last-ditch effort, I shorted the variable name to schedRecCnt and the property to SchedRecCnt. This did the trick. As a note, all of the other members of this UDT are of type String (as well as my new member).

Does anyone know of a limitation to the number of characters that a variable can have when being passed inside of a UDT to a web method?

TheDevOpsGuru
  • 1,570
  • 5
  • 21
  • 36
  • I'm sure this is similar for variable/property names: http://stackoverflow.com/questions/425988/maximum-method-name-length – SwDevMan81 Nov 18 '10 at 21:45
  • The maximum named in an answer there is 511 characters. The value of schedulerRecordCount.Length is 20... I am not following your comment, if you don't mind could you be a little more specific? – TheDevOpsGuru Nov 18 '10 at 21:51
  • 1
    I'm just saying that the variable/property name length should be very large (SchedulerRecordCount is definitely acceptable). There must be some other issue going on. – SwDevMan81 Nov 18 '10 at 21:53
  • Do you think that it could be some sort of environment limitation related to using Windows Mobile on my client side? – TheDevOpsGuru Nov 18 '10 at 21:55
  • What kind of serialization are you using? – Bryan Nov 18 '10 at 21:56
  • 2
    It might be a max message size issue. Can you determine the serialized size before and after you added the new property? – SwDevMan81 Nov 18 '10 at 22:02

2 Answers2

3

There is of course some limit to the length of identifiers, but you are certainly not even close to it. I don't know the exact limit, but perhaps 1000 characters or so.

You might however have reached the limit for the total size of the message that is returned. That would fit with how shortening the property name makes it work, as that would shorten the total length of the message also.

In the settings for the SOAP binding in web.config on the client, check the value of the MaxReceivedMessageSize property, and increase it if needed.

Guffa
  • 687,336
  • 108
  • 737
  • 1,005
  • When I go to search for this property in MSDN this property is only available to .NET frameworks 3.0 to 4.0 not 2.0. Both my webservice and client are built on the 2.0 framework. Any other ideas? – TheDevOpsGuru Nov 19 '10 at 12:44
3

There is no limit imposed by C# specs but Visual Studio IDE will colorize only

511 characters in C# and 1023 characters in VB.Net (leaving other characters black).

Ken D
  • 5,880
  • 2
  • 36
  • 58