pierre betz wrote:
> and, can I call these services wiht jsp pages, just knowing the interfaces
> and the wsdls ?

You can always use wsdl2java to generate stub code that you then call
from within your JSP page in the usual way
(http://cwiki.apache.org/CXF20DOC/developing-a-consumer.html).  But if I
wanted to do this I would probably create the client stubs using Spring
and then pull them from the application context in my JSP page and use
them there, that way you can share a single client across all your pages
rather than creating a new one at every request.  With

<jaxws:client id="helloClient"
              serviceClass="demo.spring.HelloWorld"
              address="http://localhost:9002/HelloWorld"; />

in your Spring configuration file you can then do

HelloWorld client = (HelloWorld)WebApplicationContextUtils
      .getRequiredWebApplicationContext(application)
      .getBean("helloClient");

in your JSP to fetch the shared stub object.

Stepping up onto my own soapbox for a moment... I do wonder why so many
people posting to this list are so anti-Spring.  Spring is a very
powerful tool, and the way it is designed you can just pick and choose
the bits you want.  You don't have to code your application in a
particular way to be Spring-aware, in fact in a well-written application
most of your code shouldn't know (or care) whether Spring is involved or
not.  A CXF example: if your class Foo needs to call a web service
XYZService then it doesn't have to worry about how to create a stub for
the service or where to obtain one from, you just declare a
setXYZService method, and at runtime Spring handles the wiring for you.
 But now if you want to write a unit test for Foo you can easily inject
a mocked XYZService and Foo won't know the difference.

I suppose what I'm trying to say is don't let the size and complexity of
the whole Spring framework scare you off.  The core inversion of control
container (which is all you'll need in many cases) is only a small part
of the whole framework and is well worth, if not mastering, then at
least learning the basics.

I'm sorry, it's late, I'll stop evangelising now :-)

Ian

-- 
Ian Roberts               | Department of Computer Science
[email protected]  | University of Sheffield, UK

Reply via email to