0 Replies Latest reply: Jul 21, 2013 10:03 PM by 971097 RSS

    NullPointerException when we invoke web service in JAX-WS

    971097


      When we invoke web service using JAX-WS, NullPointerException is thrown. This happens when an exception is thrown on SOA side. Stack trace is below:             

      java.lang.NullPointerException

      at com.sun.xml.ws.fault.ExceptionBean.isStackTraceXml(ExceptionBean.java:181)

      at com.sun.xml.ws.fault.SOAPFaultBuilder.attachServerException(SOAPFaultBuilder.java:285)

      at com.sun.xml.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:134)

      at com.sun.xml.ws.client.sei.StubHandler.readResponse(StubHandler.java:246)

      at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:177)

      at com.sun.xml.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:256)

      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:128)

      at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102)

      at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:172)

      at $Proxy106.execute(Unknown Source)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

      at java.lang.reflect.Method.invoke(Method.java:601)

      at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)

      at $Proxy91.execute(Unknown Source)

      at gov.selfservice.invoker.webservice.ServiceInvoker.submitApplication(ServiceInvoker.java:204)

      at gov.selfservice.management.webservice.WebServiceManager.submitApplication(WebServiceManager.java:54)

       

      Below is the code we used to invoke the web service. The clients were generated using wsimport command.

      ServiceInvoker.java:
      Service service = new Service();
      ExecutePtt ServicePort = service.getExecutePt();
      BindingProvider bindingProvider = (BindingProvider) ServicePort;
      Map<String, Object> rc = (Map<String, Object>) bindingProvider.getRequestContext();
      List<CredentialProvider> credProviders = new ArrayList<CredentialProvider>();
      credProviders.add(new ClientUNTCredentialProvider(username.getBytes(), password.getBytes()));
      rc.put(WSSecurityContext.CREDENTIAL_PROVIDER_LIST, credProviders);
      rc.put(BindingProvider.USERNAME_PROPERTY, username);
      rc.put(BindingProvider.PASSWORD_PROPERTY, password);

      ServicePort.execute(bnft); // Invoke web service here

      On Oracle ESB when an exception is thrown we getNullPointerException in the Exception bean class of JAX-WS class. ESB is running on SOA with weblogic 10.3.6 and the web application from where
      the ESB web service is invoked is weblogic 12C.