Using JAX-WS RI of java 6 under heavy load - java

I have recently started with web services. In my project, I have to create a client side using wsdl provided.
I have implemented the client part using JAX-WS RI which is available as part of Java 6.
Now when I was going through some blogs, they mentioned that we should not use JAX-WS of java, as it is just an reference implementation and
we have to go for libraries like Apache CXF or Axis2.
Could you please advice if we can use JAX-WS RI of java in production ?
At the moment with JAX-WS RI of Java, our client application testing is going on without any issues. Will it create any problem if we use it under high load ?
Thanks,
Vijay

Related

How to call a JSON Rest web service with Tomee 1.6

My application is running on a Tomee plus 1.6 JEE server.
I need to call a RS WS that will return an object formatted as a JSon string.
I can do that with an openConnection("url"), and a manual parsing of the response. But I think there is a much higher way to do that in a JEE environment.
The problem is that I found many tutorials about how to write a Restful WS, but very few about how to invoke them. Moreover, eachtime, there are several libraries to add to the Tomee server (Jackson, ...).
My questions are :
is there any standard way to invoque a WS with no library to add ? I think there must be one because Tomee plus is supposed to be a full JEE server.
how to do that ?
Thanks for your help.
If you are not on tomee 7 but still tomee 1 you can use CXF WebClient to do that. TomEE 7 would let you use standard JAX-RS 2 client (part of EE 7) but was not in TomEE 1 (EE 6)
There are plenty of options to consume REST applications in Java nowadays. The current standard is the JAX-RS Client API, released in JAX-RS 2.0, and it's part of the Java EE 7 API.
Important: Once your are using Apache TomEE 1.6.0, which is Java EE 6 certified, the JAX-RS Client API won't be available for you. Keep reading.
JAX-RS Client API
The JAX-RS Client API (javax.ws.rs.client package), defined in the JSR 339 and released as part of the Java EE 7 API, is the standard way to consume REST web services in Java. Besides others, this specification is implemented by Jersey, RESTEasy and Apache CXF.
Vendor specific proxy frameworks
Both Jersey, RESTEasy and Apache CXF also provide a proxy framework API. Those APIs are vendor specific and are not part of the JAX-RS Client API.
The basic idea is you can attach the standard JAX-RS annotations to an interface, and then implement that interface by a resource class on the server side while reusing the same interface on the client side by dynamically generating an implementation of that using java.lang.reflect.Proxy calling the right low-level client API methods.
For more details check the following:
Jersey proxy-based client API
RESTEasy proxy-based client API
Apache CXF proxy-based client API
Other resources
Here are some other options that you could consider as alternative to the JAX-RS Client API:
Apache CXF WebClient API †
Spring RestTemplate
OkHttp
Retrofit
Netflix Feign
† Apache CXF WebClient API: It's shipped with the Apache TomEE 1.6.0. In the cxf-rt-frontend-jaxrs.jar you are going to find the WebClient class, which is the entry point to the client API.
Thank you very much for your help.
Finally, I decided to use the standard JAX-RS API, but as it was not released yet in Tomee 1.6, I had to add a jar file in the lib directory of the server :
javax.json-1.0.4.jar, which I downloaded from Oracle web site.
To compile my project, I had to use an other jar file : javax.json-api-1.0.4.jar
Since you have mentioned that you are using TomEE plus 1.6, you already have JAX-RS client (Ref: Apache TomEE) which can be used to access REST WS.
The javax.ws.rs.client can be used to invoke the REST service and receive the response. More detailed tutorial can be found on Oracle Site.
EDIT: Missed the version number part. The API is available in 1.7.

Difference between JAX-WS, Axis2 and CXF

What is the difference between:
JAX-WS
Axis2
CXF
All three can be used to create webservices in Java.
As of I know JAX-WS is a specification and Axis2 and CXF are implementations, but Java 1.6 has implementation of JAX-WS if I am not wrong.
So one can use Java 1.6 to develop JAX-WS web services without using Axis2 or CXF? Then what is the use of Axis2, CXF?
The JAX-WS implementation built into the JDK really is just the basic soap stuff. If you need any of the more complex WS-* things like WS-Security, WS-RM, WS-Policy, etc..., you need to use one of the alternatives like CXF or Metro or Axis2. It can also depend on what you are trying to integrate with. For example, CXF has top notch Spring support as well as very good OSGi support.
CXF also has other things besides just JAX-WS. It has a compliant JAX-RS implementation as well and supports exposing services as both REST and SOAP very well. Has a W3C compliant SOAP/JMS implementation if that type of things is required. Basically, lots of stuff not available from the in-jdk JAX-WS impl.
Also see:
Difference between Apache CXF and Axis
In short.
WSDL WS-* are language-agnostic.
JAX-WS are Java standard to build web service.
Apache CXF and Apache Axis 2 are two implementations of JAX-WS. They also offer JAX-RS implementations so that you can build Restful services.
CXF has better integration with Spring, and Camel(camel-cxf). And Axis 2 seems not have a active release.
I found with CXF - integration with Spring is very easy. Moreover, It provides various features like:
Customization of Logging features
Inbound and Outbound interceptor
Application Level security
Easy Exception handling using custom Fault.
For more detail, if you want, please checkout this link:
http://predic8.com/axis2-cxf-jax-ws-comparison.htm
http://www.ibm.com/developerworks/java/library/j-jws11/
And, I read above links, its preety helpful for me. I hope it works for u too.
Thanks !
Web Service organization reles some guidelines i.e BP(Basic Profile) 1.0 and BP(Basic Profile) 1.1.
Base on the Guidelines All Language(Java/.Net) people release Specification with Default implementation
In java Base on BP 1.0 Specification Is JAX-RPC And 1.0 Specification Is JAX-WS
JAX-WS Default implementation is RI(Reference Implementation)
Base on the requirement/Choice we can change the implementation(RI/AXIS-2/CXF)
When we are using java 1.6 that case in JDK already available so not required any other jar. If you want to use different implementation that case required particular implememtation jar.
Axis-2 and CXF come from Apache

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

standalone java webservice client

I am new to webservices in general. I am trying to write a Java stand-alone client which can get a response back from a webservice.
I tried searching SO and Google but now I got more confused. The below are the links I went through extensively.
Simple (standalone) Java SOAP web service client from WSDL using Maven
Java webservice (soap) client - use certificates
java webservice client
https://cwiki.apache.org/CXF20DOC/how-do-i-develop-a-client.html
Java Webservice Client (Best way)
Steps in creating a web service using Axis2 - The client code
I have a url like: http://api.something.com/remote/wsdl/SomeEncryptedText
I also have a SOAP request something like:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<AuthUsername>someName#someWhere.com</AuthUsername>
<AuthPassword>mypassword</AuthPassword>
<Sid>12121</Sid>
<DynamicProductFeedsRequest xmlns="http://api.something.com/remote/SomeEncryptedText">
</DynamicProductFeedsRequest>
</soap12:Body>
</soap12:Envelope>
With this how do I write a stand-alone Java client which I would want to integrate with some web application at a later stage?
From the resources mentioned earlier looks there is a wide choice of softwares: SoapUI, WSDL2Java, Apache Axis, Maven Plugin, JAX-WS, Apache CXF.
I used http://www.soapclient.com/soaptest.html in one of the SO answers mentioned above and I am able to get a perfect html/xml file on the browser.
Now I am confused on which is the software I should use? The information in the links are little in bits and pieces which I am unable to correlate with one another since I do not know anything in SOA.
Could anyone please tell me the high level steps in writing a stand-alone Java client which takes in the WSDL URL and SOAP request and gives me the output of it?
Please let me know if I missed any information.
This question all depends on the following:
The JDK version of your Java compiler.
Your WSDL version (there's 1.0, 1.2 and 2.0).
Basically, if you are using Java annotations to generate web services, then you'll need Java 5 related Web Services libraries (which supports annotations).
Some articles on Using Java Web Services with annotations (JAX-WS):
Introducing JAX-WS 2.0 With the Java SE 6 Platform
JAX-WS 2.0
I'll start from generating Web Service client with Java that doesn't support annotations. The well known client that generates WSDL to Java is Apache Axis (the last version is 1.4 released in 22 April 2006). This basically takes a WSDL definition and generates it back to client. It supports the old version of WSDL (1.0) and crashes if you use the newer versions of WSDL (1.2 and 2.0).
What this basically does, it takes your WSDL and generates a java Proxy that communicates to your Web Service. It can allow RPC based as well as XML based communication.
For Java that supports annotations there are, effectively, 2 ways of doing this:
Using Java's own wsimport command (the executable is found under the JDK_HOME/bin/ folder).
Using 3rd Party libaries such as Apache Axis 2 (which effectively replaces Apache Axis and supports WSDL version 2.0) or Apache CXF (which supports WSDL up to 1.2).
To use wsimport, you basically need to go to a shell command (or write a script) and effectively do something of this effect:
wsimport -d [outputdir] wsdl_file
and your java proxy will be found in the [outputdir] folder.
wsimport is found in JDK 1.6 (I don't know if it exists in earlier versions). More source here, and here.
For Apache Axis, Apache Axis 2 or Apache CXF, there's a WSDL2Java class file that does source code generation.
Here's a guide on how to use WSDL2Java in Apache CXF and in Apache Axis 2.
I hope this helps you in some way as much as I spent like 30 minutes off work doing this. :-)

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

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.

Categories

Resources