I tried throwing an AxisFault like this but the soap message that comes back 
doesn't have any of the details that I specified in the exception.... See the 
debug below.

throw new AxisFault(new javax.xml.namespace.QName("http://test.org";, 
"FaultCode", "test"), "FaultReason", new Exception("This is a test Exception"));

2006/10/03 08:51:23:314 EDT [DEBUG] content - -<< "<?xml version='1.0' 
encoding='UTF-8'?><soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";><soapenv:Header 
/><soapenv:Body><soapenv:Fault><faultcode>soapenv:Client</faultcode>"
2006/10/03 08:51:23:334 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:334 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:334 EDT [DEBUG] content - -<< "0"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< "0"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< "2"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< "2"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:335 EDT [DEBUG] content - -<< 
"<faultstring>unknown</faultstring>"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "0"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "6"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "f"
2006/10/03 08:51:23:339 EDT [DEBUG] content - -<< "b"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< 
"<detail><Exception>org.apache.axis2.AxisFault[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[0x9]at 
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(RawXMLINOutMessageReceiver.java:102)[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[0x9]at 
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[0x9]at 
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[0x9]at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)[\n]"
2006/10/03 08:51:23:340 EDT [DEBUG] content - -<< "[0x9]at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
com.i4commerce.bml.paycapturegateway.XMLValidationFilter.doFilter(XMLValidationFilter.java:93)[\n]"
2006/10/03 08:51:23:341 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)[\n]"
2006/10/03 08:51:23:342 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)[\n]"
2006/10/03 08:51:23:342 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)[\n]"
2006/10/03 08:51:23:342 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)[\n]"
2006/10/03 08:51:23:343 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)[\n]"
2006/10/03 08:51:23:343 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)[\n]"
2006/10/03 08:51:23:343 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)[\n]"
2006/10/03 08:51:23:343 EDT [DEBUG] content - -<< "[0x9]at 
weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)[\n]"
2006/10/03 08:51:23:343 EDT [DEBUG] content - -<< "</Exception></detail>"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "0"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "0"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "3"
2006/10/03 08:51:23:348 EDT [DEBUG] content - -<< "2"
2006/10/03 08:51:23:349 EDT [DEBUG] content - -<< "[\r]"
2006/10/03 08:51:23:350 EDT [DEBUG] content - -<< "[\n]"
2006/10/03 08:51:23:350 EDT [DEBUG] content - -<< 
"</soapenv:Fault></soapenv:Body></soapenv:Envelope>"
org.apache.axis2.AxisFault: unknown
        at 
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:287)
        at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:457)
        at 
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:399)
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at 
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.Exception: org.apache.axis2.AxisFault
        at 
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invokeBusinessLogic(RawXMLINOutMessageReceiver.java:102)
        at 
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:37)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:454)
        at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:284)
        at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:136)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
        at 
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
        at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at 
com.i4commerce.bml.paycapturegateway.XMLValidationFilter.doFilter(XMLValidationFilter.java:93)
        at 
weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
        at 
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6724)
        at 
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at 
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at 
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
        at 
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)

        at org.apache.axis2.AxisFault.<init>(AxisFault.java:159)
        ... 22 more
unknown


-----Original Message-----
From: Sharad Baronia [mailto:[EMAIL PROTECTED]
Sent: Mon 10/2/2006 5:21 PM
To: axis-user@ws.apache.org
Subject: RE: How do I create Custom Faults
 
Hi John,

 

Please refer to the knowledgebase http://www.wso2.net/kb/171

 

 

/Sharad

 

  _____  

From: John Pfeifer [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 02, 2006 2:07 PM
To: axis-user@ws.apache.org
Subject: How do I create Custom Faults

 

 

I am attempting to create a simple web service that throws a custom
exception but I haven't found anything in the apache documents that clearly
outlines how to do this.  It seems that there are two approaches to creating
a web service, the first is to define an implementation class and configure
it in the service.xml.  This approach doesn't require a wsdl, so I am not
quite sure how to define custom Faults.

For example, the MyService example defines a method like so... Also, I tried
throwing a custom Fault which extends AxisFault.. The results are the
same...  I get something like this, which isn't very discriptive.

    public void pingF(OMElement element) throws AxisFault{

        throw new AxisFault("Fault being thrown");

    }

<soapenv:Fault><faultcode>soapenv:Client</faultcode>"
2006/10/02 16:38:13:902 EDT [DEBUG] content - -<< "[\r]"
2006/10/02 16:38:13:902 EDT [DEBUG] content - -<< "[\n]"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "0"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "0"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "2"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "2"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "[\r]"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<< "[\n]"
2006/10/02 16:38:13:903 EDT [DEBUG] content - -<<
"<faultstring>unknown</faultstring>"
2006/10/02 16:38:13:907 EDT [DEBUG] content - -<< "[\r]"
2006/10/02 16:38:13:907 EDT [DEBUG] content - -<< "[\n]"
2006/10/02 16:38:13:907 EDT [DEBUG] content - -<< "0"
2006/10/02 16:38:13:907 EDT [DEBUG] content - -<< "6"
2006/10/02 16:38:13:907 EDT [DEBUG] content - -<< "f"
2006/10/02 16:38:13:908 EDT [DEBUG] content - -<< "b"
2006/10/02 16:38:13:908 EDT [DEBUG] content - -<< "[\r]"
2006/10/02 16:38:13:908 EDT [DEBUG] content - -<< "[\n]"
2006/10/02 16:38:13:908 EDT [DEBUG] content - -<<
"<detail><Exception>org.apache.axis2.AxisFault[\n]"
2006/10/02 16:38:13:908 EDT [DEBUG] content - -<< "[0x9]at
org.apache.axis2.receivers.RawXMLINOutMessageReceiver.invo



The other method is to generate the code from an existing WSDL.  While this
approach creates custom fault objects for you, I don't like the fact that it
generates so many classes.

So I guess my question how can I create custom faults without generating the
code from a WSDL... Also, If I stick with my current implementation I would
still like to publish a WSDL, but it doesn't look like apache creates a wsdl
for document literal web services.  Do I have to code this by hand?

jp4


___________________________________________________________________________

Inbound Email has been scanned by Nexa Technologies Email Security Systems.
___________________________________________________________________________



___________________________________________________________________________

All outbound Email is scanned by Nexa Technologies Email Security Systems.
___________________________________________________________________________

<<winmail.dat>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to