Deploy Web Service using Jboss 6 - web-services

I create a web service using net beans 7.1 and Jboss.
i am following the steps of this tutorial:
http://campuscurico.utalca.cl/~pabrojas/?page_id=192
But when i deploy the project with glassfish i go to:
http://localhost:8080/ProjectName/webServiceName?WSDL
And it show me the wsdl.
But when i deploy the project with Jboss 6.1 Final, and i go to the url:
http://localhost:8080/ProjectName/webServiceName?WSDL
The page show me Estado HTTP 404 - /
but when i go to the:
http://localhost:8080/ProjectName/
Show me the index jsp page
What is my problem, why i can't deploy the project with jboss?
Who can help me?.
Thanks
I do not if i need configure my web.xml
I have this web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
</web-app>

Have a look in the generated WSDL in your JBOSS. You can find it in your JBOSS Home directory:
JBOSS6/standalone/data/wsdl...
In the WSDL the url to your wsdl is specified in the soap:address tag.
If no wsdl is stored in your jboss you have to share some more information about your web service files.

Related

How to find wsdl version

Can any one please suggest how can I find wsdl version my web service is exposing -
snippet from wsdl -
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy"
xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://tempuri.org/"
xmlns:wsa10="http://www.w3.org/2005/08/addressing"
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
name="XXXService" targetNamespace="http://tempuri.org/">
I have gone through these web links -
https://coderanch.com/t/502335/certification/determine-wsdl-version
according to above post it's 1.2
whereas looking at this -
https://www.soapui.org/docs/soap-and-wsdl/working-with-wsdls/
SoapUI documentation says "SoapUI supports 1.1 version of the WSDL specification".
Because my wsdl loads successfully in SoapUI - could it be version 1.1?
So, I am not sure which version of wsdl (1.1/1.2/2.0) my web service is exposing.
Any suggestions please.
There are two WSDL versions: 1.1 and 2.0. A history of how these versions got to be can be found on the Wikipedia page for WSDL.
Also on that page it's a useful image of the differences between them and how to recognize the version you are dealing with:
The easiest way is to look at the root element in the XML:
if it's called <definitions> then it's a WSDL 1.1;
if it's called <description> then it's a WSDL 2.0;
Most of the WSDLs you will find out there will be version 1.1, but if the technology is newer, it might also be possible to retrieve a WSDL 2.0. See for example the answer on this post for more details about some conventions of retrieving a SOAP web service's WSDL if it provides one.

SOAP AXIS2 - Webservice on WebSphere 8.5

I am trying to create a Webservice implementation deployed on a WebSphere 8.5 application server.
I already created the skeleton and all the stubs but I don't know how to package my application.
I noticed that using axis2-wsdl2code-maven-plugin a services.xml file is created and this should replace the old WSDD file from axis1. However I don't know where should I place the services.xml and how to set web.xml (if it is needed).
Everything should be packaged in a simple war file.
I cannot find any simple documentation for this.
UPDATE:
I was able to deploy my application but I cannot reach neither the service nor its wsdl (the WSDL is not present inside the archive).
When I'm trying to reach my webservice i get:
org.apache.axis2.AxisFault: The service cannot be found for the
endpoint reference
I have the following services.xml file, located under WEB-INF/services fodler of my WAR archive.
<?xml version="1.0" encoding="UTF-8"?><!-- This file was auto-generated from WSDL --><!-- by the Apache Axis2 version: 1.6.2 Built on : Apr 17, 2012 (05:33:49 IST) --><serviceGroup>
<service name="PagamentoBollettinoPostaleInf">
<messageReceivers>
<messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="myservice.PagamentoBollettinoPostaleInfMessageReceiverInOut"/>
</messageReceivers>
<parameter name="ServiceClass">myservice.PagamentoBollettinoPostaleInfSkeleton</parameter>
<parameter name="useOriginalwsdl">true</parameter>
<parameter name="modifyUserWSDLPortAddress">true</parameter>
<operation name="getPagamentoBollettinoPostaleInf" mep="http://www.w3.org/ns/wsdl/in-out" namespace="******">
<actionMapping>urn:getPagamentoBollettinoPostaleInf</actionMapping>
<outputActionMapping>urn:getPagamentoBollettinoPostaleInfResponse</outputActionMapping>
</operation>
</service>
</serviceGroup>
This is my WEB.XML file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<display-name>inviaAnomalia</display-name>
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
This is the endpoint i am trying to connect to:
http://localhost:9080/war_context_root/services/PagamentoBollettinoPostaleInf
This happens when I try to get the WSDL file of my webservice by connecting to: http://localhost:9080/war_context_root/services/PagamentoBollettinoPostaleInf?wsdl
SOLVED
The solution was to follow the steps shown here: http://maksim.sorokin.dk/it/2011/01/13/axis2-maven-servlets-tomcat/
Then, in order to deploy correctly, WSDL and services.xml descriptor file must be placed inside:
WEB-INF/services/<ServiceName>/META-INF
Furthermore, disabling IBM JAX-WS Engine as suggested by Bruce T. and setting the classloader as shown in the following image solved the issue.

Need IBM Websphere jax ws webservices.xml and web.xml file

I don't have the sample webservices.xml and web.xml file. Can some one help by providing a complete example? I'm using Web Sphere JAX-WS implementation. WAS 7.x version. JDK 1.6.
I tried setting "UseWSFEP61ScanPolicy: true" in MANIFEST.MF file, for automated annotation scanning (instead of webservices.xml and web.xml file usage), but it is working first time, and after deploying a dynamic patch it doesn' works. The services listed under "services" category of IBM Console is having question mark instead of green arrow. Also some times the services even not listed in "services" category.
I'm using web module version 2.3, so i've to enable automated scanning. I'm not using EJB for web service.
I've decided to use webservices.xml and web.xml due to not much help in annotation scanning. I hope for webservices.xml and web.xml not need to install and reinstall the application EAR in WebSphere. In the case of annotation scanning reinstall is needed.
PLEASE IBM WEB SITE DOESN'T HELP MUCH!!!
Here's a web.xml I've used. Since it's "empty", the default rules for mapping annotated webservice classes to URL's apply, approximately, URL = name of class + "Service".
webservices.xml is not needed.
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
<display-name>wsfp_hello_svc</display-name>
</web-app>
Check SystemOut.log to find the URL of your service, look for something like this:
WSWS7037I: The /HelloService URL pattern was configured for the example.HelloDelegate servlet
If you don't like the default mappings, then you can map your webservice class to a different URL in web.xml just like you would do with a servlet.

How to identify cxf web service end point

I am trying to creating web service using wsdl first approach and CXF. I am able to generate java file from wsdl and deploy the war file to tomcat server. However, I don't see any soapaction in the generated file. How do I identify the end point url for this web service?
thanks,
Usually in CXF you use Spring configuration to configure endpoint, as described in JAX-WS Configuration. Usually address is relative, e.g.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint id="classImpl"
implementor="org.apache.cxf.jaxws.service.Hello"
address="/helloService"/>
</beans>
Address is local to you web app context root.
Assuming that name of you web application is SomeWebApp and the server is available at localhost:8080 then web service should be published at http://localhost:8080/SomeWebApp/helloService. You can test it retrieving WSDL at: http://localhost:8080/SomeWebApp/helloService?wsdl. This URL can be used to create SOAP UI project (the tool that I really recommend for exploring and testing SOAP services).
If you don't use Spring to configure endpoint or you still can't access web service please provide more details about your configuration.

Spring 3 MVC + Web Services (JAX-WS)

We have a Spring 3 MVC webapplication, and we are trying to expand it with Web Services.
I have now tried with JAX-WS Web-services, annotating WebService and WebMethod on the appropriate places.
I do have a dispatcher mapped in my web.xml. This is the standard spring DispatcherServlet. And its config: dispatcher-servlet.xml is working perfectly fine for the MVC stuff.
The problem comes when I try to expose the WebServices. I do this by adding the following bean to the dispatcher-servlet.xml:
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8080/service/" />
</bean>
If this bean is added. Then the WebServices works perfectly, but all the MVC stuff stops working.
So my second try was to create 2 dispatchers. One named mvc-dispatcher and one webservice-dispatcher. Each of them mapped to respectivly /mvc and /ws. And then put only the SimpleJaxWsServiceExporter in the webservice-config and only the standard MVC stuff in the other one.
But still the same problems.
I can only get the MVC to work if I disable/comment-out the web-service dispatcher.
I cant belive this is supposed to be so complicated... What am I not getting?
Any help would be greatly appriciated.
I cant find any decent tutorials doing JAX-WS and spring 3 MVC...
Thanks in advance!
I'm assuming by dispatcher you mean a spring dispatcher, I'd recommend against that. Just have the JAX-WS be a different servlet on it's own, i.e.
https://cxf.apache.org/docs/a-simple-jax-ws-service.html
Then if you need to allow Spring beans to be injected extend SpringBeanAutowiringSupport as in this example.
How to make an #WebService spring aware
Hope this helps!
You can use Apache CXF that implements the JAXWS Specification has a very good integration with Spring, actually CXF use behind the scenes Spring.
In practice you could proceed in this way:
in your web.xml you have configure the cxf servlet as below
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
....
<servlet>
<description>Apache CXF Endpoint</description>
<display-name>cxf</display-name>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/ws/*</url-pattern>
</servlet-mapping>
</web-app>
Apache CXF configuration
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath*:META-INF/cxf/cxf-extension-*.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<jaxws:endpoint
id="yourService"
implementor="#yourService"
address="/yourAddres">
</jaxrs:server>
</beans>
your bean
#Service
#WebService(serviceName = "soapSvnClientService")
public class SoapSvnClientService {
#WebMethod(operationName = "service")
public void service(#WebParam String param1,
#WebParam String param2){
....
}
}
I hope that this can help you