Announcement Announcement Module
Collapse
No announcement yet.
Dynamic web service client question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic web service client question

    I am attempting to write an application that will dynamically invoke a web service and process the response. That is, the user will enter a WSDL location and my application must discover the services and complex parameter types involved, present the user with a way to choose which service to call and map their data into the input parameters, invoke the web service and then map the output back into into some user area so they can use it.

    The loosely-coupled scheme from spring-ws makes sense in a lot of ways, but it seems to me that presenting the user with a Java object representing the input/output types would sure make it easier for them to manage the data. The spring-ws client samples that I have found seem to work great when the client is written with a specific service in mind, i.e. it's easy to hardcode a specific Xpath path when you know what the XML will look like, but not so easy to make those paths on the fly.

    One option I am considering is to use Axis2 to generate the parameter classes when the user enters the WSDL. Then the user can use those classes to populate from their the data, and I can use one of the marshaling techniques with those classes to invoke the service. Does this seem reasonable?

    So my question(s) are: Are there samples that deal with this issue? Are there any best practices concerning writing a client who doesn't know details of the service until runtime? Does spring-ws offer a way for me to parse the WSDL so that I wouldn't need to use Axis2? Or am I on the wrong path altogether?

    Thanks in advance.

    - Jon

  • #2
    Spring-WS currently does not have a sample which does this, but I think it could be possible. THe key thing is to be able to generate classes at runtime, and use these classes in combination with the marshalSendAndReceive() functionality found on the template.

    One way to do it would be to wire up the JAXB2 code generator as spring bean. The xjc tool found in the JAXB distribution is just a front end to this. Then, at runtime, generate classes to some temporary location, compile them, and use them with the template.

    Comment


    • #3
      Thanks for the response, it seems reasonable. I'll look into that and let you know how it goes!

      Comment

      Working...
      X