• Post Reply Bookmark Topic Watch Topic
  • New Topic

Null pointer exception in client side when calling a web service method in JBoss 5

Meastro Torres
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting null pointer exception in client when calling ParentService' process method from client. But in server log no exception is there. I am using server side handler. The request is comming to handler and after completing the ParentHandler's handleMessage method it's coming back to client with NPE.

Client Stacktrace:

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: java.lang.NullPointerException
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at $Proxy30.service(Unknown Source)

Server Codes

Service Class:

@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL, parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
@HandlerChain(file = "ParentServiceHandler.xml")
public interface ParentService {
Parent process(Parent parent);

Implementation class:

@WebService(endpointInterface = "com.practise.ws.ParentService")
public class ParentServiceImp implements ParentService {
private WebServiceContext context;
public Parent process(Parent parent) {
System.out.println("Process calling---------------");
return parent;

Handler class:

public class ParentHandler implements SOAPHandler<SOAPMessageContext> {
public boolean handleMessage(SOAPMessageContext mc) {
Boolean flag = (Boolean)mc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
SOAPMessage soapMsg = mc.getMessage();
System.out.println("MESSAGE: " + soapMsg);
return true;
}catch (Exception e) {
return false;

public Set<QName> getHeaders() {
return Collections.emptySet();

public void close(MessageContext mc) {}

public boolean handleFault(SOAPMessageContext mc) {
return true;


<?xml version="1.0" encoding="UTF-8"?>
<handler-chains xmlns="http://java.sun.com/xml/ns/javaee">


<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0">
<endpoint name="ParentChild" implementation="com.practise.ws.ParentServiceImp" url-pattern="/parentWs" />


Client code:

public class WebServiceClient {
public static void main(String[] args) {
ParentServiceImpService service = new ParentServiceImpService();
ParentService objService = (ParentService) service.getParentChildImpPort();
ChildA child =new ChildA();

But when I am sending blank child object then it's working properly. objService.process(new ChildA());

Please help me.
Kesava Krishna
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please try for null checks in your ParentHandler class at each step and this will clearly tell you where you are missing.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!