You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by mattmadhavan <ma...@yahoo.com> on 2007/10/25 02:31:01 UTC
CXF+ACEGI setting userid/pw on the client side
Hi,
Is there any way to setup userid/pw soap header token on the client side
programatically without having to create a callback handler class etc?
I just want to create a token and add it to the soap message! My client side
can be .NET, JAVA. FLEX etc. I cannot force them to do equivalent things
(like creating callback handler to set the pw).
Any ideas?
Thanks
Matt
--
View this message in context: http://www.nabble.com/CXF%2BACEGI-setting-userid-pw-on-the-client-side-tf4687934.html#a13398044
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF+ACEGI setting userid/pw on the client side
Posted by Daniel Kulp <dk...@apache.org>.
Glen,
Those are setting the HTTP headers. (or JMS properties) That doesn't
set anything into the soap headers. With JAX-WS, there are only
two "portable" ways of adding headers to the soap message:
1) Soap message handler - you need to deal with the saaj object yourself
to get the parts added to the soap heaer
2) @WebParam(header = true) annotations on method parameters.
Both of those have limitations which is why we have the additional way of
doing it.
Dan
On Wednesday 12 December 2007, Glen Mazza wrote:
> Comment below...
>
> Am Dienstag, den 11.12.2007, 17:24 -0500 schrieb Daniel Kulp:
> > Matt,
> >
> > Somehow I missed this thread.....
> >
> > With CXF, you don't need to write a handler to add/get soap headers.
> > We actually allow setting them via the clients request context
> > (and retrieve via response context). Some samplish code:
> >
> >
> > bp = (BindingProvider)proxy;
> > Map<String, Object> requestContext = bp.getRequestContext();
> >
> > QName headerElName = new QName(ns, name);
> > SomeJAXBHeaderObject ob = new SomeJAXBHeaderObject();
> > ob.setSomeValues(...);
> > ob.setMoreValue(...);
> >
> > JAXBElement<SomeJAXBHeaderObject> ob = new
> > JAXBElement<SomeJAXBHeaderObject >(
> > headerElName, SomeJAXBHeaderObject .class, null, ob);
> >
> > Header hdr = new Header(
> > headerElName,
> > job,
> > new JAXBDataBinding(ob.getClass()));
> >
> > List<Header> holder = new ArrayList<Header>();
> > holder.add(hdr);
> >
> > //Add List of headerHolders to requestContext.
> > requestContext.put(Header.HEADER_LIST, holder);
> >
> >
> > You can query the HEADER_LIST propert on the server side if you
> > want. You can get the response headers from the responseContext the
> > same way. The "Header" object you create can also be a DOM Element.
> > If the databinding is null, it assumes it's an Element.
> >
> > That said, this is all CXF specific.
>
> This method in the Metro guide might be more portable:
>
> https://jax-ws.dev.java.net/guide/HTTP_headers.html
>
> HTH,
> Glen
>
> > Dan
> >
> > On Thursday 22 November 2007, mattmadhavan wrote:
> > > Hi David,
> > > Thanks for the reply. Yes you are correct. Thats the Java way. I
> > > found a posting for a Flex client as well. Please look at this
> > > great blog - (It was a great post on lot good stuff - but rather
> > > incomplete).
> > >
> > > http://www.jroller.com/wookets/
> > >
> > > I wish this guy makes the examples more complete though!
> > >
> > > Thanks again,
> > > Matt
> > >
> > > Davide Gesino wrote:
> > > > Hi,
> > > >
> > > > I do not think so, I think you have to create a message handler,
> > > > that adds token you want to the soap header and put iit in a
> > > > handler chain if you're working in java.
> > > > Anyway this info have to go in a SOAP header.
> > > > Theoretically you could construct the XML soap request
> > > > programmatically (also in Java)... but it is pain.
> > > > Using other languages I guess there is some high level API (in
> > > > .NET at least) to add this kind of header, that on the server
> > > > side will be processed in a jax-ws fashion.
> > > > For .Net You could watch to the java project tango web site and
> > > > see if there is something worth about it.
> > > > I don't know if I have said something useful ;-)
> > > >
> > > > mattmadhavan wrote:
> > > >> Hi,
> > > >> Is there any way to setup userid/pw soap header token on the
> > > >> client side programatically without having to create a callback
> > > >> handler class etc?
> > > >>
> > > >> I just want to create a token and add it to the soap message!
> > > >> My client side can be .NET, JAVA. FLEX etc. I cannot force them
> > > >> to do equivalent things (like creating callback handler to set
> > > >> the pw).
> > > >>
> > > >> Any ideas?
> > > >>
> > > >> Thanks
> > > >> Matt
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: CXF+ACEGI setting userid/pw on the client side
Posted by Glen Mazza <gl...@verizon.net>.
Comment below...
Am Dienstag, den 11.12.2007, 17:24 -0500 schrieb Daniel Kulp:
> Matt,
>
> Somehow I missed this thread.....
>
> With CXF, you don't need to write a handler to add/get soap headers. We
> actually allow setting them via the clients request context (and
> retrieve via response context). Some samplish code:
>
>
> bp = (BindingProvider)proxy;
> Map<String, Object> requestContext = bp.getRequestContext();
>
> QName headerElName = new QName(ns, name);
> SomeJAXBHeaderObject ob = new SomeJAXBHeaderObject();
> ob.setSomeValues(...);
> ob.setMoreValue(...);
>
> JAXBElement<SomeJAXBHeaderObject> ob = new
> JAXBElement<SomeJAXBHeaderObject >(
> headerElName, SomeJAXBHeaderObject .class, null, ob);
>
> Header hdr = new Header(
> headerElName,
> job,
> new JAXBDataBinding(ob.getClass()));
>
> List<Header> holder = new ArrayList<Header>();
> holder.add(hdr);
>
> //Add List of headerHolders to requestContext.
> requestContext.put(Header.HEADER_LIST, holder);
>
>
> You can query the HEADER_LIST propert on the server side if you want.
> You can get the response headers from the responseContext the same way.
> The "Header" object you create can also be a DOM Element. If the
> databinding is null, it assumes it's an Element.
>
> That said, this is all CXF specific.
>
This method in the Metro guide might be more portable:
https://jax-ws.dev.java.net/guide/HTTP_headers.html
HTH,
Glen
> Dan
>
>
>
>
> On Thursday 22 November 2007, mattmadhavan wrote:
> > Hi David,
> > Thanks for the reply. Yes you are correct. Thats the Java way. I found
> > a posting for a Flex client as well. Please look at this great blog -
> > (It was a great post on lot good stuff - but rather incomplete).
> >
> > http://www.jroller.com/wookets/
> >
> > I wish this guy makes the examples more complete though!
> >
> > Thanks again,
> > Matt
> >
> > Davide Gesino wrote:
> > > Hi,
> > >
> > > I do not think so, I think you have to create a message handler,
> > > that adds token you want to the soap header and put iit in a handler
> > > chain if you're working in java.
> > > Anyway this info have to go in a SOAP header.
> > > Theoretically you could construct the XML soap request
> > > programmatically (also in Java)... but it is pain.
> > > Using other languages I guess there is some high level API (in .NET
> > > at least) to add this kind of header, that on the server side will
> > > be processed in a jax-ws fashion.
> > > For .Net You could watch to the java project tango web site and see
> > > if there is something worth about it.
> > > I don't know if I have said something useful ;-)
> > >
> > > mattmadhavan wrote:
> > >> Hi,
> > >> Is there any way to setup userid/pw soap header token on the client
> > >> side programatically without having to create a callback handler
> > >> class etc?
> > >>
> > >> I just want to create a token and add it to the soap message! My
> > >> client side can be .NET, JAVA. FLEX etc. I cannot force them to do
> > >> equivalent things (like creating callback handler to set the pw).
> > >>
> > >> Any ideas?
> > >>
> > >> Thanks
> > >> Matt
>
>
>
Re: CXF+ACEGI setting userid/pw on the client side
Posted by Daniel Kulp <dk...@apache.org>.
Matt,
Somehow I missed this thread.....
With CXF, you don't need to write a handler to add/get soap headers. We
actually allow setting them via the clients request context (and
retrieve via response context). Some samplish code:
bp = (BindingProvider)proxy;
Map<String, Object> requestContext = bp.getRequestContext();
QName headerElName = new QName(ns, name);
SomeJAXBHeaderObject ob = new SomeJAXBHeaderObject();
ob.setSomeValues(...);
ob.setMoreValue(...);
JAXBElement<SomeJAXBHeaderObject> ob = new
JAXBElement<SomeJAXBHeaderObject >(
headerElName, SomeJAXBHeaderObject .class, null, ob);
Header hdr = new Header(
headerElName,
job,
new JAXBDataBinding(ob.getClass()));
List<Header> holder = new ArrayList<Header>();
holder.add(hdr);
//Add List of headerHolders to requestContext.
requestContext.put(Header.HEADER_LIST, holder);
You can query the HEADER_LIST propert on the server side if you want.
You can get the response headers from the responseContext the same way.
The "Header" object you create can also be a DOM Element. If the
databinding is null, it assumes it's an Element.
That said, this is all CXF specific.
Dan
On Thursday 22 November 2007, mattmadhavan wrote:
> Hi David,
> Thanks for the reply. Yes you are correct. Thats the Java way. I found
> a posting for a Flex client as well. Please look at this great blog -
> (It was a great post on lot good stuff - but rather incomplete).
>
> http://www.jroller.com/wookets/
>
> I wish this guy makes the examples more complete though!
>
> Thanks again,
> Matt
>
> Davide Gesino wrote:
> > Hi,
> >
> > I do not think so, I think you have to create a message handler,
> > that adds token you want to the soap header and put iit in a handler
> > chain if you're working in java.
> > Anyway this info have to go in a SOAP header.
> > Theoretically you could construct the XML soap request
> > programmatically (also in Java)... but it is pain.
> > Using other languages I guess there is some high level API (in .NET
> > at least) to add this kind of header, that on the server side will
> > be processed in a jax-ws fashion.
> > For .Net You could watch to the java project tango web site and see
> > if there is something worth about it.
> > I don't know if I have said something useful ;-)
> >
> > mattmadhavan wrote:
> >> Hi,
> >> Is there any way to setup userid/pw soap header token on the client
> >> side programatically without having to create a callback handler
> >> class etc?
> >>
> >> I just want to create a token and add it to the soap message! My
> >> client side can be .NET, JAVA. FLEX etc. I cannot force them to do
> >> equivalent things (like creating callback handler to set the pw).
> >>
> >> Any ideas?
> >>
> >> Thanks
> >> Matt
--
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727 C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog
Re: CXF+ACEGI setting userid/pw on the client side
Posted by mattmadhavan <ma...@yahoo.com>.
Hi David,
Thanks for the reply. Yes you are correct. Thats the Java way. I found a
posting for a Flex client as well. Please look at this great blog - (It was
a great post on lot good stuff - but rather incomplete).
http://www.jroller.com/wookets/
I wish this guy makes the examples more complete though!
Thanks again,
Matt
Davide Gesino wrote:
>
> Hi,
>
> I do not think so, I think you have to create a message handler, that adds
> token you want to the soap header and put iit in a handler chain if you're
> working in java.
> Anyway this info have to go in a SOAP header.
> Theoretically you could construct the XML soap request programmatically
> (also in Java)... but it is pain.
> Using other languages I guess there is some high level API (in .NET at
> least) to add this kind of header, that on the server side will be
> processed in a jax-ws fashion.
> For .Net You could watch to the java project tango web site and see if
> there is something worth about it.
> I don't know if I have said something useful ;-)
>
>
>
> mattmadhavan wrote:
>>
>> Hi,
>> Is there any way to setup userid/pw soap header token on the client side
>> programatically without having to create a callback handler class etc?
>>
>> I just want to create a token and add it to the soap message! My client
>> side can be .NET, JAVA. FLEX etc. I cannot force them to do equivalent
>> things (like creating callback handler to set the pw).
>>
>> Any ideas?
>>
>> Thanks
>> Matt
>>
>
>
--
View this message in context: http://www.nabble.com/CXF%2BACEGI-setting-userid-pw-on-the-client-side-tf4687934.html#a13902156
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF+ACEGI setting userid/pw on the client side
Posted by Davide Gesino <wi...@libero.it>.
Hi,
I do not think so, I think you have to create a message handler, that adds
token you want to the soap header and put iit in a handler chain if you're
working in java.
Anyway this info have to go in a SOAP header.
Theoretically you could construct the XML soap request programmatically
(also in Java)... but it is pain.
Using other languages I guess there is some high level API (in .NET at
least) to add this kind of header, that on the server side will be processed
in a jax-ws fashion.
For .Net You could watch to the java project tango web site and see if there
is something worth about it.
I don't know if I have said something useful ;-)
mattmadhavan wrote:
>
> Hi,
> Is there any way to setup userid/pw soap header token on the client side
> programatically without having to create a callback handler class etc?
>
> I just want to create a token and add it to the soap message! My client
> side can be .NET, JAVA. FLEX etc. I cannot force them to do equivalent
> things (like creating callback handler to set the pw).
>
> Any ideas?
>
> Thanks
> Matt
>
--
View this message in context: http://www.nabble.com/CXF%2BACEGI-setting-userid-pw-on-the-client-side-tf4687934.html#a13900208
Sent from the cxf-user mailing list archive at Nabble.com.