Problem solve Get help with specific problems with your technologies, process and projects.

Dynamic WS client using the DII

I need to write a dynamic client using the DII for Web services that has complex Java objects as parameters and return types. Apache Axis and Apache WSIF supply examples of dynamic clients, but that is only for Web services that return simple Strings or primitives. My biggest problem is I can't have complex objects. I have no control over what the Web services users would call.
The JAX-RPC DII interface passes an Object in and returns an Object. You must tell JAX-RPC how to map the Objects to XML. When using complex types, you either need to pass simple types, provide a JavaBeans class, or provide a customer serializer. This tutorial shows how to use complex types with the DII interface using a holder and JavaBeans class. (starting on page 5) The problem is that you need to a JavaBeans class. Unfortunately, Axis doesn't provide a runtime utility service that can generate a JavaBeans class from WSDL.

If you're trying to do runtime discovery and invocation of a service, you might consider using SAAJ rather than DII. SAAJ which lets you construct and parse the message manually, and you can use JWSDL and a schema parser to dynamically examine the type definitions. Alternatively, you might consider using Systinet WASP, which provides a runtime WSDL2Java service. You pass it a WSDL file (either a URL or an attachment), and it returns a JavaBeans jar file. You can then dynamically configure the service to use the JavaBeans class as described in the article above.

Dig Deeper on Topics Archive

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.