You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Kishanthan Thangarajah <ks...@gmail.com> on 2012/12/24 17:41:14 UTC

Re: Issue with JAXWSMessageReceiver

Hi,

This is a known issue and has been fixed for the 1.7.0 release. Please look
at [1].

Thanks,
Kishanthan.
[1] https://issues.apache.org/jira/browse/AXIS2-4611


On Wed, Dec 19, 2012 at 8:55 PM, BALARAMA THAVANATI
<bt...@verizon.net>wrote:

> Hi
>  I have created an .aar file and dropped in the WEB-INF/services directory
> of axis2 (1.6.2) war file. I deployed this to jboss 5.1 app server
>
>  The server reports no error and I can see the WSDL using
> http://localhost:8080/axis2/services/HelloWorldImplService?wsdl.
> But when I generate a request using SOAP UI and fire it I get the
> following error
> --------
> 10:18:04,065 INFO  [STDOUT] [WARN] Deprecated usage of
> OMElement#declareNamespace(String,String) with empty prefix
> 10:19:00,780 INFO  [STDOUT] [ERROR] The service class cannot be found for
> this AxisService.
> java.lang.RuntimeException: The service class cannot be found for this
> AxisService.
> at
> org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessageReceiver.java:103)
>  at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
> at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
>  at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
>  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>  at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>  at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>  at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
> at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
>  at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
> at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
>  at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
>  at
> org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
>  at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>  at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
> at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>  at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
> at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
>  at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
> at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
>  at java.lang.Thread.run(Thread.java:619)
> --------------------------------------------------
> following are my artifacts used
> (1) HelloWorld interface
> _______________________
> package com.bal.service;
>
> import javax.jws.WebMethod;
> import javax.jws.WebService;
> import javax.jws.soap.SOAPBinding;
> import javax.jws.soap.SOAPBinding.Style;
> import javax.jws.soap.SOAPBinding.Use;
>
> @WebService
> @SOAPBinding(style=Style.DOCUMENT, use = Use.LITERAL)
> public interface HelloWorld {
>
>  @WebMethod
> public String echo(String input);
> }
> _____________________________________________
> (2) HelloWorldImpl
> _______
> package com.bal.service;
>
> import javax.jws.WebService;
>
> @WebService(endpointInterface = "com.oneshield.service.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>
>  @Override
> public String echo(String input) {
>  return "received "+input;
>  }
>
> }
> __________________________________________
> (3) services.xml
> ________
> <serviceGroup>
> <service name="HelloWorldService">
>  <Description>Hello world web Service</Description> <!-- the XSD suggests
> using 'Description' instead of 'description' -->
> <parameter name="ServiceClass">com.bal.service.HelloWorldImpl</parameter>
>  <messageReceivers>
> <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out"
>  class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver" />
> </messageReceivers>
> </service>
> </serviceGroup>
>
>

Re: Webservice context is null (not injected)

Posted by BALARAMA THAVANATI <bt...@verizon.net>.
A small correction in the code, here are the artifacts again:
--------------------------------------------------
following are my artifacts used
(1)
 HelloWorld interface
_______________________
package com.bal.service;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

@WebService
@SOAPBinding(style=Style.DOCUMENT, use = Use.LITERAL)
public interface HelloWorld {

@WebMethod
public String echo(String input);
}
_____________________________________________
(2) HelloWorldImpl
_______
package com.bal.service;

import javax.jws.WebService;
//corrected the package name
@WebService(endpointInterface = "com.bal.service.HelloWorld") 
public class HelloWorldImpl implements HelloWorld {

    @Resource WebServiceContext ctx;
    
    @Override
    public String echo(String input) {
        
       
 // ctx is NULL here!!
        MessageContext mCtx = ctx.getMessageContext();
        
        return "received "+ input ;
    }

}
__________________________________________
(3) services.xml
________
<serviceGroup>
    <service name="HelloService">
    <Description>Hello web Service</Description>
    <parameter name="ServiceClass">com.bal.service.HelloWorldImpl</parameter>    
        <messageReceivers>
   
         <messageReceiver 
mep="http://www.w3.org/2004/08/wsdl/in-only" 
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
            <messageReceiver
 mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
        </messageReceivers>
    </service>
</serviceGroup>
 




________________________________
 From: BALARAMA THAVANATI <bt...@verizon.net>
To: "java-user@axis.apache.org" <ja...@axis.apache.org> 
Sent: Wednesday, December 26, 2012 11:55 AM
Subject: Webservice context is null (not injected)
 

 Hi
 I have created an .aar file and dropped in the WEB-INF/services directory of axis2 (1.6.2) war file. I deployed this to jboss 5.1 app server

 I used the  annotation "@Resource WebServiceContext" in the impl, but  am not getting the WebServiceContext injected into the web service implementation class.
 The line where I try to use the context is throwing NullPointerException

--------------------------------------------------
following are my artifacts used
(1)
 HelloWorld interface
_______________________
package com.bal.service;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

@WebService
@SOAPBinding(style=Style.DOCUMENT, use = Use.LITERAL)
public interface HelloWorld {

@WebMethod
public String echo(String input);
}
_____________________________________________
(2) HelloWorldImpl
_______
package com.bal.service;

import javax.jws.WebService;

@WebService(endpointInterface = "com.oneshield.service.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

    @Resource WebServiceContext ctx;
    
    @Override
    public String echo(String input) {
        
       
 // ctx is NULL here!!
        MessageContext mCtx = ctx.getMessageContext();
        
        return "received "+ input ;
    }

}
__________________________________________
(3) services.xml
________
<serviceGroup>
    <service name="HelloService">
    <Description>Hello web Service</Description>
    <parameter name="ServiceClass">com.bal.service.HelloWorldImpl</parameter>    
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
            <messageReceiver
 mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
        </messageReceivers>
    </service>
</serviceGroup>

Webservice context is null (not injected)

Posted by BALARAMA THAVANATI <bt...@verizon.net>.
 Hi
 I have created an .aar file and dropped in the WEB-INF/services directory of axis2 (1.6.2) war file. I deployed this to jboss 5.1 app server

 I used the  annotation "@Resource WebServiceContext" in the impl, but  am not getting the WebServiceContext injected into the web service implementation class.
 The line where I try to use the context is throwing NullPointerException

--------------------------------------------------
following are my artifacts used
(1) HelloWorld interface
_______________________
package com.bal.service;

import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;

@WebService
@SOAPBinding(style=Style.DOCUMENT, use = Use.LITERAL)
public interface HelloWorld {

@WebMethod
public String echo(String input);
}
_____________________________________________
(2) HelloWorldImpl
_______
package com.bal.service;

import javax.jws.WebService;

@WebService(endpointInterface = "com.oneshield.service.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

    @Resource WebServiceContext ctx;
    
    @Override
    public String echo(String input) {
        
        // ctx is NULL here!!
        MessageContext mCtx = ctx.getMessageContext();
        
        return "received "+ input ;
    }

}
__________________________________________
(3) services.xml
________
<serviceGroup>
    <service name="HelloService">
    <Description>Hello web Service</Description>
    <parameter name="ServiceClass">com.bal.service.HelloWorldImpl</parameter>    
        <messageReceivers>
            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only" class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
            <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
        </messageReceivers>
    </service>
</serviceGroup>