You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "marcin.kasinski" <ma...@gmail.com> on 2013/03/01 16:31:37 UTC

Operation name null in inInterceptor

I have simple code found here (cxf forum) which reads operation inside
interceptor.

				OperationInfo opInfo = message.getExchange().get(OperationInfo.class);
				String operationName = opInfo == null ? null :
				opInfo.getName().getLocalPart();

				if (operationName == null) {
				       Object nameProperty =
message.getExchange().get("org.apache.cxf.resource.operation.name");
				       if (nameProperty !=  null) {
				           operationName = nameProperty.toString();
				       }
				} 
				

In my service I added in and out interceptor with the same code.

Problem is that this code works only in out intercetor. It returns "hello"
In my in interceptor it gets null.

My constructor definition is:

	public MessageLogInterceptor() {
		super("pre-stream");
		super.addBefore(StaxOutInterceptor.class.getName());
	}

 



-----

Regards
Marcin Kasinski
http://itzone.com.pl
--
View this message in context: http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Operation name null in inInterceptor

Posted by Jason Pell <ja...@pellcorp.com>.
You can get your interceptor in after the wss4j interceptor easily.

Find out the phase of the wss4jinterceptor either in the source - you will
find it usually in the constructor or there is a doc that lists the phases
of common interceptors i believe.

Then in your interceptor use the same phase but then add

getAfter().add(WSS4JInInterceptor.class.getName());
On Mar 2, 2013 4:16 AM, "marcin.kasinski" <ma...@gmail.com> wrote:

> I'm using 2 in WSS4JInInterceptor and my custom interceptor.
>
> I can not read operation name because mesage is encrypted.
>
> My question is :
> how to put my custom interceptor just after WSS4JInInterceptor to let me
> read operation name from decrypted message ?
>
> Which phase should I use ?
>
>
>
> -----
>
> Regards
> Marcin Kasinski
> http://itzone.com.pl
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927p5723928.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>

RE: Operation name null in inInterceptor

Posted by Andrei Shakirin <as...@talend.com>.
Hi,

In inbound chain CXF has three sources/options to determine operation name:
1. WS-Addressing headers
2. SOAP Action (it works only with HTTP protocol)
3. Top payload element (regarding WS-I basic profile top element name of input message should be the equals to operation name).

In case if you use document literal binding and JAXB marshalling, DocLiteralInInterceptor builds OperationInfo.class structure based on payload (option 3). 
DocLiteralInInterceptor also unmarshalls XML payload and packs input parameters as MessageContentList into message content on UNMARSHAL phase.

As far as message is already read from XML reader in DocLiteralInInterceptor, you cannot read it again in you interceptor placed after UNMARSHAL phase, but you have access to OperationInfo.class and unmarshalled payload in form of MessageContentList.

There are some options to resolve it, but I would like to understand your use case a little bit more: is unmarshalled payload not usable for your interceptor? Do you need message in stream form?

Cheers,
Andrei.

> -----Original Message-----
> From: marcin.kasinski [mailto:marcin.kasinski@gmail.com]
> Sent: Samstag, 2. März 2013 21:11
> To: dev@cxf.apache.org
> Subject: Re: Operation name null in inInterceptor
> 
> After additional debugging....
> 
> Phase UNMARSHAL = here I can read operation name using
> OperationInfo.class , but can not read input XML.
> 
> Phase before  UNMARSHAL  (RECEIVE, READ,...)= here I CAN NOT read
> operation name using OperationInfo.class , but can read input XML.
> 
> Now my question is :
> 
> Is there any chance to read OperationInfo and input XML in one phase in
> input service interceptor ?
> 
> 
> 
> 
> 
> -----
> 
> Regards
> Marcin Kasinski
> http://itzone.com.pl
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Operation-
> name-null-in-inInterceptor-tp5723927p5723958.html
> Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Operation name null in inInterceptor

Posted by "marcin.kasinski" <ma...@gmail.com>.
After additional debugging....

Phase UNMARSHAL = here I can read operation name using OperationInfo.class ,
but can not read input XML.

Phase before  UNMARSHAL  (RECEIVE, READ,...)= here I CAN NOT read operation
name using OperationInfo.class , but can read input XML.

Now my question is :

Is there any chance to read OperationInfo and input XML in one phase in
input service interceptor ?





-----

Regards
Marcin Kasinski
http://itzone.com.pl
--
View this message in context: http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927p5723958.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Operation name null in inInterceptor

Posted by "marcin.kasinski" <ma...@gmail.com>.
Additional info :

In constructor I have:

super("pre-stream");
		super.addBefore(StaxOutInterceptor.class.getName());


I place My customInterceptor in my client and Service in and out
interceptor.

Client in interceptor : I can read operationName with code above.
Client out interceptor : I can read operationName with code above.
Service in interceptor : I GET NULL operationName with code above.
Service out interceptor : I can read operationName with code above.


Can you help me with this ?



-----

Regards
Marcin Kasinski
http://itzone.com.pl
--
View this message in context: http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927p5723950.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Operation name null in inInterceptor

Posted by "marcin.kasinski" <ma...@gmail.com>.
After removing WSS4JInInterceptor I also cannot red operation name in my
custom ininterceptor.



-----

Regards
Marcin Kasinski
http://itzone.com.pl
--
View this message in context: http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927p5723937.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Operation name null in inInterceptor

Posted by "marcin.kasinski" <ma...@gmail.com>.
I'm using 2 in WSS4JInInterceptor and my custom interceptor.

I can not read operation name because mesage is encrypted.

My question is :
how to put my custom interceptor just after WSS4JInInterceptor to let me
read operation name from decrypted message ?

Which phase should I use ?



-----

Regards
Marcin Kasinski
http://itzone.com.pl
--
View this message in context: http://cxf.547215.n5.nabble.com/Operation-name-null-in-inInterceptor-tp5723927p5723928.html
Sent from the cxf-user mailing list archive at Nabble.com.