Skip to main content
Omnitracs Knowledge Base

Nested Structures Issues

Web service interoperability between Java and .NET is not foolproof yet. We've encountered a few hassles along the way which prove this out.

One hurdle to overcome revolves around using nested structures in your .NET clients. A structure within a structure within a structure, so to speak. The problem surfaces when you import a WSDL into the .NET project, a WSDL that uses these nested structures. When you run it, you will get an error like:

An unhandled exception of type 'System.InvalidOperationException' occurred in system.web.services.dll

Additional information: Method XTRATTWebSvcsService.mobileOnTrailer can not be reflected.

The way to fix this is to go into your Reference.cs file. Be careful because this file is autogenerated. The change you need to make will need to be made everytime you regenerate the Reference.cs file, which is every time you update the web reference.

Each of the datatypes defined in this Reference.cs file has a "decorator" above the class definition. Something like this:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://websvcs.ttracswebws")]

public class XTRATrailer {

  ... class contents are in here ...

}

In the decorator, you need to change "websvcs" to "datatype".

WHICH structures need this change, I haven't determined yet. I've changed all the structures in my Reference.cs file and it works. I've also removed the change on one or two of the decorations, and it still works. AT LEAST one of the structure definitions will need this change.

I don't yet know why this breaks, or why this fixes it, but that's what you have to do.

  • Was this article helpful?