Topic
5 replies Latest Post - ‏2013-07-22T02:07:34Z by Ivan_Xu
RossS.
RossS.
3 Posts
ACCEPTED ANSWER

Pinned topic Cannot Override JAX-WS annotations in Liberty Profile

‏2013-07-05T20:24:29Z |

According to the WAS documentation ( http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.base.doc%2Fae%2Ftwbs_jaxwsdeploydescriptor.html ) you can use the webservices.xml deployment descriptor to override some of the JAX-WS annotations.

Do the overrides work in Liberty Profile? I've created a webservices.xml file in the WEB-INF directory and published the service to Liberty Profile, but it doesn't seem to have any appreciable effect on the generated WSDL of the service or it's operation.

It sure does complain when you get something wrong in the webservices.xml file.

I'm relatively new to the webspace world, so any insights from you pros is appreciated! Thanks!

  • Ivan_Xu
    Ivan_Xu
    8 Posts
    ACCEPTED ANSWER

    Re: Cannot Override JAX-WS annotations in Liberty Profile

    ‏2013-07-08T08:28:05Z  in response to RossS.

    Hi,

    Could you show us more detailed information, which will be helpful to know dig the issue.

    a.  what you would like to override ?

    b. How does webservices.xml look like ?

    Thanks.

  • RossS.
    RossS.
    3 Posts
    ACCEPTED ANSWER

    Re: Cannot Override JAX-WS annotations in Liberty Profile

    ‏2013-07-08T16:06:55Z  in response to RossS.

    Hi Ivan,

    I'm trying to override the @WebService and @BindingType annotations in a relatively simple POJO. Currently the annotations are just the default @Webservice() bound to my service endpoint interface. For the sake of this discussion, let's assume the annotated class looks like this :

    package com.ibm.liberty.jaxws.demo.simple;

    import javax.jws.WebService;

    @WebService()
    public class SimpleEcho
    {
        public String echo (String value) {
            return "Echo response [" + value + "]";
            }
    }

    When deployed the service behaves as expected with default values. I'm able to access the service at http://<server>:<port>/SimpleEcho/SimpleEchoService as expected.

    What I'm trying to do is override those default values with something like this (in webservices.xml) :

    <webservices xmlns="http://java.sun.com/xml/ns/javaee" version="1.3">
        <webservice-description>
            <webservice-description-name>TheService</webservice-description-name>
        <port-component>
            <wsdl-service>TheService</wsdl-service>
            <wsdl-port>TheServicePort</wsdl-port>
            <service-endpoint-interface>
               com.ibm.liberty.jaxws.demo.SimpleEcho
            </service-endpoint-interface>
        </port-component>
        </webservice-description>
    </webservices>

    As I understand it, with this webservice.xml file in the WEB-INF/ directory it should override the annotation in the code (in this case the default) and I should then be able to access the service at http://<server>:<port>/SimpleEcho/TheService. However, that doesn't work and the web service is still accessible at the default URL. Even the WSDL from the ?wsdl query on the service is the same.

    Any insights are appreciated.

  • RossS.
    RossS.
    3 Posts
    ACCEPTED ANSWER

    Re: Cannot Override JAX-WS annotations in Liberty Profile

    ‏2013-07-15T22:44:59Z  in response to RossS.

    Allright so....It's still not working, at all. First I tried modifying the webservices.xml file as suggested above, now it looks like this :

    <webservices xmlns="http://java.sun.com/xml/ns/javaee" version="1.3">
        <webservice-description>
            <webservice-description-name>TheService</webservice-description-name>
        <port-component>
            <wsdl-service>TheService</wsdl-service>
            <wsdl-port>TheServicePort</wsdl-port>
            <service-endpoint-interface>
                com.ibm.liberty.jaxws.demo.SimpleEcho
            </service-endpoint-interface>
            <service-impl-bean>
                <servlet-link>SimpleEcho</servlet-link>
            </service-impl-bean>
        </port-component>
        </webservice-description>
    </webservices>

    Adding the service-impl-bean element had no effect. Being disappointed with that result, I tried the suggested ibm-ws-bnd.xml file and compiled a simple one as follows :

    <?xml version="1.0" encoding="UTF-8"?>
    <webservices-bnd xmlns="http://websphere.ibm.com/xml/ns/javaee"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ws-bnd_1_0.xsd"
                version="1.0">
        
        
        <webservice-endpoint port-component-name="SimpleEchoServicesPort" address="/bob"></webservice-endpoint>
        
    </webservices-bnd>

    I put that in the /WEB-INF directory in place of webservices.xml and published it to my server. This also had NO effect on my webservice. In fact, if I mal-formed the XML in the ibm-ws-bnd.xml file the Liberty Profile server didn't seem to care, which suggests to me that it wasn't even looking for the file.

    So that leaves me with two conclusions : 1. Webservices.xml isn't supported in Liberty Profile and/or support for that file or ibm-ws-bnd.xml isn't working (bug). 2. I'm missing some feature or other configuration element which enables this support.

    Here are the features I currently have enabled for this server :

    <featureManager>
            <feature>jsp-2.2</feature>
            <feature>jaxws-2.2</feature>
            <feature>servlet-3.0</feature>
        </featureManager>

    Please advise. If this isn't a bug, I'd LOVE a sample or example which works I can play with.

    Thanks in advance!