Saturday, March 24, 2012

Web Service Limitation ?

Hi All,

I am attempting to call a Web Service that has a nested repeating element of the same type as it's parent. Below is a simplified example represented as a class. After successfully creating a WebReference, I attempted to create the service and got the old 'File or assembly name ..., or one if it's dependancies, was not found.' After much research, it appears to be a serializer problem because the exception occurs during the creationg of the service. I am able to call this WebService from other type of clients. Is this a problem of the Framework, Visual Studio or Visual Basic? I am using Framework 1.1, Visual Studio 2003. Can VisualStudio 2005 handle this.

Class Case
CaseDescription as String
CaseNumber as String
ChildCases as Case()
End Class

Ok, I figured this one out. When I added the web reference the following incorrect code was generated in the Reference.vb class. The ChildCases() declaration was incorrectly generated with double parentheses. See corrected code below. I also had to add [] around Case as it is a keyword.

Generated Code:

<System.Xml.Serialization.XmlArrayItemttribute(

GetType(Case), IsNullable:=false)> _
Public ChildCases()()As [Case]

Corrected Code:

<System.Xml.Serialization.XmlArrayItemttribute(

GetType([Case]), IsNullable:=false)> _
Public ChildCases()As [Case]

Thanks

0 comments:

Post a Comment