2

I'm trying to consume a SOAP service (Agile PLM webservice) using C#, but the SOAP service uses a "Datahandler" type, which seems to be language specific to Java (using Apache Axis library as far as I can tell).

When I try to use the wsdl.exe tool to create a proxy class, it fails due to not having a type for this datahandler. Can anybody suggest how to (cleanly, efficiently) consume this SOAP service without having to hand code a proxy class or manually deal with the SOAP messages in C#?

Aerik
  • 2,307
  • 1
  • 27
  • 39

2 Answers2

2

You can only use classes consisting of serializable basic types via WebServices... Otherwise there is no way the client could know what that kind of data means. I think your datahandler consists of more than raw data structures...

You could wrap the data in your datahandler in a servicable "view" class like:

class datahandlerView
{
    string a;
    string b;
    List<MyOtherView> list;
}

You can usually just send that over via SOAP and JaxWS if the lists and types are more or less basic Java types. They must be serializable to XML. Don't expose Entities (like from JPA or Hibernate) directly on your WS Endpoint - at least if you have to - be sure that all entity-associations are marked as eager (otherwise the WS call will fail at runtime). Hope that helps.

Nathan Ridley
  • 33,766
  • 35
  • 123
  • 197
Obiwan007
  • 646
  • 1
  • 8
  • 20
  • BTW, which versions of the server-side software are you using? IN particular, which Apache and JaxWS versions are you using? – John Saunders Nov 04 '11 at 20:41
  • Yes, that's the exact problem - I don't know what's in that datatype and I can't change the service that's providing it. It's the "out of the box" SOAP service from Agile PLM. Maybe if I could call the SOAP service I could look at what it sends back with Wireshark or something... – Aerik Nov 08 '11 at 19:10
1

First of all, unless you're stuck using .NET 2.0, you shouldn't be using WSDL.EXE. You should be using SVCUTIL.EXE or "Add Service Reference".

In any case, that wouldn't help you consume this broken web service.

Some versions of Apache services that I have seen effectively assume that the consumer is also running Java, and in fact, that it already knows about these data types. That's just plain broken, and cannot be fixed, except by the vendor of the broken web service.

I was under the understanding that later versions of Apache fixed these problems by including the definition of these types in the WSDL.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
  • Consuming many 'enterprise' Java web services in .net is a painful, painful experience for this very reason. – mavnn Nov 04 '11 at 20:37
  • Again, it's stupidity on the part of the Apache people. I hope it has been fixed by now, in which case the OP will only need to upgrade. – John Saunders Nov 04 '11 at 20:40
  • This is a brand new installation of Agile PLM. Unfortunately, I'm not sure what version of server, etc. are being used. I think in any case that their SOAP service would still use a "datahandler" type, which .Net doesn't recognize. – Aerik Nov 04 '11 at 22:34
  • The fact it's .NET doesn't matter. They need to describe the XML that they want to send for their dataHandler type. – John Saunders Nov 04 '11 at 23:07