• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

OMException java.lang.NullPointerExce  RSS feed

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have sented all my code. but i dont know where is wrong ... so please help me

//services.xml file
<service name="service" scope="application">
<description>Weather POJO Service</description>
<messageReceivers>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
<parameter name="ServiceClass">edujinilabs.Service</parameter>
</service>

//service.java file

package edujinilabs;
import com.edujinilabs.aksh.quiz.Quiz;
public class Service
{

Quiz quiz;

public void submitQuiz(Quiz quiz)
{
this.quiz=quiz;
}
public Quiz getQuiz()
{

return quiz;
}
}
//client file



package client;

import javax.xml.namespace.QName;

import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

import com.edujinilabs.aksh.quiz.Quiz;

public class QuizClient
{
public static void main(String[] args) throws AxisFault
{
RPCServiceClient client = new RPCServiceClient();
Options op = client.getOptions();
EndpointReference epr = new EndpointReference("http://localhost:8080/axis2/services/service");
op.setTo(epr);
// for Quiz

QName opSetQuiz = new QName("http://quiz.aksh.edujinilabs.com/xsd", "submitQuiz");
Quiz q=new Quiz();
q.setDescription("QuizDesc");
q.setTitle("QuizTitle");
q.setQuizId("QuizID");

Object[] opSetQuizArgs = new Object[] {q};
client.invokeRobust(opSetQuiz, opSetQuizArgs);
// Getting MyQuiz Parameter
QName GetInsert1 = new QName("http://quiz.aksh.edujinilabs.com/xsd", "getQuiz");
Object[] opGetQuizArg1 = new Object[] {};
Class[] returnTypes1 = new Class[] {Quiz.class};
Object[] response1 = client.invokeBlocking(GetInsert1, opGetQuizArg1, returnTypes1);
Quiz quiz=(Quiz)response1[0];
if(quiz == null)
{
System.out.println("Time didnot initialize!");
return;
}
System.out.println("Title :" + quiz.getTitle());
System.out.println("Description :" + quiz.getDescription());
System.out.println("getQuiz methoid end......."+quiz.getQuizId());
}
}



///Exception after executing



Exception in thread "main" org.apache.axiom.om.OMException: java.lang.NullPointerException
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:211)
at org.apache.axiom.om.impl.llom.OMNodeImpl.build(OMNodeImpl.java:315)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:608)
at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:577)
at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:114)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:236)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:192)
at org.apache.axis2.client.ServiceClient.fillSOAPEnvelope(ServiceClient.java:631)
at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:443)
at org.apache.axis2.client.ServiceClient.sendRobust(ServiceClient.java:426)
at org.apache.axis2.rpc.client.RPCServiceClient.invokeRobust(RPCServiceClient.java:132)
at client.QuizClient.main(QuizClient.java:29)
Caused by: java.lang.NullPointerException
at org.apache.axis2.databinding.utils.BeanUtil.getPullParser(BeanUtil.java:272)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.processProperties(ADBXMLStreamReaderImpl.java:926)
at org.apache.axis2.databinding.utils.reader.ADBXMLStreamReaderImpl.next(ADBXMLStreamReaderImpl.java:780)
at org.apache.axis2.util.StreamWrapper.next(StreamWrapper.java:68)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:125)
... 11 more
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to use Axis2 SOAP Monitor tool and see what soap response and request looks like.
Check whether the problem is occurring at server side or at client side.

If the soap response looks fine, then check whether you are parsing soap reponse properly at client side.
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
continued here
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!