You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by David Hay <da...@enstratius.com> on 2014/03/28 14:46:56 UTC

Access to SOAP parameters and parameter names in interceptor

Hi,

I'm sure this has been asked before, but I can't seem to find the answer.

I need to validate SOAP parameters, so need to access the incoming
parameter name/value in a Interceptor.

How would I do this?

cheers

David

Re: Access to SOAP parameters and parameter names in interceptor

Posted by Daniel Kulp <dk...@apache.org>.
On Mar 31, 2014, at 3:49 PM, David Hay <da...@enstratius.com> wrote:

> Ok, yes, that's what I'm doing on the REST side.
> 
> I've added @WebParam for the SOAP calls, but can't figure out how to access
> it by name.  Where should I expect to see them?

On the SOAP side, if you grab the BindingOperationInfo from the exchange:

BindingOperationInfo bop = exchange.getBindingOperationInfo();

you can then do:

bop.getInput().getMessageParts()

to then iterate over the parts that it deserialized.  Each part would have the “name” as well as the index into the MessageContentsList as to where that part was stored.

Dan



> 
> 
> 
> On Fri, Mar 28, 2014 at 12:37 PM, Sergey Beryozkin <sb...@gmail.com>wrote:
> 
>> You probably refer to the names set in annotations like PathParam("id") ?
>> If so then Soap WebParam should give the same info...
>> 
>> Cheers, Sergey
>> 
>> 
>> On 28/03/14 16:34, David Hay wrote:
>> 
>>> Thanks...
>>> 
>>> Unfortunately it looks like Method only gives you the param names if debug
>>> is enabled during compilation...
>>> 
>>> CXF has that info for REST calls - it doesn't for SOAP?
>>> 
>>> 
>>> On Fri, Mar 28, 2014 at 11:49 AM, Sergey Beryozkin <sberyozkin@gmail.com
>>>> wrote:
>>> 
>>> This should give the list of parameters:
>>>> final List< Object > arguments = MessageContentsList.
>>>> getContentsList(message);
>>>> 
>>>> (the values are in the order the parameters are declared)
>>>> and given the Method you can get to the names.
>>>> 
>>>> By the way, check Bean Validation feature, it will work for JAXWS,
>>>> 
>>>> http://cxf.apache.org/docs/validationfeature.html#ValidationFeature-
>>>> Configuration
>>>> 
>>>> Andriy Redko has just blogged about it too:
>>>> http://aredko.blogspot.ie/2014/03/apache-cxf-30-jax-rs-20-and-bean.html
>>>> 
>>>> Sergey
>>>> 
>>>> 
>>>> 
>>>> On 28/03/14 15:38, David Hay wrote:
>>>> 
>>>> Hi,
>>>>> 
>>>>> Sorry if I wasn't clear - I'm trying to access the parameters passed to
>>>>> the
>>>>> backend SOAP Service methods, so x and y in this case...
>>>>> 
>>>>> public void doThis(String x, String y) {...}
>>>>> 
>>>>> 
>>>>> On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
>>>>> <de...@gmail.com>wrote:
>>>>> 
>>>>>  2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
>>>>> 
>>>>>> 
>>>>>> Hi,
>>>>>>> 
>>>>>>> I'm sure this has been asked before, but I can't seem to find the
>>>>>>> answer.
>>>>>>> 
>>>>>>> I need to validate SOAP parameters, so need to access the incoming
>>>>>>> parameter name/value in a Interceptor.
>>>>>>> 
>>>>>>> 
>>>>>>> What kind of SOAP parameters ?
>>>>>> 
>>>>>> 
>>>>>>  How would I do this?
>>>>>> 
>>>>>>> 
>>>>>>> cheers
>>>>>>> 
>>>>>>> David
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> --
>>>> Sergey Beryozkin
>>>> 
>>>> Talend Community Coders
>>>> http://coders.talend.com/
>>>> 
>>>> Blog: http://sberyozkin.blogspot.com
>>>> 
>>>> 
>>> 
>> 

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


Re: Access to SOAP parameters and parameter names in interceptor

Posted by David Hay <da...@enstratius.com>.
Ok, yes, that's what I'm doing on the REST side.

I've added @WebParam for the SOAP calls, but can't figure out how to access
it by name.  Where should I expect to see them?



On Fri, Mar 28, 2014 at 12:37 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> You probably refer to the names set in annotations like PathParam("id") ?
> If so then Soap WebParam should give the same info...
>
> Cheers, Sergey
>
>
> On 28/03/14 16:34, David Hay wrote:
>
>> Thanks...
>>
>> Unfortunately it looks like Method only gives you the param names if debug
>> is enabled during compilation...
>>
>> CXF has that info for REST calls - it doesn't for SOAP?
>>
>>
>> On Fri, Mar 28, 2014 at 11:49 AM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>>
>>  This should give the list of parameters:
>>> final List< Object > arguments = MessageContentsList.
>>> getContentsList(message);
>>>
>>> (the values are in the order the parameters are declared)
>>> and given the Method you can get to the names.
>>>
>>> By the way, check Bean Validation feature, it will work for JAXWS,
>>>
>>> http://cxf.apache.org/docs/validationfeature.html#ValidationFeature-
>>> Configuration
>>>
>>> Andriy Redko has just blogged about it too:
>>> http://aredko.blogspot.ie/2014/03/apache-cxf-30-jax-rs-20-and-bean.html
>>>
>>> Sergey
>>>
>>>
>>>
>>> On 28/03/14 15:38, David Hay wrote:
>>>
>>>  Hi,
>>>>
>>>> Sorry if I wasn't clear - I'm trying to access the parameters passed to
>>>> the
>>>> backend SOAP Service methods, so x and y in this case...
>>>>
>>>> public void doThis(String x, String y) {...}
>>>>
>>>>
>>>> On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
>>>> <de...@gmail.com>wrote:
>>>>
>>>>   2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
>>>>
>>>>>
>>>>>  Hi,
>>>>>>
>>>>>> I'm sure this has been asked before, but I can't seem to find the
>>>>>> answer.
>>>>>>
>>>>>> I need to validate SOAP parameters, so need to access the incoming
>>>>>> parameter name/value in a Interceptor.
>>>>>>
>>>>>>
>>>>>>  What kind of SOAP parameters ?
>>>>>
>>>>>
>>>>>   How would I do this?
>>>>>
>>>>>>
>>>>>> cheers
>>>>>>
>>>>>> David
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>> --
>>> Sergey Beryozkin
>>>
>>> Talend Community Coders
>>> http://coders.talend.com/
>>>
>>> Blog: http://sberyozkin.blogspot.com
>>>
>>>
>>
>

Re: Access to SOAP parameters and parameter names in interceptor

Posted by Sergey Beryozkin <sb...@gmail.com>.
You probably refer to the names set in annotations like PathParam("id") 
? If so then Soap WebParam should give the same info...

Cheers, Sergey

On 28/03/14 16:34, David Hay wrote:
> Thanks...
>
> Unfortunately it looks like Method only gives you the param names if debug
> is enabled during compilation...
>
> CXF has that info for REST calls - it doesn't for SOAP?
>
>
> On Fri, Mar 28, 2014 at 11:49 AM, Sergey Beryozkin <sb...@gmail.com>wrote:
>
>> This should give the list of parameters:
>> final List< Object > arguments = MessageContentsList.
>> getContentsList(message);
>>
>> (the values are in the order the parameters are declared)
>> and given the Method you can get to the names.
>>
>> By the way, check Bean Validation feature, it will work for JAXWS,
>>
>> http://cxf.apache.org/docs/validationfeature.html#ValidationFeature-
>> Configuration
>>
>> Andriy Redko has just blogged about it too:
>> http://aredko.blogspot.ie/2014/03/apache-cxf-30-jax-rs-20-and-bean.html
>>
>> Sergey
>>
>>
>>
>> On 28/03/14 15:38, David Hay wrote:
>>
>>> Hi,
>>>
>>> Sorry if I wasn't clear - I'm trying to access the parameters passed to
>>> the
>>> backend SOAP Service methods, so x and y in this case...
>>>
>>> public void doThis(String x, String y) {...}
>>>
>>>
>>> On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
>>> <de...@gmail.com>wrote:
>>>
>>>   2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm sure this has been asked before, but I can't seem to find the
>>>>> answer.
>>>>>
>>>>> I need to validate SOAP parameters, so need to access the incoming
>>>>> parameter name/value in a Interceptor.
>>>>>
>>>>>
>>>> What kind of SOAP parameters ?
>>>>
>>>>
>>>>   How would I do this?
>>>>>
>>>>> cheers
>>>>>
>>>>> David
>>>>>
>>>>
>>>>
>>>
>>
>> --
>> Sergey Beryozkin
>>
>> Talend Community Coders
>> http://coders.talend.com/
>>
>> Blog: http://sberyozkin.blogspot.com
>>
>


Re: Access to SOAP parameters and parameter names in interceptor

Posted by David Hay <da...@enstratius.com>.
Thanks...

Unfortunately it looks like Method only gives you the param names if debug
is enabled during compilation...

CXF has that info for REST calls - it doesn't for SOAP?


On Fri, Mar 28, 2014 at 11:49 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> This should give the list of parameters:
> final List< Object > arguments = MessageContentsList.
> getContentsList(message);
>
> (the values are in the order the parameters are declared)
> and given the Method you can get to the names.
>
> By the way, check Bean Validation feature, it will work for JAXWS,
>
> http://cxf.apache.org/docs/validationfeature.html#ValidationFeature-
> Configuration
>
> Andriy Redko has just blogged about it too:
> http://aredko.blogspot.ie/2014/03/apache-cxf-30-jax-rs-20-and-bean.html
>
> Sergey
>
>
>
> On 28/03/14 15:38, David Hay wrote:
>
>> Hi,
>>
>> Sorry if I wasn't clear - I'm trying to access the parameters passed to
>> the
>> backend SOAP Service methods, so x and y in this case...
>>
>> public void doThis(String x, String y) {...}
>>
>>
>> On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
>> <de...@gmail.com>wrote:
>>
>>  2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
>>>
>>>> Hi,
>>>>
>>>> I'm sure this has been asked before, but I can't seem to find the
>>>> answer.
>>>>
>>>> I need to validate SOAP parameters, so need to access the incoming
>>>> parameter name/value in a Interceptor.
>>>>
>>>>
>>> What kind of SOAP parameters ?
>>>
>>>
>>>  How would I do this?
>>>>
>>>> cheers
>>>>
>>>> David
>>>>
>>>
>>>
>>
>
> --
> Sergey Beryozkin
>
> Talend Community Coders
> http://coders.talend.com/
>
> Blog: http://sberyozkin.blogspot.com
>

Re: Access to SOAP parameters and parameter names in interceptor

Posted by Sergey Beryozkin <sb...@gmail.com>.
This should give the list of parameters:
final List< Object > arguments = 
MessageContentsList.getContentsList(message);

(the values are in the order the parameters are declared)
and given the Method you can get to the names.

By the way, check Bean Validation feature, it will work for JAXWS,

http://cxf.apache.org/docs/validationfeature.html#ValidationFeature-Configuration

Andriy Redko has just blogged about it too:
http://aredko.blogspot.ie/2014/03/apache-cxf-30-jax-rs-20-and-bean.html

Sergey


On 28/03/14 15:38, David Hay wrote:
> Hi,
>
> Sorry if I wasn't clear - I'm trying to access the parameters passed to the
> backend SOAP Service methods, so x and y in this case...
>
> public void doThis(String x, String y) {...}
>
>
> On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
> <de...@gmail.com>wrote:
>
>> 2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
>>> Hi,
>>>
>>> I'm sure this has been asked before, but I can't seem to find the answer.
>>>
>>> I need to validate SOAP parameters, so need to access the incoming
>>> parameter name/value in a Interceptor.
>>>
>>
>> What kind of SOAP parameters ?
>>
>>
>>> How would I do this?
>>>
>>> cheers
>>>
>>> David
>>
>


-- 
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Blog: http://sberyozkin.blogspot.com

Re: Access to SOAP parameters and parameter names in interceptor

Posted by David Hay <da...@enstratius.com>.
Hi,

Sorry if I wasn't clear - I'm trying to access the parameters passed to the
backend SOAP Service methods, so x and y in this case...

public void doThis(String x, String y) {...}


On Fri, Mar 28, 2014 at 9:49 AM, Jose María Zaragoza
<de...@gmail.com>wrote:

> 2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
> > Hi,
> >
> > I'm sure this has been asked before, but I can't seem to find the answer.
> >
> > I need to validate SOAP parameters, so need to access the incoming
> > parameter name/value in a Interceptor.
> >
>
> What kind of SOAP parameters ?
>
>
> > How would I do this?
> >
> > cheers
> >
> > David
>

Re: Access to SOAP parameters and parameter names in interceptor

Posted by Jose María Zaragoza <de...@gmail.com>.
2014-03-28 14:46 GMT+01:00 David Hay <da...@enstratius.com>:
> Hi,
>
> I'm sure this has been asked before, but I can't seem to find the answer.
>
> I need to validate SOAP parameters, so need to access the incoming
> parameter name/value in a Interceptor.
>

What kind of SOAP parameters ?


> How would I do this?
>
> cheers
>
> David

RE: Access to SOAP parameters and parameter names in interceptor

Posted by Michael Hoffman <mi...@hotmail.com>.
David,
 
One resource to check out is Glen Mazza's weblog on custom interceptors:
 
http://www.jroller.com/gmazza/entry/jaxwshandlers_to_cxfinterceptors
 
You can implement an interceptor based on the AbstractSoapInterceptor as part of the server inbound interceptor chain. This will give you access to the full SOAP message. Please pay close attention to the notes in the weblog regarding the interceptor phase you select. 
 
Best Regards,
 
Michael Hoffman
 
> Date: Fri, 28 Mar 2014 09:46:56 -0400
> Subject: Access to SOAP parameters and parameter names in interceptor
> From: david.hay@enstratius.com
> To: users@cxf.apache.org
> 
> Hi,
> 
> I'm sure this has been asked before, but I can't seem to find the answer.
> 
> I need to validate SOAP parameters, so need to access the incoming
> parameter name/value in a Interceptor.
> 
> How would I do this?
> 
> cheers
> 
> David