Fyi, there is a class called XmlBeanUtils that comes with Apollo that
contains a number of handy methods for working with XmlBeans. For what
you're trying to do, there is a getChildElements() method that would
work nicely. You could use it as follows:
XmlObject[] childElems = XmlBeanUtils.getChildElements( rp, qname );
There's another method you could then use to get the element's text value:
String value = XmlBeanUtils.getValue( childElems[0] );
--Ian
Shahzad Younas wrote:
I used the XMLCursor way. It's a nice 2 liner!!
Thanks guys for your help!
That's ONE problem out of the way!!
Shahzad
-----Original Message-----
From: Michael Marks [mailto:[EMAIL PROTECTED]
Sent: 22 March 2005 13:57
To: [email protected]
Subject: Re: extracting the resource ID
This is another working way :-).
Mike
Hi,
You have to use the XMLBeans XmlCursor API like this
ReferencePropertiesType rp =
responseDoc.getCreateShibbolethBrowserSessionResponse().getShibbolethBrowser
SessionReference().getReferenceProperties()Shahzad
XmlCursor xc = rp.newCursor();
Now you can use the XmlCursor API to get the Elements inside the RP.
stefan
Younas wrote:
That looks like a nice easy way!
But...
MessageElement resourceIDElement =
responseDoc.getCreateShibbolethBrowserSessionResponse().getShibbolethBr
owser
SessionReference().getReferenceProperties().get(qname);
When I do this, it complains that "get" method is not defined. This
is because a "ReferencePropertiesType" is returned by the
getReferenceProperties() method.
How can I resolve this?
Thanks
Shahzad
-----Original Message-----
From: Michael Marks [mailto:[EMAIL PROTECTED]
Sent: 22 March 2005 13:38
To: [email protected]
Subject: Re: extracting the resource ID
Hi Shahzad,
using the wsfx-addressing and wsa-xmlbeans - way, your solution could
look
like that:
QName qname = new
QName("http://ShibbolethBrowserSession/ShibbolethBrowserSession.wsdl","
Resou
rceID");
MessageElement resourceIDElement =
epr.getReferenceProperties().get(qname);
String id = resourceIDElement.getNodeValue();
Good Luck
Michael
Hi Shahzad,
Sorry for my last mail. I did not read, that you mean the client side.
I have some questions to your use case. It seems, you are returning
a WS-A endpointreference which contains your id as a ResourceProperty.
On the client side, there are also many ways to rome :-)
First one:
you could make use of the WSFX-Addressing project. Just create a
wsdl which makes use of ws-addressing endpointreference type and
generate the client code with the "normal" Axis Framework and the
wsfx-addressing project.
If you choose this way and you need more to know, on how to achieve
this please ask.
Second one:
you could use XMLBeans on the client side too. Just parse the
response Body into your XMLBean and use the methods from XMLBeans to
extract the RP. There is also a wsa-xbeans library out there, which
you could
use.
Just gimme more info :-)
stefan
Stefan Lischke wrote:
Hi Shahzad,
There are many way to do this.
The first one:
In your service Methode, just call:
Resource rs = getResource();
Object id = rs.getID();
the second one,
In your service Methode, just call:
ResourceKey rk =getResourceKey()
Object id = rk.getValue().
But remember you Service must extend the AbstractPortType, or one
of the classes that extends AbstractPortType
hope that helps
stefan
Shahzad Younas wrote:
Hi,
I am trying to (on the client side) extract the resource ID from a
soap body of an incoming message.
byte[] tmp = senv.getBody().getFirstChild().toString().getBytes();
ByteArrayInputStream byteInput = new ByteArrayInputStream (tmp);
CreateShibbolethBrowserSessionResponseDocument responseDoc =
CreateShibbolethBrowserSessionResponseDocument.Factory.parse(byteInp
ut
);
log.info("ID:" +
responseDoc.getCreateShibbolethBrowserSessionResponse().getShibbolethBr
owser
SessionReference().getReferenceProperties());
However, this prints out:
ID:<xml-fragment
xmlns:shib="http://ShibbolethBrowserSession/ShibbolethBrowserSession.xsd"
xmlns:add="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:shib1="http://ShibbolethBrowserSession/ShibbolethBrowserSession.w
sdl">
<shib1:ResourceID>ShibbolethBrowserSessionResource1</shib1:ResourceI
D>
</xml-fragment>
How can I JUST extract the "ResourceID" ? I cant seem to see any
"get" methods for going this.
Thank you
Shahzad
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]