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

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.

Related

Assembling a WebLogic Web Service Manually

I implemented webservice as described in this guide by simply creating "web-services.xml" with the following content (and offcourse i create the 'com.example.WorkFlowEntry' handler class ) :
<web-services>
<handler-chains>
<handler-chain name="enterWorkflowChain">
<handler class-name="com.example.WorkFlowEntry">
<init-params>
<init-param name="workflow-eng-jndi-name"
value="workflow.entry" />
</init-params>
</handler>
</handler-chain>
</handler-chains>
<web-service targetNamespace="http://example.com"
name="myworkflow" uri="myWorkflowService">
<operations xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<operation name="enterWorkflow"
handler-chain="enterWorkflowChain"
invocation-style="one-way" />
</operations>
</web-service>
My issue is that when i deploy the EAR file in weblogic 11g the '' webservice is deployed successfully and i can access the WSDL of the webservice. When i deploy the same EAR in weblogic 12c it got deployed successfully but the WSDL is not accessible i am getting 404!
Manually assembling weblogic web service is valid if you are using the
Webservice 8.1 environment. The last Weblogic version for which this
approach can be used is Weblogic 12.1.1, from Weblogic 12.1.2 release,
the 8.1 WebLogic Web services run time has been removed.
that means using the 'web-services.xml' to build your webservice is valid till weblogic 12.1.1 version. for the newer version you have to upgrade your webservice implementation as mentioned in this link which mainly go through (Upgrading a 10.x WebLogic Web Service (JAX-WS or JAX-RPC) to 12.1.x). But this solution may affect the current running clients.
In my case i cannot ask the client to change their code. So my workaround for this case is to take the current WSDL and generate the webservice manually by ant as described in this link which is describes using wsdlc Ant task to generate the following artifacts:
JWS service endpoint interface (SEI) that implements the Web service described
by the WSDL file.
JWS implementation file that contains a partial (stubbed-out) implementation of
the generated JWS SEI. This file must be customized by the developer.
JAXB data binding artifacts.
Optional Javadocs for the generated JWS SEI.

Jersey 1.18 in weblogic 12.2

I have a web service in a weblogic 12.1 server (where it works) that I now have to transfer in a new weblogic 12.2 server. In my WEB-INF/lib jars I have jersey 1.18 files. However when I deploy it, it seems that Jersey 1.18 gets overridden by Jersey 2.21 and by calling the web service I get a "404 not found error". Application.wadl now has <ns0:doc ns1:generatedBy="Jersey: 2.21.1 2015-09-16..."/> so I guess that's where the problem is.
I tried putting a weblogic.xml file in WEB-INF with:
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
but nothing changed. How can I force using Jersey 1.18 ?
weblogic 12.2.x does not support jersey 1.x server api any more. It is better to use jersey 2.x api. For the 404 issue, I think you can use this link to change your app .
http://docs.oracle.com/middleware/1221/wls/RESTF/jersey-back-comp.htm#RESTF385
You may resolve the issue by changing your web.xml:
Before:
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
After:
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
A safer way to enforce the library version you need is to use shared-libs and reference then in the weblogic.xml file. Here's a sample so you can take a look:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app
http://xmlns.oracle.com/weblogic/weblogic-web-app/1.7/weblogic-web-app.xsd">
<wls:library-ref>
<library-name>jax-rs</library-name>
<specification-version>2.0</specification-version>
<exact-match>false</exact-match>
</wls:library-ref>
</wls:weblogic-web-app>
I invite you to access this link to get the detailed process on how to register your jersey lib as shared libs on weblogic instances.

Deploy Web Service using Jboss 6

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.

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 and Jax-WS : where are xsd schema?

In spring file applicationConfig.xml, JAX-WS integration need some specific schemas.
I recently successfully use these declarations :
https://jax-ws.dev.java.net/spring/core.xsd
https jax-ws.dev.java.net/spring/servlet.xsd
[I must remove all url (except one) because it's my first question]
The file begins with those declarations :
<beans xmlns="http www.springframework.org/schema/beans"
xmlns:xsi="http www.w3.org/2001/XMLSchema-instance" xmlns:aop="http www.springframework.org/schema/aop"
xmlns:tx="http www.springframework.org/schema/tx" xmlns:context="http www.springframework.org/schema/context"
xmlns:ws="http jax-ws.dev.java.net/spring/core" xmlns:wss="http jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http www.springframework.org/schema/beans http www.springframework.org/schema/beans/spring-beans.xsd
http www.springframework.org/schema/aop http www.springframework.org/schema/aop/spring-aop.xsd
http www.springframework.org/schema/tx http www.springframework.org/schema/tx/spring-tx.xsd
http www.springframework.org/schema/context http www.springframework.org/schema/context/spring-context.xsd
http jax-ws.dev.java.net/spring/core https jax-ws.dev.java.net/spring/core.xsd
http jax-ws.dev.java.net/spring/servlet https jax-ws.dev.java.net/spring/servlet.xsd">
(...)
<ws:service id="myService" bean="#myWS" />
<wss:binding url="/services/myws" service="#myService" />
Now, a migration occurs for website jax-ws.dev.java.net. These files are not found and I have some errors under Tomcat and Eclipse :
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java.net/spring/core.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not .
Is there a solution or something to prevent this error ?
Thanks
Finaly I extract XSD from jaxws-spring-1.8.jar (lib for jax-ws to work with Spring).
I put these XSD under WEB-INF directory, just near applicationContext.xml.
I modify declaration of schema in this file with :
http://jax-ws.dev.java.net/spring/core classpath:spring-jax-ws-core.xsd
http://jax-ws.dev.java.net/spring/servlet classpath:spring-jax-ws-servlet.xsd
I have seen the solution here :
Spring schemaLocation fails when there is no internet connection
I suppose you're using maven for building? Try adding the dependency to the pom.xml
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.1-1</version>
</dependency>
If you're not using maven, make sure you have jax-ws libs on your classpath.
http://java.net/projects/jax-ws
You don't need to extract the XSD from the jaxws-spring jar.
You just need to make sure the URL you use corresponds to that in the META-INF/spring.schemas file in the jar
They are defined as follows:
http\://jax-ws.dev.java.net/spring/core.xsd=spring-jax-ws-core.xsd
http\://jax-ws.dev.java.net/spring/servlet.xsd=spring-jax-ws-servlet.xsd
http\://jax-ws.dev.java.net/spring/local-transport.xsd=spring-jax-ws-local-transport.xsd
Think you just need to replace https with http. E.g:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ws="http://jax-ws.dev.java.net/spring/core"
xmlns:wss="http://jax-ws.dev.java.net/spring/servlet"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://jax-ws.dev.java.net/spring/core http://jax-ws.dev.java.net/spring/core.xsd
http://jax-ws.dev.java.net/spring/servlet http://jax-ws.dev.java.net/spring/servlet.xsd>
For more info on spring.schemas, see here