How to deploy webService and get access to wsdl? - java

I have got a webService without ui. It simple jax-ws app that will allow to manage users via soap requests. I tried to deploy it on websphere. It was deployed, But! my app doesn't appear in Service Providers and i can't get access to wsdl file via url that i pass in wsdlsoap:aderess location. It haven't got any servlets and other stuff. I create my app using template that deploy with success, it appear in Service Providers. I research all internet, but idk what go wrong.
P.S: Template project was eclipse project. I just add maven and has no idea why it wouldn't work.

The fact that your web service hasn't appeared in the Service Providers section means you've deployed it the wrong way.
Check whether you've selected the "Deploy web-services" option during deployment.
You probably got an issue in your trace.log file which possibly references to the ffdc, check it to investigate the problem.
You also haven't mentioned if you using servlet or EJB-based web services.

Related

Java ServiceLoaders, Tomcat, Apache CXF and Metro

I have to get some information from an external SOAP web service using a web application deployed on Tomcat 7. This external web service requires TLS with mutual authentication.
As a starting point, I have installed Tomcat 7.0.96 in my desktop computer and, using the external web service wsdl file, I have put a dummy web service up, that mimmicks the real one, returning some hardcoded objects when queried. I have used Apache CXF 3.3.8 .
I also have a web application that acts as a proxy for another web app, and as a client for the external (test and production), and dummy (local) web services.
Proxy web app requests objects from dummy web service. Mutual TLS authentication is assured using keystores present in CXF 3.3.8 samples.
In my desktop computer, everything works fine, my dummy web service serves the objects as expected.
Problem arises when I ask to deploy the proxy web app on a test server that I do not control. This server runs Tomcat 7.0.76 over CentOS 7. When the proxy web app tries to create the external web service client, an exception throws:
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub cannot be cast to org.apache.cxf.frontend.ClientProxy
I have searched for documentation about Java proxies and service loaders. Test server has three jaxws-xxx.jars in /tomcat/lib folder. AFAIK these jars are Metro web services API and implementation. I have a copy of these at my local tomcat/lib folder, and I can reproduce the problem.
I have included a Context.xml file in my proxy web app. Depending upon I include an Loader element in Context.xml, setting Loader attribute delegate to true or false, I am able to reproduce or solve the problem.
But when I deploy the proxy web app in test server, including Context.xml as explained, the aforementioned exception always arises.
I have included some lines in proxy web app printing to log implementation classes showed in ServiceLoader Java class iterator. At my local PC, com.sun.xml.ws.spi.Providerimpl appears before of after org.apache.cxf.jaxws.spi.ProviderImpl depending upon Loader "delegate" attribute value, as expected.
But using the same Context.xml webapp file, at the test server, sun's spi appears always before cxf's.
Has anybody faced this problem? Any suggestions? Thanks in advance
You should ask the external Tomcat admin, why did he include JAX-WS RI libraries in the common classloader. IMHO opinion they shouldn't be there, but in the applications that use it.
Nevertheless your application classloader should pick the CXF implementation of JAX-WS unless:
the <Host> container has deployXML="false" and it ignores the META-INF/context.xml file in your application. If this is the case you can copy it manually to $CATALINA_BASE/conf/<enginename>/<hostname>/<contextname>.xml
the $CATALINA_BASE/conf/context.xml has a <Loader> component with delegate="true".

First steps on liferay web services

I followed this tutorial -documentation about Liferay Web service.
I runned Lifaray on tomcat
If I use http://localhost:8080/api/axis/Portal_UserService?wsdl by browser I have a response.
When I create a webService Client on Eclipse and I put this url http://localhost:8080/api/axis/Portal_UserService?wsdl in the Service Definition...
but I have this error message:
No server can be found and WebServiceProject does not exist. Choose an existing project or use the preferences to configure a server runtime.
Why?
create dynamic web project and configure a server then add wsdl .
This does not mean that the server (e.g. Liferay) can't be found but notifies you that Eclipse doesn't know where to put/how to configure the resulting WebService: It needs a server runtime and a WebServiceProject - e.g. you can create a WebServiceClient inside a project - if no suitable project exists, eclipse will complain.
So: Everything is fine on the Liferay side. You'll need infrastructure in your IDE to be able to go forward with this operation
I could not find any solution to this, for some reason Eclipse didn't recognize a valid wsdl. I downloaded a trial version of IntelliJ IDEA 13 Ultimate and setup the Web Service Client through there. Everything worked properly.

Call an axis2 web service from a java application

I have create one simple web service and I deploy it to the axis2 web application based on this tutorial
After creating my service, I am able to deploy it to the server and I can see the WSDL file by this url: localhost:8084/axis2/services/HelloAxisWorld?wsdl
Now, I want to call this service by an independent java application. I found some pieces of code that makes the invocation, but I am facing problems because I suppose that I don't include the proper libraries in my project.
Does anybody knows an example to call the web service by using axis2?
A simple Google for 'axis2 client tutorial' gives me this. It covers setting up your classpath properly, generating java from the WSDL via wsdl2java, and developing the client from this.

Make web service work on different server

I am developing a web service with Eclipse. This service will be accessed from Android with ksoap2.
I successfully tested the service on my local apache tomcat (http://localhost:8080/) and now want to set this service up on a different server (i.e. http://giraffe/).
The .wsdl file generated by Eclipse contains the following line:
<wsdlsoap:address location="http://localhost:8080/AndroidService/services/AndroidService"/>
I guess this won't work out if I just add the .war file to giraffe and try to reach the service.
My question now is the following: What do I need to change in order to be able to use this service on a different server? Do I just have to change this address location?
If you need me to post some of the code/files, just tell me.
My eclipse project structure looks like this:
You can replace http://localhost:8080 on wsdl with http://giraffe/
Are you facing any issue once you deploy on the server?

Can multiple projects have the same context-root?

I am going to build a many web services using weblogic and JAX-RS. To keep things simple I was going to place each service in its own project. But the problem I seem to be having is with setting the context-root for each project.
Can multiple projects that are deployed on the save weblogic server have the same context-root?
of course not. how do you expect weblogic knows which web application you are calling?
edit:
however, it is possible to give one web application a context root of /webapp and the other /webapp/ws

Categories