You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by José Antonio Sánchez <ge...@gmail.com> on 2006/04/11 18:07:26 UTC

Throwing Faults

Hello, I have implemented service and I want an operation to throw a
fault when something happens. I have followed the filesystem example
with the DeviceBusyFault exception and I have added that to my
operation. I had the service generated without faults, but a new ant
generate created the corresponding
ServiceBlacklistedFaultException.java file (my custom fault) and added
the throws ServiceBlacklistedFaultException to the AbstractService
file. I manually added the throws ServiceBlacklistedFaultException to
my Service file with the following:
The method in fact is a Resource creation method. It looks in a file
for a list of blacklisted ids and throws a fault if the requested
resource is in the blacklist:

public org.tomas.wsdm.init.CreateResponseTypeDocument create(
org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws
ServiceBlacklistedFaultException

   {

     	org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument
= org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();

     	InitPortHome myResourceHome = (InitPortHome)
this.getResourceContext().getResourceHome();

    	

     		

     		Vector blackList = readBlacklist();

     		String createId = requestDoc.getCreateRequestType();

     		

     		if (!blackList.contains(createId))

     		{

     			try {

					myResourceHome.createResource(createId);					

				} catch (Exception e) {

					// TODO Auto-generated catch block

					e.printStackTrace();

				}

     		}

     		else {

     			throw new
ServiceBlacklistedFaultException(getNamespaceSet(),"Service
/etc/init.d/"+createId+" is blacklisted");

     		}

			

			Iterator it = myResourceHome.getResourceMap().keySet().iterator();

			System.out.println("Esta es la lista de recursos:");

			System.out.println(it.next().toString());

			while (it.hasNext())

			System.out.println(it.next().toString());



     	/**

     	 * TODO implement method and populate the response object

     	 *

     	 * For more information on working-with/populating the
XmlBean-generated types.

     	 *

     	 * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema

     	 */

			return responseDocument;

   }

I've compiled and deployed it correctly, but when I try to create a
blacklisted resource, instead of my custom fault I get a general
ServerFault like this:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Internal server error occurred.
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
	at org.apache.axis.client.Call.invoke(Call.java:2748)
	at org.apache.axis.client.Call.invoke(Call.java:1902)
	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)

	{http://xml.apache.org/axis/}hostname:adapt20

Internal server error occurred.
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
	at org.apache.axis.client.Call.invoke(Call.java:2748)
	at org.apache.axis.client.Call.invoke(Call.java:1902)
	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)

and I get the following in the catalina.out log:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Service /etc/init.d/gdm is blacklisted
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
	{http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
	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:585)
	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

	{http://xml.apache.org/axis/}hostname:adapt20

Service /etc/init.d/gdm is blacklisted
	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
	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:585)
	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

I don't know why but it seems that the exception is catched instead of
being thrown, so a general server fault is generated instead of a
custom fault.

--
Saludos.
José Antonio Sánchez

Re: Throwing Faults

Posted by Sal Campana <sc...@apache.org>.
José Antonio Sánchez wrote:

>Hello, I have implemented service and I want an operation to throw a
>fault when something happens. I have followed the filesystem example
>with the DeviceBusyFault exception and I have added that to my
>operation. I had the service generated without faults, but a new ant
>generate created the corresponding
>ServiceBlacklistedFaultException.java file (my custom fault) and added
>the throws ServiceBlacklistedFaultException to the AbstractService
>file. I manually added the throws ServiceBlacklistedFaultException to
>my Service file with the following:
>The method in fact is a Resource creation method. It looks in a file
>for a list of blacklisted ids and throws a fault if the requested
>resource is in the blacklist:
>
>public org.tomas.wsdm.init.CreateResponseTypeDocument create(
>org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws
>ServiceBlacklistedFaultException
>
>   {
>
>     	org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument
>= org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
>
>     	InitPortHome myResourceHome = (InitPortHome)
>this.getResourceContext().getResourceHome();
>
>    	
>
>     		
>
>     		Vector blackList = readBlacklist();
>
>     		String createId = requestDoc.getCreateRequestType();
>
>     		
>
>     		if (!blackList.contains(createId))
>
>     		{
>
>     			try {
>
>					myResourceHome.createResource(createId);					
>
>				} catch (Exception e) {
>
>					// TODO Auto-generated catch block
>
>					e.printStackTrace();
>
>				}
>
>     		}
>
>     		else {
>
>     			throw new
>ServiceBlacklistedFaultException(getNamespaceSet(),"Service
>/etc/init.d/"+createId+" is blacklisted");
>
>     		}
>
>			
>
>			Iterator it = myResourceHome.getResourceMap().keySet().iterator();
>
>			System.out.println("Esta es la lista de recursos:");
>
>			System.out.println(it.next().toString());
>
>			while (it.hasNext())
>
>			System.out.println(it.next().toString());
>
>
>
>     	/**
>
>     	 * TODO implement method and populate the response object
>
>     	 *
>
>     	 * For more information on working-with/populating the
>XmlBean-generated types.
>
>     	 *
>
>     	 * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
>
>     	 */
>
>			return responseDocument;
>
>   }
>
>I've compiled and deployed it correctly, but when I try to create a
>blacklisted resource, instead of my custom fault I get a general
>ServerFault like this:
>
>AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
> faultSubcode:
> faultString: Internal server error occurred.
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
>	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>	at org.apache.axis.client.Call.invoke(Call.java:2748)
>	at org.apache.axis.client.Call.invoke(Call.java:1902)
>	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
>	{http://xml.apache.org/axis/}hostname:adapt20
>
>Internal server error occurred.
>	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>	at org.apache.axis.client.Call.invoke(Call.java:2748)
>	at org.apache.axis.client.Call.invoke(Call.java:1902)
>	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
>and I get the following in the catalina.out log:
>
>AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
> faultSubcode:
> faultString: Service /etc/init.d/gdm is blacklisted
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
>	{http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
>	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>	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:585)
>	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>	at java.lang.Thread.run(Thread.java:595)
>
>	{http://xml.apache.org/axis/}hostname:adapt20
>
>Service /etc/init.d/gdm is blacklisted
>	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>	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:585)
>	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>	at java.lang.Thread.run(Thread.java:595)
>
>I don't know why but it seems that the exception is catched instead of
>being thrown, so a general server fault is generated instead of a
>custom fault.
>
>--
>Saludos.
>José Antonio Sánchez
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
>For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
>  
>
Jose,

The stack trace you sent seems to be coming from an Axis client....I'm 
not sure what their issue is...I would examine the returned fault obejct 
in the debugger to see if it contains the message...

The other thing you could do is setup Axis's TCPMon as a proxy and view 
the fault on the wire....

As for the server, it seems as though the fault is being thrown 
correctly, that is why you see it in the log output...

-S


---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


Re: Throwing Faults

Posted by Sal Campana <sc...@apache.org>.
José Antonio Sánchez wrote:

>Hello, I have implemented service and I want an operation to throw a
>fault when something happens. I have followed the filesystem example
>with the DeviceBusyFault exception and I have added that to my
>operation. I had the service generated without faults, but a new ant
>generate created the corresponding
>ServiceBlacklistedFaultException.java file (my custom fault) and added
>the throws ServiceBlacklistedFaultException to the AbstractService
>file. I manually added the throws ServiceBlacklistedFaultException to
>my Service file with the following:
>The method in fact is a Resource creation method. It looks in a file
>for a list of blacklisted ids and throws a fault if the requested
>resource is in the blacklist:
>
>public org.tomas.wsdm.init.CreateResponseTypeDocument create(
>org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws
>ServiceBlacklistedFaultException
>
>   {
>
>     	org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument
>= org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
>
>     	InitPortHome myResourceHome = (InitPortHome)
>this.getResourceContext().getResourceHome();
>
>    	
>
>     		
>
>     		Vector blackList = readBlacklist();
>
>     		String createId = requestDoc.getCreateRequestType();
>
>     		
>
>     		if (!blackList.contains(createId))
>
>     		{
>
>     			try {
>
>					myResourceHome.createResource(createId);					
>
>				} catch (Exception e) {
>
>					// TODO Auto-generated catch block
>
>					e.printStackTrace();
>
>				}
>
>     		}
>
>     		else {
>
>     			throw new
>ServiceBlacklistedFaultException(getNamespaceSet(),"Service
>/etc/init.d/"+createId+" is blacklisted");
>
>     		}
>
>			
>
>			Iterator it = myResourceHome.getResourceMap().keySet().iterator();
>
>			System.out.println("Esta es la lista de recursos:");
>
>			System.out.println(it.next().toString());
>
>			while (it.hasNext())
>
>			System.out.println(it.next().toString());
>
>
>
>     	/**
>
>     	 * TODO implement method and populate the response object
>
>     	 *
>
>     	 * For more information on working-with/populating the
>XmlBean-generated types.
>
>     	 *
>
>     	 * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
>
>     	 */
>
>			return responseDocument;
>
>   }
>
>I've compiled and deployed it correctly, but when I try to create a
>blacklisted resource, instead of my custom fault I get a general
>ServerFault like this:
>
>AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
> faultSubcode:
> faultString: Internal server error occurred.
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
>	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>	at org.apache.axis.client.Call.invoke(Call.java:2748)
>	at org.apache.axis.client.Call.invoke(Call.java:1902)
>	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
>	{http://xml.apache.org/axis/}hostname:adapt20
>
>Internal server error occurred.
>	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>	at org.apache.axis.client.Call.invoke(Call.java:2748)
>	at org.apache.axis.client.Call.invoke(Call.java:1902)
>	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
>and I get the following in the catalina.out log:
>
>AxisFault
> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
> faultSubcode:
> faultString: Service /etc/init.d/gdm is blacklisted
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
>	{http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
>	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>	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:585)
>	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>	at java.lang.Thread.run(Thread.java:595)
>
>	{http://xml.apache.org/axis/}hostname:adapt20
>
>Service /etc/init.d/gdm is blacklisted
>	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>	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:585)
>	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>	at java.lang.Thread.run(Thread.java:595)
>
>I don't know why but it seems that the exception is catched instead of
>being thrown, so a general server fault is generated instead of a
>custom fault.
>
>--
>Saludos.
>José Antonio Sánchez
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
>For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
>  
>
Jose,

The stack trace you sent seems to be coming from an Axis client....I'm 
not sure what their issue is...I would examine the returned fault obejct 
in the debugger to see if it contains the message...

The other thing you could do is setup Axis's TCPMon as a proxy and view 
the fault on the wire....

As for the server, it seems as though the fault is being thrown 
correctly, that is why you see it in the log output...

-S


Re: Throwing Faults

Posted by José Antonio Sánchez <ge...@gmail.com>.
Alvaro Orus has replied to you and sent a couple of files with the
code we are using. It seems that the exception is thrown and then,
instead of generating a Fault message, Axis, WSRF or Muse catches the
exception as an unknown exception.
My suspect is that as we didn't define the fault in the first
generation, maybe the code does not recognize that kind of exception
and so, it gives a Server Error Fault, althogh it's strange because
that behavor is also seen in the filesystem example, that's supposed
to work well.

On 4/19/06, Sal Campana <sc...@apache.org> wrote:
> José Antonio Sánchez wrote:
>
> >Using TcpMon this is the request:
> >
> >POST /muse/services/InitPort HTTP/1.0
> >
> >Content-Type: text/xml; charset=utf-8
> >
> >Accept: application/soap+xml, application/dime, multipart/related, text/*
> >
> >User-Agent: Axis/1.2.1
> >
> >Host: 127.0.0.1:8081
> >
> >Cache-Control: no-cache
> >
> >Pragma: no-cache
> >
> >SOAPAction: ""
> >
> >Content-Length: 829
> >
> >Authorization: Basic d3NkbXVzZXJ0b206d3NkbXRvbWFzMw==
> >
> >
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> >xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >xmlns:fs="http://tomas.org/wsdm/init"
> >xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
> >xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
> >  <soapenv:Header>
> >    <wsa:To soapenv:mustUnderstand="1">
> >      http://adapt20:8081/muse/services/InitPort</wsa:To>
> >    <wsa:Action soapenv:mustUnderstand="1">
> >      http://tomas.org/wsdm/init/InitPortType/Create</wsa:Action>
> >    <fs:ResourceIdentifier soapenv:mustUnderstand="1">
> >      Init</fs:ResourceIdentifier>
> >  </soapenv:Header>
> >  <soapenv:Body>
> >    <CreateRequestType xmlns="http://tomas.org/wsdm/init">
> >      gdm</CreateRequestType>
> >  </soapenv:Body>
> ></soapenv:Envelope>
> >
> >And this is the response:
> >
> >HTTP/1.1 500 Error Interno del Servidor
> >
> >Server: Apache-Coyote/1.1
> >
> >Content-Type: text/xml;charset=utf-8
> >
> >Date: Wed, 12 Apr 2006 08:42:22 GMT
> >
> >Connection: close
> >
> >
> >
> ><?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
> >xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> >xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> >xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > <soapenv:Body>
> >  <soapenv:Fault>
> >   <faultcode>soapenv:Server</faultcode>
> >   <faultstring>Internal server error occurred.</faultstring>
> >   <detail/>
> >  </soapenv:Fault>
> > </soapenv:Body>
> ></soapenv:Envelope>
> >
> >As you can see, there's no reference to my custom fault, but in the
> >catalina.out file. Maybe a Tomcat configuration problem?
> >
> >On 4/11/06, José Antonio Sánchez <ge...@gmail.com> wrote:
> >
> >
> >>I don't have the code right now so I cannot assure it, but I used
> >>Tcpmon all the way to do the test and it returned something like:
> >>
> >>AxisFault
> >> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
> >> faultSubcode:
> >> faultString: Internal server error occurred.
> >> faultActor:
> >> faultNode:
> >> faultDetail:
> >>
> >>Without a faultDetail, thats for sure. Anyway, tomorrow I'll send the
> >>complete request and response.
> >>
> >>On 4/11/06, Campana Jr., Salvatore J <sa...@hp.com> wrote:
> >>
> >>
> >>>Jose,
> >>>
> >>>The stack trace you sent seems to be coming from an Axis client....I'm not sure what their issue is...I would examine the returned fault obejct in the debugger to see if it contains the message...
> >>>
> >>>The other thing you could do is setup Axis's TCPMon as a proxy and view the fault on the wire....
> >>>
> >>>As for the server, it seems as though the fault is being thrown correctly, that is why you see it in the log output...
> >>>
> >>>-S
> >>>
> >>>-----Original Message-----
> >>>From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> >>>Sent: Tuesday, April 11, 2006 12:07 PM
> >>>To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
> >>>Subject: Throwing Faults
> >>>
> >>>Hello, I have implemented service and I want an operation to throw a fault when something happens. I have followed the filesystem example with the DeviceBusyFault exception and I have added that to my operation. I had the service generated without faults, but a new ant generate created the corresponding ServiceBlacklistedFaultException.java file (my custom fault) and added the throws ServiceBlacklistedFaultException to the AbstractService file. I manually added the throws ServiceBlacklistedFaultException to my Service file with the following:
> >>>The method in fact is a Resource creation method. It looks in a file for a list of blacklisted ids and throws a fault if the requested resource is in the blacklist:
> >>>
> >>>public org.tomas.wsdm.init.CreateResponseTypeDocument create( org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws ServiceBlacklistedFaultException
> >>>
> >>>   {
> >>>
> >>>        org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument = org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
> >>>
> >>>        InitPortHome myResourceHome = (InitPortHome) this.getResourceContext().getResourceHome();
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>                Vector blackList = readBlacklist();
> >>>
> >>>                String createId = requestDoc.getCreateRequestType();
> >>>
> >>>
> >>>
> >>>                if (!blackList.contains(createId))
> >>>
> >>>                {
> >>>
> >>>                        try {
> >>>
> >>>                                        myResourceHome.createResource(createId);
> >>>
> >>>                                } catch (Exception e) {
> >>>
> >>>                                        // TODO Auto-generated catch block
> >>>
> >>>                                        e.printStackTrace();
> >>>
> >>>                                }
> >>>
> >>>                }
> >>>
> >>>                else {
> >>>
> >>>                        throw new
> >>>ServiceBlacklistedFaultException(getNamespaceSet(),"Service
> >>>/etc/init.d/"+createId+" is blacklisted");
> >>>
> >>>                }
> >>>
> >>>
> >>>
> >>>                        Iterator it = myResourceHome.getResourceMap().keySet().iterator();
> >>>
> >>>                        System.out.println("Esta es la lista de recursos:");
> >>>
> >>>                        System.out.println(it.next().toString());
> >>>
> >>>                        while (it.hasNext())
> >>>
> >>>                        System.out.println(it.next().toString());
> >>>
> >>>
> >>>
> >>>        /**
> >>>
> >>>         * TODO implement method and populate the response object
> >>>
> >>>         *
> >>>
> >>>         * For more information on working-with/populating the XmlBean-generated types.
> >>>
> >>>         *
> >>>
> >>>         * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
> >>>
> >>>         */
> >>>
> >>>                        return responseDocument;
> >>>
> >>>   }
> >>>
> >>>I've compiled and deployed it correctly, but when I try to create a blacklisted resource, instead of my custom fault I get a general ServerFault like this:
> >>>
> >>>AxisFault
> >>> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
> >>> faultSubcode:
> >>> faultString: Internal server error occurred.
> >>> faultActor:
> >>> faultNode:
> >>> faultDetail:
> >>>        {http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
> >>>        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
> >>>        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
> >>>        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> >>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> >>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> >>>        at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> >>>        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
> >>>        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> >>>        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
> >>>        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
> >>>        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
> >>>        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
> >>>        at org.apache.axis.client.Call.invoke(Call.java:2748)
> >>>        at org.apache.axis.client.Call.invoke(Call.java:1902)
> >>>        at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
> >>>        at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
> >>>
> >>>        {http://xml.apache.org/axis/}hostname:adapt20
> >>>
> >>>Internal server error occurred.
> >>>        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
> >>>        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
> >>>        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> >>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> >>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> >>>        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> >>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> >>>        at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> >>>        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
> >>>        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> >>>        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
> >>>        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
> >>>        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
> >>>        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
> >>>        at org.apache.axis.client.Call.invoke(Call.java:2748)
> >>>        at org.apache.axis.client.Call.invoke(Call.java:1902)
> >>>        at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
> >>>        at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
> >>>
> >>>and I get the following in the catalina.out log:
> >>>
> >>>AxisFault
> >>> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
> >>> faultSubcode:
> >>> faultString: Service /etc/init.d/gdm is blacklisted
> >>> faultActor:
> >>> faultNode:
> >>> faultDetail:
> >>>        {http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
> >>>        {http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
> >>>        at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
> >>>        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:585)
> >>>        at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
> >>>        at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
> >>>        at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
> >>>        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> >>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> >>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> >>>        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> >>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> >>>        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> >>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >>>        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> >>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >>>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >>>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >>>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >>>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >>>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >>>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >>>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >>>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >>>        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >>>        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
> >>>        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >>>        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> >>>        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> >>>        at java.lang.Thread.run(Thread.java:595)
> >>>
> >>>        {http://xml.apache.org/axis/}hostname:adapt20
> >>>
> >>>Service /etc/init.d/gdm is blacklisted
> >>>        at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
> >>>        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:585)
> >>>        at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
> >>>        at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
> >>>        at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
> >>>        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> >>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> >>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> >>>        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> >>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> >>>        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> >>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >>>        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> >>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >>>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >>>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >>>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >>>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >>>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >>>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >>>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >>>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >>>        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >>>        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
> >>>        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >>>        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> >>>        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> >>>        at java.lang.Thread.run(Thread.java:595)
> >>>
> >>>I don't know why but it seems that the exception is catched instead of being thrown, so a general server fault is generated instead of a custom fault.
> >>>
> >>>--
> >>>Saludos.
> >>>José Antonio Sánchez
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> >>>For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> >>>For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >>>
> >>>
> >>>
> >>>
> >>--
> >>Saludos.
> >>José Antonio Sánchez
> >>
> >>
> >>
> >
> >
> >--
> >Saludos.
> >José Antonio Sánchez
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> >For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >
> >
> >
> >
> Jose, are you sure you are getting to your fault and that something else
> is not occurring?
>
> Is there any way that you could attach (remote debug) and follow the code?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>


--
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


Re: Throwing Faults

Posted by Sal Campana <sc...@apache.org>.
José Antonio Sánchez wrote:

>Using TcpMon this is the request:
>
>POST /muse/services/InitPort HTTP/1.0
>
>Content-Type: text/xml; charset=utf-8
>
>Accept: application/soap+xml, application/dime, multipart/related, text/*
>
>User-Agent: Axis/1.2.1
>
>Host: 127.0.0.1:8081
>
>Cache-Control: no-cache
>
>Pragma: no-cache
>
>SOAPAction: ""
>
>Content-Length: 829
>
>Authorization: Basic d3NkbXVzZXJ0b206d3NkbXRvbWFzMw==
>
>
>
><?xml version="1.0" encoding="UTF-8"?>
><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>xmlns:fs="http://tomas.org/wsdm/init"
>xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
>xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
>  <soapenv:Header>
>    <wsa:To soapenv:mustUnderstand="1">
>      http://adapt20:8081/muse/services/InitPort</wsa:To>
>    <wsa:Action soapenv:mustUnderstand="1">
>      http://tomas.org/wsdm/init/InitPortType/Create</wsa:Action>
>    <fs:ResourceIdentifier soapenv:mustUnderstand="1">
>      Init</fs:ResourceIdentifier>
>  </soapenv:Header>
>  <soapenv:Body>
>    <CreateRequestType xmlns="http://tomas.org/wsdm/init">
>      gdm</CreateRequestType>
>  </soapenv:Body>
></soapenv:Envelope>
>
>And this is the response:
>
>HTTP/1.1 500 Error Interno del Servidor
>
>Server: Apache-Coyote/1.1
>
>Content-Type: text/xml;charset=utf-8
>
>Date: Wed, 12 Apr 2006 08:42:22 GMT
>
>Connection: close
>
>
>
><?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
>xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
>xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <soapenv:Body>
>  <soapenv:Fault>
>   <faultcode>soapenv:Server</faultcode>
>   <faultstring>Internal server error occurred.</faultstring>
>   <detail/>
>  </soapenv:Fault>
> </soapenv:Body>
></soapenv:Envelope>
>
>As you can see, there's no reference to my custom fault, but in the
>catalina.out file. Maybe a Tomcat configuration problem?
>
>On 4/11/06, José Antonio Sánchez <ge...@gmail.com> wrote:
>  
>
>>I don't have the code right now so I cannot assure it, but I used
>>Tcpmon all the way to do the test and it returned something like:
>>
>>AxisFault
>> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
>> faultSubcode:
>> faultString: Internal server error occurred.
>> faultActor:
>> faultNode:
>> faultDetail:
>>
>>Without a faultDetail, thats for sure. Anyway, tomorrow I'll send the
>>complete request and response.
>>
>>On 4/11/06, Campana Jr., Salvatore J <sa...@hp.com> wrote:
>>    
>>
>>>Jose,
>>>
>>>The stack trace you sent seems to be coming from an Axis client....I'm not sure what their issue is...I would examine the returned fault obejct in the debugger to see if it contains the message...
>>>
>>>The other thing you could do is setup Axis's TCPMon as a proxy and view the fault on the wire....
>>>
>>>As for the server, it seems as though the fault is being thrown correctly, that is why you see it in the log output...
>>>
>>>-S
>>>
>>>-----Original Message-----
>>>From: José Antonio Sánchez [mailto:getaceres@gmail.com]
>>>Sent: Tuesday, April 11, 2006 12:07 PM
>>>To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
>>>Subject: Throwing Faults
>>>
>>>Hello, I have implemented service and I want an operation to throw a fault when something happens. I have followed the filesystem example with the DeviceBusyFault exception and I have added that to my operation. I had the service generated without faults, but a new ant generate created the corresponding ServiceBlacklistedFaultException.java file (my custom fault) and added the throws ServiceBlacklistedFaultException to the AbstractService file. I manually added the throws ServiceBlacklistedFaultException to my Service file with the following:
>>>The method in fact is a Resource creation method. It looks in a file for a list of blacklisted ids and throws a fault if the requested resource is in the blacklist:
>>>
>>>public org.tomas.wsdm.init.CreateResponseTypeDocument create( org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws ServiceBlacklistedFaultException
>>>
>>>   {
>>>
>>>        org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument = org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
>>>
>>>        InitPortHome myResourceHome = (InitPortHome) this.getResourceContext().getResourceHome();
>>>
>>>
>>>
>>>
>>>
>>>                Vector blackList = readBlacklist();
>>>
>>>                String createId = requestDoc.getCreateRequestType();
>>>
>>>
>>>
>>>                if (!blackList.contains(createId))
>>>
>>>                {
>>>
>>>                        try {
>>>
>>>                                        myResourceHome.createResource(createId);
>>>
>>>                                } catch (Exception e) {
>>>
>>>                                        // TODO Auto-generated catch block
>>>
>>>                                        e.printStackTrace();
>>>
>>>                                }
>>>
>>>                }
>>>
>>>                else {
>>>
>>>                        throw new
>>>ServiceBlacklistedFaultException(getNamespaceSet(),"Service
>>>/etc/init.d/"+createId+" is blacklisted");
>>>
>>>                }
>>>
>>>
>>>
>>>                        Iterator it = myResourceHome.getResourceMap().keySet().iterator();
>>>
>>>                        System.out.println("Esta es la lista de recursos:");
>>>
>>>                        System.out.println(it.next().toString());
>>>
>>>                        while (it.hasNext())
>>>
>>>                        System.out.println(it.next().toString());
>>>
>>>
>>>
>>>        /**
>>>
>>>         * TODO implement method and populate the response object
>>>
>>>         *
>>>
>>>         * For more information on working-with/populating the XmlBean-generated types.
>>>
>>>         *
>>>
>>>         * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
>>>
>>>         */
>>>
>>>                        return responseDocument;
>>>
>>>   }
>>>
>>>I've compiled and deployed it correctly, but when I try to create a blacklisted resource, instead of my custom fault I get a general ServerFault like this:
>>>
>>>AxisFault
>>> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
>>> faultSubcode:
>>> faultString: Internal server error occurred.
>>> faultActor:
>>> faultNode:
>>> faultDetail:
>>>        {http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
>>>        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>>>        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>>>        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>>>        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>>>        at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>>>        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>>>        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>>>        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>>>        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>>>        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>>        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>>>        at org.apache.axis.client.Call.invoke(Call.java:2748)
>>>        at org.apache.axis.client.Call.invoke(Call.java:1902)
>>>        at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>>>        at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>>>
>>>        {http://xml.apache.org/axis/}hostname:adapt20
>>>
>>>Internal server error occurred.
>>>        at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>>>        at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>>>        at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>>>        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>>>        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>>>        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>>>        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>>>        at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>>>        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>>>        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>>>        at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>>>        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>>>        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>>>        at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>>>        at org.apache.axis.client.Call.invoke(Call.java:2748)
>>>        at org.apache.axis.client.Call.invoke(Call.java:1902)
>>>        at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>>>        at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>>>
>>>and I get the following in the catalina.out log:
>>>
>>>AxisFault
>>> faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
>>> faultSubcode:
>>> faultString: Service /etc/init.d/gdm is blacklisted
>>> faultActor:
>>> faultNode:
>>> faultDetail:
>>>        {http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
>>>        {http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
>>>        at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>>>        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:585)
>>>        at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>>>        at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>>>        at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>>>        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>>>        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>>>        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>>>        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>>>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>>>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>>>        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>>>        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>>>        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>>        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>>>        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>>>        at java.lang.Thread.run(Thread.java:595)
>>>
>>>        {http://xml.apache.org/axis/}hostname:adapt20
>>>
>>>Service /etc/init.d/gdm is blacklisted
>>>        at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>>>        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:585)
>>>        at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>>>        at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>>>        at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>>>        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>>>        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>>>        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>>>        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>>>        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>>>        at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>>>        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>>>        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>>>        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>>>        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>>>        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>>>        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>>>        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>>>        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>>>        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>>>        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>>>        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>>>        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>>>        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>>>        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>>>        at java.lang.Thread.run(Thread.java:595)
>>>
>>>I don't know why but it seems that the exception is catched instead of being thrown, so a general server fault is generated instead of a custom fault.
>>>
>>>--
>>>Saludos.
>>>José Antonio Sánchez
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wsrf-user-help@ws.apache.org
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
>>>For additional commands, e-mail: wsrf-user-help@ws.apache.org
>>>
>>>
>>>      
>>>
>>--
>>Saludos.
>>José Antonio Sánchez
>>
>>    
>>
>
>
>--
>Saludos.
>José Antonio Sánchez
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
>For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
>  
>
Jose, are you sure you are getting to your fault and that something else 
is not occurring?

Is there any way that you could attach (remote debug) and follow the code?

---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


Re: Throwing Faults

Posted by José Antonio Sánchez <ge...@gmail.com>.
Using TcpMon this is the request:

POST /muse/services/InitPort HTTP/1.0

Content-Type: text/xml; charset=utf-8

Accept: application/soap+xml, application/dime, multipart/related, text/*

User-Agent: Axis/1.2.1

Host: 127.0.0.1:8081

Cache-Control: no-cache

Pragma: no-cache

SOAPAction: ""

Content-Length: 829

Authorization: Basic d3NkbXVzZXJ0b206d3NkbXRvbWFzMw==



<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:fs="http://tomas.org/wsdm/init"
xmlns:wsrp="http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
  <soapenv:Header>
    <wsa:To soapenv:mustUnderstand="1">
      http://adapt20:8081/muse/services/InitPort</wsa:To>
    <wsa:Action soapenv:mustUnderstand="1">
      http://tomas.org/wsdm/init/InitPortType/Create</wsa:Action>
    <fs:ResourceIdentifier soapenv:mustUnderstand="1">
      Init</fs:ResourceIdentifier>
  </soapenv:Header>
  <soapenv:Body>
    <CreateRequestType xmlns="http://tomas.org/wsdm/init">
      gdm</CreateRequestType>
  </soapenv:Body>
</soapenv:Envelope>

And this is the response:

HTTP/1.1 500 Error Interno del Servidor

Server: Apache-Coyote/1.1

Content-Type: text/xml;charset=utf-8

Date: Wed, 12 Apr 2006 08:42:22 GMT

Connection: close



<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server</faultcode>
   <faultstring>Internal server error occurred.</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

As you can see, there's no reference to my custom fault, but in the
catalina.out file. Maybe a Tomcat configuration problem?

On 4/11/06, José Antonio Sánchez <ge...@gmail.com> wrote:
> I don't have the code right now so I cannot assure it, but I used
> Tcpmon all the way to do the test and it returned something like:
>
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
>  faultSubcode:
>  faultString: Internal server error occurred.
>  faultActor:
>  faultNode:
>  faultDetail:
>
> Without a faultDetail, thats for sure. Anyway, tomorrow I'll send the
> complete request and response.
>
> On 4/11/06, Campana Jr., Salvatore J <sa...@hp.com> wrote:
> > Jose,
> >
> > The stack trace you sent seems to be coming from an Axis client....I'm not sure what their issue is...I would examine the returned fault obejct in the debugger to see if it contains the message...
> >
> > The other thing you could do is setup Axis's TCPMon as a proxy and view the fault on the wire....
> >
> > As for the server, it seems as though the fault is being thrown correctly, that is why you see it in the log output...
> >
> > -S
> >
> > -----Original Message-----
> > From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> > Sent: Tuesday, April 11, 2006 12:07 PM
> > To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
> > Subject: Throwing Faults
> >
> > Hello, I have implemented service and I want an operation to throw a fault when something happens. I have followed the filesystem example with the DeviceBusyFault exception and I have added that to my operation. I had the service generated without faults, but a new ant generate created the corresponding ServiceBlacklistedFaultException.java file (my custom fault) and added the throws ServiceBlacklistedFaultException to the AbstractService file. I manually added the throws ServiceBlacklistedFaultException to my Service file with the following:
> > The method in fact is a Resource creation method. It looks in a file for a list of blacklisted ids and throws a fault if the requested resource is in the blacklist:
> >
> > public org.tomas.wsdm.init.CreateResponseTypeDocument create( org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws ServiceBlacklistedFaultException
> >
> >    {
> >
> >         org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument = org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
> >
> >         InitPortHome myResourceHome = (InitPortHome) this.getResourceContext().getResourceHome();
> >
> >
> >
> >
> >
> >                 Vector blackList = readBlacklist();
> >
> >                 String createId = requestDoc.getCreateRequestType();
> >
> >
> >
> >                 if (!blackList.contains(createId))
> >
> >                 {
> >
> >                         try {
> >
> >                                         myResourceHome.createResource(createId);
> >
> >                                 } catch (Exception e) {
> >
> >                                         // TODO Auto-generated catch block
> >
> >                                         e.printStackTrace();
> >
> >                                 }
> >
> >                 }
> >
> >                 else {
> >
> >                         throw new
> > ServiceBlacklistedFaultException(getNamespaceSet(),"Service
> > /etc/init.d/"+createId+" is blacklisted");
> >
> >                 }
> >
> >
> >
> >                         Iterator it = myResourceHome.getResourceMap().keySet().iterator();
> >
> >                         System.out.println("Esta es la lista de recursos:");
> >
> >                         System.out.println(it.next().toString());
> >
> >                         while (it.hasNext())
> >
> >                         System.out.println(it.next().toString());
> >
> >
> >
> >         /**
> >
> >          * TODO implement method and populate the response object
> >
> >          *
> >
> >          * For more information on working-with/populating the XmlBean-generated types.
> >
> >          *
> >
> >          * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
> >
> >          */
> >
> >                         return responseDocument;
> >
> >    }
> >
> > I've compiled and deployed it correctly, but when I try to create a blacklisted resource, instead of my custom fault I get a general ServerFault like this:
> >
> > AxisFault
> >  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
> >  faultSubcode:
> >  faultString: Internal server error occurred.
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
> >         at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
> >         at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
> >         at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> >         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> >         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> >         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> >         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> >         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> >         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> >         at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> >         at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
> >         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> >         at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
> >         at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
> >         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
> >         at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
> >         at org.apache.axis.client.Call.invoke(Call.java:2748)
> >         at org.apache.axis.client.Call.invoke(Call.java:1902)
> >         at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
> >         at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
> >
> >         {http://xml.apache.org/axis/}hostname:adapt20
> >
> > Internal server error occurred.
> >         at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
> >         at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
> >         at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
> >         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
> >         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
> >         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
> >         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
> >         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
> >         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
> >         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
> >         at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
> >         at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
> >         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
> >         at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
> >         at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
> >         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
> >         at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
> >         at org.apache.axis.client.Call.invoke(Call.java:2748)
> >         at org.apache.axis.client.Call.invoke(Call.java:1902)
> >         at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
> >         at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
> >
> > and I get the following in the catalina.out log:
> >
> > AxisFault
> >  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
> >  faultSubcode:
> >  faultString: Service /etc/init.d/gdm is blacklisted
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
> >         {http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
> >         at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
> >         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:585)
> >         at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
> >         at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
> >         at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
> >         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> >         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> >         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> >         at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> >         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> >         at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
> >         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> >         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> >         at java.lang.Thread.run(Thread.java:595)
> >
> >         {http://xml.apache.org/axis/}hostname:adapt20
> >
> > Service /etc/init.d/gdm is blacklisted
> >         at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
> >         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:585)
> >         at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
> >         at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
> >         at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
> >         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> >         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> >         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> >         at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
> >         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
> >         at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
> >         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
> >         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
> >         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
> >         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
> >         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
> >         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
> >         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
> >         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
> >         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
> >         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
> >         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
> >         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
> >         at java.lang.Thread.run(Thread.java:595)
> >
> > I don't know why but it seems that the exception is catched instead of being thrown, so a general server fault is generated instead of a custom fault.
> >
> > --
> > Saludos.
> > José Antonio Sánchez
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> > For additional commands, e-mail: wsrf-user-help@ws.apache.org
> >
> >
>
>
> --
> Saludos.
> José Antonio Sánchez
>


--
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


Re: Throwing Faults

Posted by José Antonio Sánchez <ge...@gmail.com>.
I don't have the code right now so I cannot assure it, but I used
Tcpmon all the way to do the test and it returned something like:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Internal server error occurred.
 faultActor:
 faultNode:
 faultDetail:

Without a faultDetail, thats for sure. Anyway, tomorrow I'll send the
complete request and response.

On 4/11/06, Campana Jr., Salvatore J <sa...@hp.com> wrote:
> Jose,
>
> The stack trace you sent seems to be coming from an Axis client....I'm not sure what their issue is...I would examine the returned fault obejct in the debugger to see if it contains the message...
>
> The other thing you could do is setup Axis's TCPMon as a proxy and view the fault on the wire....
>
> As for the server, it seems as though the fault is being thrown correctly, that is why you see it in the log output...
>
> -S
>
> -----Original Message-----
> From: José Antonio Sánchez [mailto:getaceres@gmail.com]
> Sent: Tuesday, April 11, 2006 12:07 PM
> To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
> Subject: Throwing Faults
>
> Hello, I have implemented service and I want an operation to throw a fault when something happens. I have followed the filesystem example with the DeviceBusyFault exception and I have added that to my operation. I had the service generated without faults, but a new ant generate created the corresponding ServiceBlacklistedFaultException.java file (my custom fault) and added the throws ServiceBlacklistedFaultException to the AbstractService file. I manually added the throws ServiceBlacklistedFaultException to my Service file with the following:
> The method in fact is a Resource creation method. It looks in a file for a list of blacklisted ids and throws a fault if the requested resource is in the blacklist:
>
> public org.tomas.wsdm.init.CreateResponseTypeDocument create( org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws ServiceBlacklistedFaultException
>
>    {
>
>         org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument = org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();
>
>         InitPortHome myResourceHome = (InitPortHome) this.getResourceContext().getResourceHome();
>
>
>
>
>
>                 Vector blackList = readBlacklist();
>
>                 String createId = requestDoc.getCreateRequestType();
>
>
>
>                 if (!blackList.contains(createId))
>
>                 {
>
>                         try {
>
>                                         myResourceHome.createResource(createId);
>
>                                 } catch (Exception e) {
>
>                                         // TODO Auto-generated catch block
>
>                                         e.printStackTrace();
>
>                                 }
>
>                 }
>
>                 else {
>
>                         throw new
> ServiceBlacklistedFaultException(getNamespaceSet(),"Service
> /etc/init.d/"+createId+" is blacklisted");
>
>                 }
>
>
>
>                         Iterator it = myResourceHome.getResourceMap().keySet().iterator();
>
>                         System.out.println("Esta es la lista de recursos:");
>
>                         System.out.println(it.next().toString());
>
>                         while (it.hasNext())
>
>                         System.out.println(it.next().toString());
>
>
>
>         /**
>
>          * TODO implement method and populate the response object
>
>          *
>
>          * For more information on working-with/populating the XmlBean-generated types.
>
>          *
>
>          * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema
>
>          */
>
>                         return responseDocument;
>
>    }
>
> I've compiled and deployed it correctly, but when I try to create a blacklisted resource, instead of my custom fault I get a general ServerFault like this:
>
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
>  faultSubcode:
>  faultString: Internal server error occurred.
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
>         at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>         at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>         at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>         at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>         at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>         at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>         at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>         at org.apache.axis.client.Call.invoke(Call.java:2748)
>         at org.apache.axis.client.Call.invoke(Call.java:1902)
>         at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>         at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
>         {http://xml.apache.org/axis/}hostname:adapt20
>
> Internal server error occurred.
>         at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
>         at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
>         at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
>         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
>         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
>         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>         at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
>         at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
>         at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
>         at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
>         at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
>         at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
>         at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
>         at org.apache.axis.client.Call.invoke(Call.java:2748)
>         at org.apache.axis.client.Call.invoke(Call.java:1902)
>         at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
>         at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)
>
> and I get the following in the catalina.out log:
>
> AxisFault
>  faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
>  faultSubcode:
>  faultString: Service /etc/init.d/gdm is blacklisted
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
>         {http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
>         at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>         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:585)
>         at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>         at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>         at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>         at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>         at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>         at java.lang.Thread.run(Thread.java:595)
>
>         {http://xml.apache.org/axis/}hostname:adapt20
>
> Service /etc/init.d/gdm is blacklisted
>         at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
>         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:585)
>         at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
>         at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
>         at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
>         at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
>         at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
>         at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
>         at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
>         at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
>         at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
>         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
>         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>         at java.lang.Thread.run(Thread.java:595)
>
> I don't know why but it seems that the exception is catched instead of being thrown, so a general server fault is generated instead of a custom fault.
>
> --
> Saludos.
> José Antonio Sánchez
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: wsrf-user-help@ws.apache.org
>
>


--
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


RE: Throwing Faults

Posted by "Campana Jr., Salvatore J" <sa...@hp.com>.
Jose,

The stack trace you sent seems to be coming from an Axis client....I'm not sure what their issue is...I would examine the returned fault obejct in the debugger to see if it contains the message...

The other thing you could do is setup Axis's TCPMon as a proxy and view the fault on the wire....

As for the server, it seems as though the fault is being thrown correctly, that is why you see it in the log output...

-S 

-----Original Message-----
From: José Antonio Sánchez [mailto:getaceres@gmail.com] 
Sent: Tuesday, April 11, 2006 12:07 PM
To: muse-user@ws.apache.org; wsrf-user@ws.apache.org
Subject: Throwing Faults

Hello, I have implemented service and I want an operation to throw a fault when something happens. I have followed the filesystem example with the DeviceBusyFault exception and I have added that to my operation. I had the service generated without faults, but a new ant generate created the corresponding ServiceBlacklistedFaultException.java file (my custom fault) and added the throws ServiceBlacklistedFaultException to the AbstractService file. I manually added the throws ServiceBlacklistedFaultException to my Service file with the following:
The method in fact is a Resource creation method. It looks in a file for a list of blacklisted ids and throws a fault if the requested resource is in the blacklist:

public org.tomas.wsdm.init.CreateResponseTypeDocument create( org.tomas.wsdm.init.CreateRequestTypeDocument requestDoc ) throws ServiceBlacklistedFaultException

   {

     	org.tomas.wsdm.init.CreateResponseTypeDocument responseDocument = org.tomas.wsdm.init.CreateResponseTypeDocument.Factory.newInstance();

     	InitPortHome myResourceHome = (InitPortHome) this.getResourceContext().getResourceHome();

    	

     		

     		Vector blackList = readBlacklist();

     		String createId = requestDoc.getCreateRequestType();

     		

     		if (!blackList.contains(createId))

     		{

     			try {

					myResourceHome.createResource(createId);					

				} catch (Exception e) {

					// TODO Auto-generated catch block

					e.printStackTrace();

				}

     		}

     		else {

     			throw new
ServiceBlacklistedFaultException(getNamespaceSet(),"Service
/etc/init.d/"+createId+" is blacklisted");

     		}

			

			Iterator it = myResourceHome.getResourceMap().keySet().iterator();

			System.out.println("Esta es la lista de recursos:");

			System.out.println(it.next().toString());

			while (it.hasNext())

			System.out.println(it.next().toString());



     	/**

     	 * TODO implement method and populate the response object

     	 *

     	 * For more information on working-with/populating the XmlBean-generated types.

     	 *

     	 * See http://xmlbeans.apache.org/documentation/tutorial_getstarted.html#Results+of+Compiling+the+Schema

     	 */

			return responseDocument;

   }

I've compiled and deployed it correctly, but when I try to create a blacklisted resource, instead of my custom fault I get a general ServerFault like this:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Internal server error occurred.
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}stackTrace:Internal server error occurred.
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
	at org.apache.axis.client.Call.invoke(Call.java:2748)
	at org.apache.axis.client.Call.invoke(Call.java:1902)
	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)

	{http://xml.apache.org/axis/}hostname:adapt20

Internal server error occurred.
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:221)
	at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:128)
	at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
	at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:424)
	at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
	at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
	at org.apache.axis.client.Call.invokeEngine(Call.java:2765)
	at org.apache.axis.client.Call.invoke(Call.java:2748)
	at org.apache.axis.client.Call.invoke(Call.java:1902)
	at org.tomas.wsdm.init.client.InitResource.create(InitResource.java:60)
	at org.tomas.wsdm.init.client.InitClient.main(InitClient.java:32)

and I get the following in the catalina.out log:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Service /etc/init.d/gdm is blacklisted
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axis/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedFaultException
	{http://xml.apache.org/axis/}stackTrace:Service /etc/init.d/gdm is blacklisted
	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
	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:585)
	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

	{http://xml.apache.org/axis/}hostname:adapt20

Service /etc/init.d/gdm is blacklisted
	at org.tomas.wsdm.init.InitPortService.create(InitPortService.java:116)
	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:585)
	at org.apache.ws.resource.handler.ResourceHandler.invokeServiceMethod(ResourceHandler.java:534)
	at org.apache.ws.resource.handler.ResourceHandler.handleRequest(ResourceHandler.java:174)
	at org.apache.ws.resource.handler.axis.ResourceProvider.invoke(ResourceProvider.java:209)
	at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
	at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
	at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
	at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
	at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
	at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

I don't know why but it seems that the exception is catched instead of being thrown, so a general server fault is generated instead of a custom fault.

--
Saludos.
José Antonio Sánchez

---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: wsrf-user-unsubscribe@ws.apache.org
For additional commands, e-mail: wsrf-user-help@ws.apache.org