views:

88

answers:

2

Good morning,

I have a bit of a dilemma.

I have a webservice reference in a C# project. That webservice calls upon a method called "PlaceOrder". That object has an property Item that is of type object.

When i create an instance of the webservice client i get a exception with "There was an error reflecting 'Item'.". This is a normal generated webservice reference in .net 3.5.

    OrderServiceClient orderService = new OrderServiceClient();
    orderService.Open(); <== exception occures here
    orderService.Close();

Any help is welcome.

+1  A: 

It has no clue what to expect in that property; have you included [XmlInclude] etc? But object simply doesn't work on a web service.

The ideal answer is to make the web-service much more specific, so it has (for example) a Customer (typed as such). Can you perhaps include an example of what the server-side code looks like for this? I'm surprised that it works at the server...


Re comment; Hmm... if the is 3rd party, this might be very tricky; you might have to resort to either editing the generating code (if XmlInclude works, which I can't guarantee), or hacking the wsdl... not simple. It sounds like you're using the 2.0 web-service reference (wsdl.exe, indirectly). You could also try:

  • WSE3 (wse3wsdl.exe)
  • WCF (in .NET 3.0 and avove; svcutil.exe)
Marc Gravell
Well we have tried to access the webservice with SoapUI, and that works and we get a neat answer back. The main problem is that we can not access the server code, since this is a 3th party application. The 2 objects the service can return are "StatusType" and "string". The status type object has 2 string properties "Status" and "Description".
J. Visser
I'll update...
Marc Gravell
We are using WCF .I just discused this problem with a coworker, and he said that we can change the webservice.
J. Visser
A: 

Ok i did find a solution for this problem.

We managed to change the webservice to give a different response.

I discussed it with my manager and a couple of senior engineers and architects and solved it on a business level.

Since other .net and java applications also use this service (who havent been build yet). So any hack that we need to implement is no sollution to this problem.

To summerize:

  • There is no good sollution for this problem (yet)
  • Always think about how reusable your design is :)

EDIT: I did found out, that if you make the object into a object[] it suddenly works. Why? i dont know.

J. Visser