spring + tomcat + axis2 == jax-ws web service? - java

I'm looking for a straightforward example / tutorial for implementing a JAX-WS (soap1.1 and soap1.2) web service based on wsdl definition using spring, axis2 and tomcat.
hint anyone ?
-- Yonatan

There is no such thing as "straightforward" in the world of SOAP. Any example and tutorial is bound to be complex due to the overengineered nature of this beast.
If you can choose your technologies, I'd recommend putting axis aside, and using Tomcat 6 + Java 6 + Metro. Metro is Sun's latest, greatest Java web services (jax-ws) stack. Coupled with JavaEE annotations, it's a relatively painless way to get a web service off the ground quickly.
Sorry to not answer the question directly.

Unfortunately, even the latest version of Metro has issues with tomcat and JDK6
I tried running the sample app on my machine and documented few issues I faced and resolved.
For others benefit please check here :
Running Metro + Tomcat 6 + JDK 6

The NetBeans IDE is good place to start. Enable the Axis2 Support in NB plug-ins. You can create a JAX-WS based Web Service from the WSDL (assuming you are using contract first) and the JAX-WS based WS client too. If you dont like what NetBeans generates or its deployment strategy, you can still build upon the code that it has generated

Axis2 does not support Spring web services when using Jax-WS. See this mailing list post:
http://markmail.org/message/hohdmsupo3r3gltl?q=list:org%2Eapache%2Ews%2Eaxis-user+spring+jax-ws
To do this you will need a custom module to add a BeanFactory into the MessageContext and then retrieve it out in your web service. Or you might write a custom dispatcher.

Related

How to decide on what framework to use in Java Web Service?(SOAP)

I am fairly new in Java EE web service. Right now we have a project to create an API web service that connects to a database and do some retrieve and write functions.
I've heard about the following:
Axis
Struts
Spring
Can someone please enlighten me as to what framework is applicable for the said project? I've tried Google of course but I need opinion on people who have experience on the said framework.
BTW we are going to create a SOAP web service. Additional tips are also appreciated.
Note that Java has the JAX-WS API which is a technology for building web services and clients that communicate using XML. In JAX-WS, a web service operation invocation is represented by an XML-based protocol, such as SOAP.
From the frameworks you mentioned, Spring brings SpringWS which you can use to build a SOAP web service.
However i don't know about Struts 2 core api offering any SOAP capabilities.
But it can be extend with other plugins that handle SOAP.
Axis (use the latest, Axis 2) is a good choice for SOAP. It is a Web Services / SOAP / WSDL engine. It also has some support for the Spring Framework.
There is also Apache CXF. It is the most widely used Web Services Standard Now; Improvement over AXIS2, which is now gradually being replaced by Apache CXF
If you need help deciding between them, read this comparison (Apache CXF vs. Apache AXIS vs. Spring WS) for the pros and cons.
There's also this great answer about cxf and axis 2.

CXF and standalone web services

I'm currently writing a few applications that contain web service clients and servers, as complete standalone applications, eg without any web application server / servlet engine. I'm using plain Java 6, and for the "server" part I'm using the sun HttpServer. Working like a charm.
(actually I am using CXF, but only for their wsdl2java tool, which is more flexible than the one that ships with Java 6).
I've been wondering now if there is any benefit for me to look at frameworks like CXF. Strangely enough, I can't find any information on the CXF web site on such a scenario, they just seem to blindly assume that everybody uses an applications server (and worse, maven).
One of the reasons why I'm looking at CXF is that in the near future I expect that I need to support AIX as well, and there I can't use:
reqcontext.put(BindingProviderProperties.CONNECT_TIMEOUT, connect_timeout);
reqcontext.put(BindingProviderProperties.REQUEST_TIMEOUT, request_timeout);
CXF has this thing called an HTTPClientPolicy which would nicely fit the bill.
Does anybody have any links to articles discussing using CXF without any application server / servlet engine? Are there any other benefits that CXF could give me over the current Java 6 JAX-WS implementation?
Maarten
Almost all the samples that come in the CXF distribution are setup specifically as a "main method" type service that starts up the service and clients and such as standalone applications without any use of an app server (or even Tomcat). The CXF samples would be a good place to start.
That said, they do all use Maven now. :-)

Java 1.3 Websphere 5 application -> need call SOAP 1.1 or SOAP 1.2 web service

I have old application that works in Websphere 5 with Java 1.3.
I cannot change Java version or app server version.
I need to add to this application code that will call web service.
AFAIK target web service supports both SOAP 1.1 and SOAP 1.2.
Unfortunately I have only little experience with WS clients. Some time ago I wrote WS client using Java 5. It was very simple, I used wsimport tool that generated all necessary classes from WSDL.
But, as I understand, Java 1.3 and Websphere 5 doesn't have such possibility. Words like JAX-WS and JAXB are related to the latest java versions.
Could someone please provide me with some guide (or just advise :)) what should I do?
Thanks in advance!
Some suggestions though I haven't tried them out:
Look into Apache Axis and try
out the tutorials
Read a similar
question for more suggestions in
case the first one doesn't work out
WebSphere 5 does not support Axis. If you have related WebSphere Studio you can easily create SOAP client using wizard. Maybe WebSphere 5 have command line tool like wsimport

WCF Self-Hosting capabilities in Java

Hi guys is there a way to self-host a web service in Java just like WCF?
Jersey using Grizzly embedded within it would seem like a good fit for your needs. It wouldn't require and outside application server and would be fairly lightweight to get setup. You can just read the Jersey getting started documents to get going with that exact path:
Jersey User Guide
If by self-hosting you mean generating a web service endpoint for invocation, there are a number of ways to go on this, depending on your potential deployment environment.
I'd start off looking at Oracle's JAX-WS implementation, which includes RESTful capabilities. If you want to run a relatively simple stack, you could use Apache Axis2. And then JBoss has JBossWS, which can run standalone or in the JBoss Application Server. I'm pretty sure most of the major application server engines have a Web Services component as well.

Are there any OSGi web service / SOAP clients out there?

I'm looking for any webservice client that can be run inside an OSGi container and connect to a simple web service using SOAP, doesn't sound so hard does it?
Oh, and it has to work under Java 1.5, so the JRE jax-ws wont be present.
The problem is I've tried a few solutions now, and although each solution works in standard Java using it from within OSGi doesn't.
the springsource JAX-WS bundles seem to have dependency issues
the CXF bundles get me as far as calling the service, but then can seem to find the stub methods in the proxy
Is there anyone out there who has successfully created an OSGi webservice client?
try to use Apache CXF Distributed OSGi (1) that is a reference implementation of OSGi Remote Services Specification.
Regards,
Dmytro
(1): http://cxf.apache.org/distributed-osgi.html

Categories

Resources