Search code examples
javaapacheapache-axisxmlbeans

XMLBeans get_store() method returns null


I am developing a Axis2 based WebServices with XMLBeans binding. I have generated the code by using WSDL2Java generator and tried testing it with sample values set in the request.

In one of the setter methods (auto-generated code) I found the below code. The method get_store() returns a null value and hence I get a NullPointerException.

target = (org.apache.xmlbeans.SimpleValue)
    get_store().find_element_user(TRANSACTIONTYPE$0, 0);

I tried Google to find the solution and found similar issue with no solution specified.

Is there any work around for this issue?? Kindly help me


Solution

  • This issue got resolved!!

    I was actually trying to instantiate a response object in a normal Java way and hence i got the above mentioned exception while running my WebServices.

    Wrong way - ResponseType responseType = new ResponseType();

    Correct way - ResponseType responseType = ResponseType.Factory.newInstance();