You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Aida <ai...@gmail.com> on 2014/08/11 21:18:33 UTC

[Cxf-Interceptor] @InInterceptor/@OutInterceptor annotations ignored (JBoss 5.1.0, not 6 or 7)

Hi all,

I have been googling and reading threads of this forum in order to solve
this ...

I'm working with JBoss 5.1.0 GA, and I have EJBs as services (EJB 3.0). I'm
trying to use the @InInterceptor and @OutInterceptor annotations in order to
add a WSS4J interceptor (I want to sign and encrypt my messages).

I have read that in further versions of JBoss (as 6.X or 7.X) the
annotations are ignored as is commented in [1]. In [2] says that a
Dependency is needed in a Manifest file, but this is for JBoss AS 7 (not my
version, anyway adding the Manifest as specified doesn´t works).

I have checked that when I call to my web-service, the interceptor that I
add with the annotation isn´t called. I have also tried with other CXF
Interceptors (ReadHeadersInterceptor), but no interceptor (set by me) is
fired.

This is my service (I'm working with a proof of concept, but I'm not able to
make it work):

@InInterceptors(interceptors =
{"mypackage.WSSWithCertificateInInterceptor"})
@WebService( name = "HelloWorldService", 
			 serviceName = "HelloWorldService",
			 targetNamespace = "http://mydomain/service/samples/")
@Stateless(name = "HelloWorldService")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
public class HelloWorldServiceImpl {

	private static String HELLO_WORLD_MESSAGE = "Hello world {0}";
	
	/**
	 * Hello World Operation 
	 */
	@WebMethod
	public String helloWorld(@WebParam(name = "name") String name){
		
		return MessageFormat.format(HELLO_WORLD_MESSAGE, name);
	}
}


Where WSSWithCertificateInInterceptor is just an extension of
WSS4JInInterceptor:

public class WSSWithCertificateInInterceptor extends WSS4JInInterceptor{
	
	private static Map<String,Object> inProps= new HashMap<String,Object>() {
										/** generated UUID */
										private static final long serialVersionUID =
-7905172475428802888L;
								
										{ 
											put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
											put(WSHandlerConstants.SIG_PROP_FILE, "server_sign.properties");
										}
									};									
	
	public WSSWithCertificateInInterceptor () {
		super(inProps);
	}

}

(I know this isn´t maybe the best way ... but with the annotations I didn´t
know how to set the props and I preferred to make the important work first).


If anyone could help (or give a clue about why the interceptors are not
firing) I would be thankful.

Thanks in advance.

KR,

  Aida


[1]
http://cxf.547215.n5.nabble.com/CXF-WSS4J-Interceptors-not-working-td5727229.html#a5727488
[2] https://docs.jboss.org/author/display/JBWS/JBoss+Modules





--
View this message in context: http://cxf.547215.n5.nabble.com/Cxf-Interceptor-InInterceptor-OutInterceptor-annotations-ignored-JBoss-5-1-0-not-6-or-7-tp5747625.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: [Cxf-Interceptor] @InInterceptor/@OutInterceptor annotations ignored (JBoss 5.1.0, not 6 or 7)

Posted by Kyle Lape <kl...@redhat.com>.
JBoss AS 5 has its own web services implementation (JBossWS Native)
installed by default.  Unless you explicitly installed JBossWS-CXF in
your installation, then JBossWS Native is going to be used, which of
course won't recognize CXF annotations.

If you want, you could package CXF in your deployment and treat JBoss
like a servlet container, but then you couldn't use SLSBs as JAX-WS
endpoints (AFAIK).

--Kyle

On Mon, Aug 11, 2014 at 12:18:33PM -0700, Aida wrote:
> Hi all,
> 
> I have been googling and reading threads of this forum in order to solve
> this ...
> 
> I'm working with JBoss 5.1.0 GA, and I have EJBs as services (EJB 3.0). I'm
> trying to use the @InInterceptor and @OutInterceptor annotations in order to
> add a WSS4J interceptor (I want to sign and encrypt my messages).
> 
> I have read that in further versions of JBoss (as 6.X or 7.X) the
> annotations are ignored as is commented in [1]. In [2] says that a
> Dependency is needed in a Manifest file, but this is for JBoss AS 7 (not my
> version, anyway adding the Manifest as specified doesn´t works).
> 
> I have checked that when I call to my web-service, the interceptor that I
> add with the annotation isn´t called. I have also tried with other CXF
> Interceptors (ReadHeadersInterceptor), but no interceptor (set by me) is
> fired.
> 
> This is my service (I'm working with a proof of concept, but I'm not able to
> make it work):
> 
> @InInterceptors(interceptors =
> {"mypackage.WSSWithCertificateInInterceptor"})
> @WebService( name = "HelloWorldService", 
> 			 serviceName = "HelloWorldService",
> 			 targetNamespace = "http://mydomain/service/samples/")
> @Stateless(name = "HelloWorldService")
> @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
> public class HelloWorldServiceImpl {
> 
> 	private static String HELLO_WORLD_MESSAGE = "Hello world {0}";
> 	
> 	/**
> 	 * Hello World Operation 
> 	 */
> 	@WebMethod
> 	public String helloWorld(@WebParam(name = "name") String name){
> 		
> 		return MessageFormat.format(HELLO_WORLD_MESSAGE, name);
> 	}
> }
> 
> 
> Where WSSWithCertificateInInterceptor is just an extension of
> WSS4JInInterceptor:
> 
> public class WSSWithCertificateInInterceptor extends WSS4JInInterceptor{
> 	
> 	private static Map<String,Object> inProps= new HashMap<String,Object>() {
> 										/** generated UUID */
> 										private static final long serialVersionUID =
> -7905172475428802888L;
> 								
> 										{ 
> 											put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
> 											put(WSHandlerConstants.SIG_PROP_FILE, "server_sign.properties");
> 										}
> 									};									
> 	
> 	public WSSWithCertificateInInterceptor () {
> 		super(inProps);
> 	}
> 
> }
> 
> (I know this isn´t maybe the best way ... but with the annotations I didn´t
> know how to set the props and I preferred to make the important work first).
> 
> 
> If anyone could help (or give a clue about why the interceptors are not
> firing) I would be thankful.
> 
> Thanks in advance.
> 
> KR,
> 
>   Aida
> 
> 
> [1]
> http://cxf.547215.n5.nabble.com/CXF-WSS4J-Interceptors-not-working-td5727229.html#a5727488
> [2] https://docs.jboss.org/author/display/JBWS/JBoss+Modules
> 
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Cxf-Interceptor-InInterceptor-OutInterceptor-annotations-ignored-JBoss-5-1-0-not-6-or-7-tp5747625.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Re: [Cxf-Interceptor] @InInterceptor/@OutInterceptor annotations ignored (JBoss 5.1.0, not 6 or 7)

Posted by Aida <ai...@gmail.com>.
Thank you Daniel, I will do as you said.

Thanks

  Aida.


Daniel  Kulp wrote
> You would need to ask about this on the JBoss lists.   They have their own
> class loaders and integration things and such that can dictate some of the
> behavior around this. 
> 
> Dan
> 
> 
> 
> On Aug 11, 2014, at 3:18 PM, Aida &lt;

> ai.desu@

> &gt; wrote:
> 
>> Hi all,
>> 
>> I have been googling and reading threads of this forum in order to solve
>> this ...
>> 
>> I'm working with JBoss 5.1.0 GA, and I have EJBs as services (EJB 3.0).
>> I'm
>> trying to use the @InInterceptor and @OutInterceptor annotations in order
>> to
>> add a WSS4J interceptor (I want to sign and encrypt my messages).
>> 
>> I have read that in further versions of JBoss (as 6.X or 7.X) the
>> annotations are ignored as is commented in [1]. In [2] says that a
>> Dependency is needed in a Manifest file, but this is for JBoss AS 7 (not
>> my
>> version, anyway adding the Manifest as specified doesn´t works).
>> 
>> I have checked that when I call to my web-service, the interceptor that I
>> add with the annotation isn´t called. I have also tried with other CXF
>> Interceptors (ReadHeadersInterceptor), but no interceptor (set by me) is
>> fired.
>> 
>> This is my service (I'm working with a proof of concept, but I'm not able
>> to
>> make it work):
>> 
>> @InInterceptors(interceptors =
>> {"mypackage.WSSWithCertificateInInterceptor"})
>> @WebService( name = "HelloWorldService", 
>> 			 serviceName = "HelloWorldService",
>> 			 targetNamespace = "http://mydomain/service/samples/")
>> @Stateless(name = "HelloWorldService")
>> @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
>> public class HelloWorldServiceImpl {
>> 
>> 	private static String HELLO_WORLD_MESSAGE = "Hello world {0}";
>> 	
>> 	/**
>> 	 * Hello World Operation 
>> 	 */
>> 	@WebMethod
>> 	public String helloWorld(@WebParam(name = "name") String name){
>> 		
>> 		return MessageFormat.format(HELLO_WORLD_MESSAGE, name);
>> 	}
>> }
>> 
>> 
>> Where WSSWithCertificateInInterceptor is just an extension of
>> WSS4JInInterceptor:
>> 
>> public class WSSWithCertificateInInterceptor extends WSS4JInInterceptor{
>> 	
>> 	private static Map&lt;String,Object&gt; inProps= new
>> HashMap&lt;String,Object&gt;() {
>> 										/** generated UUID */
>> 										private static final long serialVersionUID =
>> -7905172475428802888L;
>> 								
>> 										{ 
>> 											put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
>> 											put(WSHandlerConstants.SIG_PROP_FILE,
>> "server_sign.properties");
>> 										}
>> 									};									
>> 	
>> 	public WSSWithCertificateInInterceptor () {
>> 		super(inProps);
>> 	}
>> 
>> }
>> 
>> (I know this isn´t maybe the best way ... but with the annotations I
>> didn´t
>> know how to set the props and I preferred to make the important work
>> first).
>> 
>> 
>> If anyone could help (or give a clue about why the interceptors are not
>> firing) I would be thankful.
>> 
>> Thanks in advance.
>> 
>> KR,
>> 
>>  Aida
>> 
>> 
>> [1]
>> http://cxf.547215.n5.nabble.com/CXF-WSS4J-Interceptors-not-working-td5727229.html#a5727488
>> [2] https://docs.jboss.org/author/display/JBWS/JBoss+Modules
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context:
>> http://cxf.547215.n5.nabble.com/Cxf-Interceptor-InInterceptor-OutInterceptor-annotations-ignored-JBoss-5-1-0-not-6-or-7-tp5747625.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> -- 
> Daniel Kulp

> dkulp@

>  - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com





--
View this message in context: http://cxf.547215.n5.nabble.com/Cxf-Interceptor-InInterceptor-OutInterceptor-annotations-ignored-JBoss-5-1-0-not-6-or-7-tp5747625p5747746.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: [Cxf-Interceptor] @InInterceptor/@OutInterceptor annotations ignored (JBoss 5.1.0, not 6 or 7)

Posted by Daniel Kulp <dk...@apache.org>.
You would need to ask about this on the JBoss lists.   They have their own class loaders and integration things and such that can dictate some of the behavior around this. 

Dan



On Aug 11, 2014, at 3:18 PM, Aida <ai...@gmail.com> wrote:

> Hi all,
> 
> I have been googling and reading threads of this forum in order to solve
> this ...
> 
> I'm working with JBoss 5.1.0 GA, and I have EJBs as services (EJB 3.0). I'm
> trying to use the @InInterceptor and @OutInterceptor annotations in order to
> add a WSS4J interceptor (I want to sign and encrypt my messages).
> 
> I have read that in further versions of JBoss (as 6.X or 7.X) the
> annotations are ignored as is commented in [1]. In [2] says that a
> Dependency is needed in a Manifest file, but this is for JBoss AS 7 (not my
> version, anyway adding the Manifest as specified doesn´t works).
> 
> I have checked that when I call to my web-service, the interceptor that I
> add with the annotation isn´t called. I have also tried with other CXF
> Interceptors (ReadHeadersInterceptor), but no interceptor (set by me) is
> fired.
> 
> This is my service (I'm working with a proof of concept, but I'm not able to
> make it work):
> 
> @InInterceptors(interceptors =
> {"mypackage.WSSWithCertificateInInterceptor"})
> @WebService( name = "HelloWorldService", 
> 			 serviceName = "HelloWorldService",
> 			 targetNamespace = "http://mydomain/service/samples/")
> @Stateless(name = "HelloWorldService")
> @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
> public class HelloWorldServiceImpl {
> 
> 	private static String HELLO_WORLD_MESSAGE = "Hello world {0}";
> 	
> 	/**
> 	 * Hello World Operation 
> 	 */
> 	@WebMethod
> 	public String helloWorld(@WebParam(name = "name") String name){
> 		
> 		return MessageFormat.format(HELLO_WORLD_MESSAGE, name);
> 	}
> }
> 
> 
> Where WSSWithCertificateInInterceptor is just an extension of
> WSS4JInInterceptor:
> 
> public class WSSWithCertificateInInterceptor extends WSS4JInInterceptor{
> 	
> 	private static Map<String,Object> inProps= new HashMap<String,Object>() {
> 										/** generated UUID */
> 										private static final long serialVersionUID =
> -7905172475428802888L;
> 								
> 										{ 
> 											put(WSHandlerConstants.ACTION, WSHandlerConstants.SIGNATURE);
> 											put(WSHandlerConstants.SIG_PROP_FILE, "server_sign.properties");
> 										}
> 									};									
> 	
> 	public WSSWithCertificateInInterceptor () {
> 		super(inProps);
> 	}
> 
> }
> 
> (I know this isn´t maybe the best way ... but with the annotations I didn´t
> know how to set the props and I preferred to make the important work first).
> 
> 
> If anyone could help (or give a clue about why the interceptors are not
> firing) I would be thankful.
> 
> Thanks in advance.
> 
> KR,
> 
>  Aida
> 
> 
> [1]
> http://cxf.547215.n5.nabble.com/CXF-WSS4J-Interceptors-not-working-td5727229.html#a5727488
> [2] https://docs.jboss.org/author/display/JBWS/JBoss+Modules
> 
> 
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Cxf-Interceptor-InInterceptor-OutInterceptor-annotations-ignored-JBoss-5-1-0-not-6-or-7-tp5747625.html
> Sent from the cxf-user mailing list archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com