Hi,
I want to notify you about a problem into
SimpleCoordinationContext(OMElement contextElement) constructor. When it
is invoked the following code is executed:
...
activityID = contextElement.getFirstChildWithName(
new QName("Identifier")).getText();
coordinationType = contextElement.getFirstChildWithName(
new
QName("CoordinationType")).getText();
OMElement registrationElement = contextElement
.getFirstChildWithName(new
QName("RegistrationService"));
....
In this case NullPointerException is thrown by
contextElement.getFirstChildWithName(new QName("Identifier")).getText();
when the given contextElement represents for example:
<CoordinationContext
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://docs.oasis-open.org/ws-tx/wscoor/2006/06"
xsi:type=":CoordinationContext_type3">
<Identifier>http:thilina</Identifier>
<Expires>0</Expires>
<CoordinationType>http://docs.oasis-open.org/ws-tx/wsat/2006/03</Coordin
ationType>
<RegistrationService>
<Address
xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://127.0.0.
1:8081/axis2/services/RegistrationCoordinator</Address>
<ReferenceParameters
xmlns="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<kand:TransactionID
xmlns:kand="http://ws.apache.org/kandula">urn:A67AB31B6DD2E92B96</kand:T
ransactionID>
</ReferenceParameters>
</RegistrationService>
</CoordinationContext>
The problem is that contextElement.getFirstChildWithName(new
QName("Identifier")) returns null. This is caused by the use of new
QName("Identifier")constructor. My understanding is that it should be
used the new QName(namespaceURI,localPart) one, because the namespaceURI
is http://docs.oasis-open.org/ws-tx/wscoor/2006/06 not "" as it is
asumed when new QName(localPart) is used. So we replaced with:
activityID = contextElement.getFirstChildWithName(new
QName(Constants.WS_COOR, "Identifier")).getText();
coordinationType = contextElement.getFirstChildWithName(new
QName(Constants.WS_COOR, "CoordinationType")).getText();
OMElement registrationElement =
contextElement.getFirstChildWithName(new QName(Constants.WS_COOR,
"RegistrationService"));
Now it looks there is no more NullPointerException.
For example the suggested constructor usage can be seen in
TransactionIn/OutHandler implementations:
OMElement coordinationElement =
header.getFirstChildWithName(new
QName(Constants.WS_COOR,"CoordinationContext"));
Greetings
________________________________________________________
Dobri Kitipov
Phone: +359 2 915 36-19 | Fax: +359 2 915 36-23
[EMAIL PROTECTED]
Software AG Development Centre Bulgaria EOOD
53-55 General Totleben Blvd. | 1606 Sofia | Bulgaria
www.softwareag.com <http://www.softwareag.com/>
________________________________________________________