You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by "Kitipov, Dobri" <Do...@softwareag.com> on 2007/05/03 16:06:34 UTC

Problem into SimpleCoordinationContext(OMElement contextElement) constructor?

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
dobri.kitipov@softwareag.com 
Software AG Development Centre Bulgaria EOOD
53-55 General Totleben Blvd. | 1606 Sofia | Bulgaria 
www.softwareag.com <http://www.softwareag.com/> 
________________________________________________________



Re: Problem into SimpleCoordinationContext(OMElement contextElement) constructor?

Posted by Thilina Gunarathne <cs...@gmail.com>.
Fixed in the svn head... I updated the svn head to work against
axis2-1.2 together with the integration tests.. There were too many
late changes in Axis2 1.2..

Thanx for the holler... It would be great if you can send a patch
(create a jira and attach the patch) when you find an issue + the
probable fix next time...  Sending patches is the way to earn apache
credibility points towards a commitership for you :)..


thanks,
Thilina

On 5/3/07, Kitipov, Dobri <Do...@softwareag.com> wrote:
>
>
>
>
> 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</CoordinationType>
>         <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:TransactionID>
>
>                 </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
> dobri.kitipov@softwareag.com
> Software AG Development Centre Bulgaria EOOD
>  53-55 General Totleben Blvd. | 1606 Sofia | Bulgaria
> www.softwareag.com
> ________________________________________________________
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org


Re: Problem into SimpleCoordinationContext(OMElement contextElement) constructor?

Posted by Thilina Gunarathne <cs...@gmail.com>.
Fixed in the svn head... I updated the svn head to work against
axis2-1.2 together with the integration tests.. There were too many
late changes in Axis2 1.2..

Thanx for the holler... It would be great if you can send a patch
(create a jira and attach the patch) when you find an issue + the
probable fix next time...  Sending patches is the way to earn apache
credibility points towards a commitership for you :)..


thanks,
Thilina

On 5/3/07, Kitipov, Dobri <Do...@softwareag.com> wrote:
>
>
>
>
> 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</CoordinationType>
>         <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:TransactionID>
>
>                 </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
> dobri.kitipov@softwareag.com
> Software AG Development Centre Bulgaria EOOD
>  53-55 General Totleben Blvd. | 1606 Sofia | Bulgaria
> www.softwareag.com
> ________________________________________________________
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: kandula-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: kandula-dev-help@ws.apache.org