Win a copy of Microservices in Action this week in the Web Services forum!
  • 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

How to throw a customised SOAPFaultException Exception  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to throw a customised soap fault exception from my code. I have the fault code , fault string, fault actor and fault detail to be set in that. When i create a detail object and test my application i am getting a null pointer exception.

I am developing a webservice in WSAD. Can anybody help me out by telling how to create a detail object and set my fault detail into that and throw a new soap fault exception with those 4 arguements. If there is any previous thread running about this then somebody please let me know.

The stack trace follows

[3/10/06 23:23:03:170 IST] 5faa5faa WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet WSWS3227E: Error: Exception:
[3/10/06 23:23:03:217 IST] 5faa5faa WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet TRAS0014I: The following exception was logged WebServicesFault
faultCode: Server.generalException
faultString: com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
faultActor: null
faultDetail:

com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at com.ibm.ws.webservices.engine.InternalException.<init>(InternalException.java:132)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.asSOAPElement(SOAPElement.java)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.getChildElements(SOAPElement.java:503)
at com.ibm.ws.webservices.engine.xmlsoap.Detail.getDetailEntries(Detail.java:127)
at com.ibm.ws.webservices.engine.WebServicesFault.<init>(WebServicesFault.java:238)
at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:147)
at com.ibm.ws.webservices.engine.providers.java.JavaProvider.invoke(JavaProvider.java:294)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:61)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:255)
at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:850)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
.
 
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

The Web Services FAQ links to this article, which explains how to do that.
 
Shivashankar Gurumurthy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by shivashankar gurumurthy:
I want to throw a customised soap fault exception from my code. I have the fault code , fault string, fault actor and fault detail to be set in that. When i create a detail object and test my application i am getting a null pointer exception.

I am developing a webservice in WSAD. Can anybody help me out by telling how to create a detail object and set my fault detail into that and throw a new soap fault exception with those 4 arguements. If there is any previous thread running about this then somebody please let me know.

The stack trace follows

[3/10/06 23:23:03:170 IST] 5faa5faa WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet WSWS3227E: Error: Exception:
[3/10/06 23:23:03:217 IST] 5faa5faa WebServicesSe E com.ibm.ws.webservices.engine.transport.http.WebServicesServlet TRAS0014I: The following exception was logged WebServicesFault
faultCode: Server.generalException
faultString: com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
faultActor: null
faultDetail:

com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
com.ibm.ws.webservices.engine.InternalException: java.lang.NullPointerException
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at com.ibm.ws.webservices.engine.InternalException.<init>(InternalException.java:132)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.asSOAPElement(SOAPElement.java)
at com.ibm.ws.webservices.engine.xmlsoap.SOAPElement.getChildElements(SOAPElement.java:503)
at com.ibm.ws.webservices.engine.xmlsoap.Detail.getDetailEntries(Detail.java:127)
at com.ibm.ws.webservices.engine.WebServicesFault.<init>(WebServicesFault.java:238)
at com.ibm.ws.webservices.engine.WebServicesFault.makeFault(WebServicesFault.java:147)
at com.ibm.ws.webservices.engine.providers.java.JavaProvider.invoke(JavaProvider.java:294)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:61)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:212)
at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:255)
at com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:850)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:948)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:530)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:176)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:201)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:610)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:431)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
.




Hi,

I have done this already, but i got NullPointerException while creating Detail object even with any single element added to it. Is it a problem with IBM Websphere server?. if so then is there any other way round to get it done??
 
Ulf Dittmer
Rancher
Posts: 42974
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now we've seen the stack trace twice, but still don't know what the code is doing when the exception is thrown. Why don't you post a short, relevant excerpt for us to look at (and please, don't quote your original post again).
 
Shivashankar Gurumurthy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This is my problem.
I try to throw a new SOAPFult exception from my catch block. I went to the site that is mentioned in your reply. i am throwing an exception in the same way the site is telling one to do. I created a detail object in order to place my fault detail inside that. Then in order to check whether exception is thrown atleast with a empty detail in it i tested the app. It is throwing a null pointer exception as shown in stack trace. if i throw a SOAPFult exception with detail as null it works. but the moment i create a detail object (in the sense only the detail creation code is present and no values are added to the detail) i get a null pointer generated from somewhere inside the auto generated system classes.
Please advise.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!