JAX-WS and sun-jaxws.xml - web-services

I have read a lot of posts on public forums about deploying JAX-WS on different servet containers
and I have following questions/queries based on that.
Following is my understanding :
1)sun-jaxws.xml is required ONLY BY Sun's RI (metro project) since com.sun.xml.ws.transport.http.servlet.WSServletContextListener class needs it.
(looking at source for this class , it reads this file from hardcoded location).
2)It is also required if servlet container is not Java EE 5 compliant.
3)Different application servers like Jboss , GlassFish can use their own JAX-WS implementations (like Apache CXF,Metro)
So my questions are :
1)If I use Sun's RI (metro) on Java EE 5 container like JBoss or GlassFish , do I still need to use sun-jaxs.xml ?
2)If I develope JAX-WS web service on Java EE 5 container like Jboss , can it be portable to another Java EE 5 container like GlassFish. What I mean is can I deploy the war as it is on another container ?
Please help me sort out above queries since I am really confused about Sun's RI and sun-jaxws.xml descriptor usage.

Application servers have own web service client frameworks. You can think these are like jaxws. When you deploy an app to app server default option app server use own framework for web service call. Therefore if server need a configuration file like as sun-jaxws.xml you must put it relevant directory. But I dont think you need it.
Second option is configuring the app server for using your third part jax-ws library. It is an extra option. For example I made in WAS. Because of that when you choose this choice you must use sun-jaxws.xml
Hopefully I have been clear in my answer :)

Related

What are main components of webservices to be learned ? And how to deploy a webservice on servers such as Apache etc?

I am new at webservice and i want to know where and when should webservices be used and exposed?
And what it takes to deploy and use webservices (wsdl file) on Tomcat or any other servers ?
Thanks.
From technology agnostic things the important knowledge is the stack composition: WS-(Servlet)-HTTP-(TLS)-TCP/IP (optional layers in parenthes). As a platform you typically try some lightweight option like Jetty or Winstone before falling back to the Apache Tomcal.
If you are after any webservice now, then a wise thing to do is just pick some mature Java standard technology like JAX-WS. There will be a good tutorial on java.net, respective Maven packaging and deployment plugins and IDE integration rigs. Once you have a simple thing working you'll have more specific questions most answered on SO.

jax-ws in Weblogic 10.3.5: IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions

We have a test web application deployed In Weblogic 10.3.5. The web application contains a servlet which uses jax-ws to call a web service deployed in the same weblogic.
Accessing the servlet throws the following exception:
Two classes have the same XML type name "address". Use #XmlType.name and #XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
at javax.xml.ws.wsaddressing.W3CEndpointReference
I copied the logic of the servlet into a common java class, and ran it. The test succeeded. So the problem should lie in the web application.
I have tried many ways, modify weblogic-application.xml to add prefer-application-packages section like below, but still doesn't work.
<prefer-application-packages>
<package-name>javax.xml.ws.*</package-name>
<package-name>javax.xml.bind.*</package-name>
<package-name>javax.jws.*</package-name>
<package-name>javax.namespace.xml.*</package-name>
<package-name>javax.xml.soap.*</package-name>
<package-name>org.apache.xerces.*</package-name>
<package-name>org.apache.commons.*</package-name>
<package-name>com.sun.xml.*</package-name>
</prefer-application-packages>
Anyone can help me on this, spent several days on this bug, no progress at all.
Thanks a million for your reply in advance.
Update 1
In the web application, we don't want to use metro, just use jax-ws downloaded from java.net, and put put jaxws-rt.jar, jaxws-api.jar, jaxb and other related jars in the ear/APP-INF/lib.
WebLogic Classloader Analysis Tool (wls-cat) tells there are some classes conflict, and suggests to add prefer-application-packages in weblogic-application.xml.
So We add prefer-application-packages to tell weblogic load them from from our application, not from weblogic jax-ws/metro implmentation.
But still doesn't work.
The problem might come from the fact that you want to use Metro JaxWs in Weblogic which has it's own implementation called Oracle JaxWS (based on Metro).
Here is a link where is explained how use Metro with Weblogic :
http://metro.java.net/guide/ch02.html#weblogic-10
If you don;t use Metro and rely on Oracle JaxWS you do not have to used preferred libs or any special packaging.

How does one add or update a WAR file/folder to the default embedded Jetty server in a Restlet 2.1 Application?

I would like to develop a Restlet 2.1 Java SE or Java EE Application that uses a (default) Jetty server, as opposed to an external Jetty/Tomcat server.
But I would like to configure the WAR file/folder that Jetty is processing, even allowing for stop(), reconfigure() or reload(), start() to happen at run time. In the external case, I can use setWar("path to war file/folder") from the Jetty API to achieve my goal, so this is plan B. Plan A is to figure out how to do this from the Restlet 2.1 API.
I cannot see a way to do it and I'm hoping that I'm just missing an obvious, or even not-so-obvious solution.
I think the Jetty WebAppProvider will provide what you need. If not, have a look at my hot swap code for WAR files in an embedded Jetty on this thread.

How can I deliver jetty with many webapps via jnlp?

I have a webapp (http://sourceforge.net/projects/sf-mvn-plugins/files/m2-repo/net/sf/maven/plugins/example-captaincasa-jnlp/0.1-SNAPSHOT/example-captaincasa-jnlp-0.1-SNAPSHOT.war/download) which uses jsf in a servlet container. This works fine with jetty-maven-plugin run-war target at my local pc. In the future I would like make more of this kind of webapps.
I am looking for a way to deliver these webapps with jetty via jnlp. The end user should be have a zero installation but the webapps needs servlet container and my hoster does not support a servlet container or application server or so on.
I don't like an embedded solution because in this case each webapp must be delivered with a separate jetty und run with a separate jetty -> too big size -> to many download size and so on.
The architecture should be similar to this:
(source: sourceforge.net)
Example: Bundle1 could contains jetty and deployed webapp1 and Bundle2 could contains jetty and deployed webapp1 and webapp2 (related to requirements of end user I would like deliver many variant of my webapps)
But what is my question?
Which jars of jetty are needed? I would like these upload to my homepage for hosting.
Which jar should I use for jetty as main jar to start him via jnlp?
Which main class should I use to start jetty via jnlp?
Which parameter could I use to configure jetty to say this is war of webapp1 and this is war of webapp2.... or this is directory of weapps for hot deployment...?
The important question for me is 1. If this is answered so that I could run jetty local (without maven plugin) and via manual maybe I could solve the rest 2-4.
Why not deploy a normal Java app (with a main() etc.) that invokes Jetty programatically via its Server class? That class is configured via code with the appropriate contexts, servlet classes etc.
I've done that before with success. The only headache is running one Jetty with multiple apps being downloaded on request (if I read your question correctly). Can you use some classloading magic, and load classes/apps on demand from a remote URL ?
I have found another way today. This is interesting too. Here is the concept:
Use java webstart to install an osgi container
Use a bundle x or a osgi service to download all bundles of your app
Use the jetty bundle to provide jetty support
Then the application is installed
I got the idea from this article:
http://www.toedter.com/blog/?p=45

How to deploy an Axis-generated soap service to an embedded Tomcat instance

I generated a Soap Service from a WSDL and now I need to deploy it to my existing application which uses embedded tomcat (I.E. I have a class which extends TomcatServeletContainer and a main class which instantiates that class and starts the server).
I see many examples for how to deploy an axis service to a standalone tomcat using a WAR, or a WSDD, but I don't see how to wire it together myself. I assume I have to define a servelet in the web.xml and provide some other glue. Any assistance or pointers to appropriate documentation would be most appreciated.
Thanks!
-Carl
Have you been able to get this to work?
I've been trying to build a webservice (in a standalone war-file containing the axis jars (w/dependencies)+server-config.wsdd) using maven. I really don't want to make any calls to the AdminClient at all (meaning not to install Axis).
I've generated the server side sources from a WSDL using the axistools-maven-plugin, and everything seems to work ok until I have deployed the service. http://localhost:8080/myApp/services gives me the name of the service and two exposed methods. But clicking the wsdl link displays an Axis error message telling me "Could not generate WSDL! There is no SOAP service at this location".
Is it at all possible to build a standalone Axis webservice this way using maven?
Yes, you will need build your application the same way you would for a WAR but programmatically inform tomcat where you exploded war lives.
Everything else should be the same as the standard servlet spec.