Skip to Content
Former Member
Jul 18, 2008 at 05:53 PM

SAP Enterprise Service - Cast Exception


Hi folks,

I'm currently working on a project to implement a project that consumes an SAP web service, but I've come across an error that I'm finding difficult to solve. Composing an independent project I'm able to successfully consume the web service. However, when I transfer the same code to the main project, using the same steps to add a web reference in visual studio 2005, I get an InvalidCastException when the service is called:

ERROR: System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidCastException: Unable to cast object of type '' to type ''.

The proxy code in Reference.cs is the same in both instances, and I've made sure the web.config in the new project has the correct settings. Does anyone have an idea of what may be going on? Or has anyone encountered this error before? Any help is much appreciated!