JBoss Community

Jboss 7.1.1 Final : JAX-WS : WebServiceContext.messageContext null

created by Michaƫl Leneveut in JBoss AS 7 Development - View the full discussion

Hi everybody,

 

I am trying to use a JAX-WS Webservice in JBoss 7.1.1 Final. Webservice is working on Websphere 7, 8 and JBoss 5.1.

 

When calling the context.getMessageContext(), I get the following error, because WebServiceContext.messageContext is null :

java.lang.IllegalStateException

    at org.jboss.ws.common.injection.ThreadLocalAwareWebServiceContext.getWebServiceContext(ThreadLocalAwareWebServiceContext.java:88)

    at org.jboss.ws.common.injection.ThreadLocalAwareWebServiceContext.getMessageContext(ThreadLocalAwareWebServiceContext.java:69)

    at fr.xxx.fwmc.arch.isolation.wsserver.bean.CommonWSActivityBean.init(CommonWSActivityBean.java:88)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 

My CommonWSActivityBean :

public class CommonWSActivityBean extends BaseFrameworkObject {

    @Resource

    private WebServiceContext context;

 

   @PostConstruct

    @WebMethod(exclude = true)

    public void init() throws RemoteException {

        try {

            MessageContext messageContext = context.getMessageContext(); //line 88

 

My Webservice :

 

@WebService(name = "RechercheClientXOP", targetNamespace = "http://ws.rechercheclient.xop.xxx.fr/")

@SOAPBinding(style = Style.DOCUMENT, use = Use.LITERAL, parameterStyle = ParameterStyle.WRAPPED)

public class RechercheClientXOP extends CommonWSActivityBean {


    @WebMethod(action = "rechercher")

    @WebResult(name = "rechercheClientsWS", targetNamespace = "")

    @RequestWrapper(localName = "rechercher", targetNamespace = "http://ws.rechercheclient.xop.xxx.fr/", className = "fr.xxx.xop.rechercheclient.ws.Rechercher")

    @ResponseWrapper(localName = "rechercherResponse", targetNamespace = "http://ws.rechercheclient.xop.xxx.fr/", className = "fr.xxx.xop.rechercheclient.ws.RechercherResponse")

    public RechercheClientWSDataBean rechercher(

            @WebParam(name = "rechercheClientWSParametre", targetNamespace = "http://ws.rechercheclient.xop.xxx.fr/") ClientWSParametreDataBean rechercheClientWSParametre)

            throws WSException {

        try {

            return RechercheClientHelper.doRecherche(

                    rechercheClientWSParametre, this.getUserContext());

        } catch (WSException e) {

            throw e;

        }

    }

}

 

web.xml :

 

<servlet>

        <description>

        WebService RechercheClient JAXWS</description>

        <display-name>RechercheClientXOP</display-name>

        <servlet-name>RechercheClientXOP</servlet-name>

        <servlet-class>fr.xxx.xop.rechercheclient.ws.RechercheClientXOP</servlet-class>

    </servlet>

    <servlet-mapping>

        <servlet-name>RechercheClientXOP</servlet-name>

        <url-pattern>/RechercheClientXOPService</url-pattern>

    </servlet-mapping>

 

standalone.xml :

 

<?xml version='1.0' encoding='UTF-8'?>

<server xmlns="urn:jboss:domain:1.2">

    <extensions>

        <extension module="org.jboss.as.clustering.infinispan"/>

        <extension module="org.jboss.as.configadmin"/>

        <extension module="org.jboss.as.connector"/>

        <extension module="org.jboss.as.deployment-scanner"/>

        <extension module="org.jboss.as.ee"/>

        <extension module="org.jboss.as.ejb3"/>

        <extension module="org.jboss.as.jaxrs"/>

        <extension module="org.jboss.as.jdr"/>

        <extension module="org.jboss.as.jmx"/>

        <extension module="org.jboss.as.jpa"/>

        <extension module="org.jboss.as.logging"/>

        <extension module="org.jboss.as.mail"/>

        <extension module="org.jboss.as.naming"/>

        <extension module="org.jboss.as.osgi"/>

        <extension module="org.jboss.as.pojo"/>

        <extension module="org.jboss.as.remoting"/>

        <extension module="org.jboss.as.sar"/>

        <extension module="org.jboss.as.security"/>

        <extension module="org.jboss.as.threads"/>

        <extension module="org.jboss.as.transactions"/>

        <extension module="org.jboss.as.web"/>

        <extension module="org.jboss.as.webservices"/>

        <extension module="org.jboss.as.weld"/>

    </extensions>

     [...]

     <profile>

     [...]

     <subsystem xmlns="urn:jboss:domain:webservices:1.1">

            <modify-wsdl-address>true</modify-wsdl-address>

            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>

            <endpoint-config name="Standard-Endpoint-Config"/>

            <endpoint-config name="Recording-Endpoint-Config">

                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">

                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>

                </pre-handler-chain>

            </endpoint-config>

        </subsystem>

     [...]

 

I don't have jax-ws-*.jar in my WEB-INF/lib or in standalone/lib/ext.

I tried to put the @Resource on the setContext() instead of context. I tried without the private keyworrd.

 

Why is the WebServiceContext not filled / injected ?

 

Thanks for your help.

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community