You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Mustafa alagoz <mu...@gmail.com> on 2010/11/24 13:15:39 UTC

Extracting EndpoingReference ID from EndpointReferenceType

hi all,

I'm working on project where we need to implement stateful web-services (I
know its not really recommended :)) .. At one point, I have a
W3CEndpointReference on the server side that is submitted by the client. And
within that W3CEndpointReference there is the reference parameter, ID, that
I would like to access.. In order to use the endpoint reference I convert
W3CEndpointReference to EndpointReferenceType using VersionTransformer.. But
after that I could not find a way to get the reference parameters,
particularly ID, from the EndpointReferenceType..

Using EndpointReferenceUtils.getEndpointReferenceID(Map) I can get the ID
I'm looking for, and I use it in some cases. But in that particular case I
described above, I need to extract the ID from EndpointReferenceType. Is
there an easy way to do that or I need to traverse the DOM tree myself and
find the ID..

hava a nice day,
Mustafa..

Re: Extracting EndpoingReference ID from EndpointReferenceType

Posted by Daniel Kulp <dk...@apache.org>.
On Wednesday 24 November 2010 7:15:39 am Mustafa alagoz wrote:
> hi all,
> 
> I'm working on project where we need to implement stateful web-services (I
> know its not really recommended :)) .. At one point, I have a
> W3CEndpointReference on the server side that is submitted by the client.
> And within that W3CEndpointReference there is the reference parameter, ID,
> that I would like to access.. In order to use the endpoint reference I
> convert W3CEndpointReference to EndpointReferenceType using
> VersionTransformer.. But after that I could not find a way to get the
> reference parameters, particularly ID, from the EndpointReferenceType..
> 
> Using EndpointReferenceUtils.getEndpointReferenceID(Map) I can get the ID
> I'm looking for, and I use it in some cases. But in that particular case I
> described above, I need to extract the ID from EndpointReferenceType. Is
> there an easy way to do that or I need to traverse the DOM tree myself and
> find the ID..

You've pretty much identified one of my annoyances with the 
javax.xml.ws.EndpointReference things.   It's pretty much useless to use as is 
as there aren't any accessors for anything.  You need to convert it to a DOM 
and re-process.       If you generate code from the WSDL, you can add 
"-noAddressBinding" to wsdl2java to have it not generate the 
javax.xml.ws.EndpointReference type and use better JAXB generated types which 
allows at least skipping the bounce through DOM step.   

That said, if you have the EndpointReferenceType, you should be able to call:

ep.getReferenceParameters().getAny();

and then iterate through the List.   I THINK in your case, there should be a 
Element in there with your ID name.   Not 100% sure though.


-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog