axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "nancy" <nancy.aggar...@daffodildb.com>
Subject [Axis2]Nullpointer exception!!!!Plz help
Date Thu, 13 Apr 2006 09:44:33 GMT
Hi,

 

TestCase generated by wsdl2Java tool of axis2 for task manager service of
oracle bpel contain following methods:

testcompleteTask and getTestObject. But I am getting Null pointer exception.
I have done Implementation of testcompleteTask.

Actually an instance of taskmanager web service is already running. I know
its conversation id so I need to set it while calling its method.

I tried using two methods but getting nullpointer.Can Anybody help me in
this regards!

 

1) Exception is coming:

java.lang.NullPointerException

      at
org.apache.axis2.context.ConfigurationContext.fillServiceContextAndServiceGr
oupContext(ConfigurationContext.java:92)

      at
com.daffodilwoods.framework.bpelprocess.TaskManagerTest.testcompleteTask(Tas
kManagerTest.java:48)

      at
com.daffodilwoods.framework.bpelprocess.TaskManagerTest.main(TaskManagerTest
.java:156)

 

 

>>>>public void testcompleteTask() throws java.lang.Exception {

                        AxisConfiguration axisCnfg=new AxisConfiguration();

                        ConfigurationContext cnfgCntxt=new
ConfigurationContext(axisCnfg);

                        MessageContext msgCntxt = new MessageContext();

javax.xml.namespace.QName qname = new javax.xml.namespace.QName(

 
"http://schemas.xmlsoap.org/ws/2003/03/addressing", "MessageID");

                        String conversationId =
"c568752ccc493590:1b1fbf4:10a8759adbe:-7ff5";

                        OMFactory factory =
OMAbstractFactory.getOMFactory();

                        OMNamespace ns1 =
factory.createOMNamespace("http://services.oracle.com/bpel", "task");

                        OMElement clientKeyElement =
factory.createOMElement("clientKey", ns1);

                        clientKeyElement.setText(conversationId);

                        org.apache.ws.commons.soap.SOAPEnvelope
env=(org.apache.ws.commons.soap.SOAPEnvelope)OMAbstractFactory.getSOAP11Fact
ory().getDefaultEnvelope();

                        env.getHeader().addChild(clientKeyElement);

 

                        msgCntxt.setEnvelope(env);        

                        

 
cnfgCntxt.fillServiceContextAndServiceGroupContext(msgCntxt);

 
com.daffodilwoods.framework.bpelprocess.TaskManagerStub stub = new
com.daffodilwoods.framework.bpelprocess.TaskManagerStub(cnfgCntxt,"http://da
ff06:9700/orabpel/default/TaskManager/1.0" );

                        com.oracle.services.bpel.task.TaskDocument param21 =
(com.oracle.services.bpel.task.TaskDocument)
getTestObject(com.oracle.services.bpel.task.TaskDocument.class);

 
stub.completeTask(param21,RelatesToDocument.Factory.newInstance());

            }

 

2) Following Exception is coming if I change testcompleteTask method

 

java.lang.NullPointerException

      at
org.apache.axis2.description.OutOnlyAxisOperation.addMessageContext(OutOnlyA
xisOperation.java:59)

      at
com.daffodilwoods.framework.bpelprocess.TaskManagerTest.testcompleteTask(Tas
kManagerTest.java:51)

      at
com.daffodilwoods.framework.bpelprocess.TaskManagerTest.main(TaskManagerTest
.java:156)

 

>>>>public void testcompleteTask() throws java.lang.Exception {

                        AxisConfiguration axisCnfg=new AxisConfiguration();

                        ConfigurationContext cnfgCntxt=new
ConfigurationContext(axisCnfg);

                        MessageContext msgCntxt = new MessageContext();

javax.xml.namespace.QName qname = new javax.xml.namespace.QName(

 
"http://schemas.xmlsoap.org/ws/2003/03/addressing", "MessageID");

                        String conversationId =
"c568752ccc493590:1b1fbf4:10a8759adbe:-7ff5";

                        OMFactory factory =
OMAbstractFactory.getOMFactory();

                        OMNamespace ns1 =
factory.createOMNamespace("http://services.oracle.com/bpel", "task");

                        OMElement clientKeyElement =
factory.createOMElement("clientKey", ns1);

                        clientKeyElement.setText(conversationId);

                        org.apache.ws.commons.soap.SOAPEnvelope
env=(org.apache.ws.commons.soap.SOAPEnvelope)OMAbstractFactory.getSOAP11Fact
ory().getDefaultEnvelope();

                        env.getHeader().addChild(clientKeyElement);

 

                        msgCntxt.setEnvelope(env);        

                        

 
com.daffodilwoods.framework.bpelprocess.TaskManagerStub stub = new
com.daffodilwoods.framework.bpelprocess.TaskManagerStub();

 
stub._operations[0].addMessageContext(msgCntxt,null);  

                        com.oracle.services.bpel.task.TaskDocument param21 =
(com.oracle.services.bpel.task.TaskDocument)
getTestObject(com.oracle.services.bpel.task.TaskDocument.class);

 
stub.completeTask(param21,RelatesToDocument.Factory.newInstance());

            }

 

 

Method to get TaskDocument object is generated by Axis2 :

 

//Create the desired XmlObject and provide it as the test object

>>>>    public org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class
type)

                                    throws Exception {

                        java.lang.reflect.Method creatorMethod = null;

                        if
(org.apache.xmlbeans.XmlObject.class.isAssignableFrom(type)) {

                                    Class[] declaredClasses =
type.getDeclaredClasses();

                                    for (int i = 0; i <
declaredClasses.length; i++) {

                                                Class declaredClass =
declaredClasses[i];

                                                if
(declaredClass.getName().endsWith("$Factory")) {

                                                            creatorMethod =
declaredClass

 
.getMethod("newInstance", null);

                                                            break;

                                                }

 

                                    }

                        }

                        if (creatorMethod != null) {

                                    return (org.apache.xmlbeans.XmlObject)
creatorMethod.invoke(null,

                                                            null);

                        } else {

                                    throw new Exception("Creator not
found!");

                        }

 

            }


Mime
View raw message