List Info

Thread: Throwing Faults




Throwing Faults
user name
2006-04-11 16:07:26
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.newIn
stance();

     	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(),"Se
rvice
/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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Internal server error occurred.
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)

	{http://xml.apache.org/axi
s/}hostname:adapt20

Internal server error occurred.
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)

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

AxisFault
 faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Service /etc/init.d/gdm is blacklisted
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
	{http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

	{http://xml.apache.org/axi
s/}hostname:adapt20

Service /etc/init.d/gdm is blacklisted
	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-11 18:30:31
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.newIn
stance();
>
>     	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(),&quo
t;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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
> faultSubcode:
> faultString: Internal server error occurred.
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
>	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>
>	{http://xml.apache.org/axi
s/}hostname:adapt20
>
>Internal server error occurred.
>	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>
>and I get the following in the catalina.out log:
>
>AxisFault
> faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
> faultSubcode:
> faultString: Service /etc/init.d/gdm is blacklisted
> faultActor:
> faultNode:
> faultDetail:
>	{http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
>	{http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
>	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
>	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>	at java.lang.reflect.Method.invoke(Method.java:585)
>	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
>	at java.lang.Thread.run(Thread.java:595)
>
>	{http://xml.apache.org/axi
s/}hostname:adapt20
>
>Service /etc/init.d/gdm is blacklisted
>	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
>	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>	at java.lang.reflect.Method.invoke(Method.java:585)
>	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
>For additional commands, e-mail: wsrf-user-helpws.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-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-11 18:26:58
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:getaceresgmail.com] 
Sent: Tuesday, April 11, 2006 12:07 PM
To: muse-userws.apache.org; wsrf-userws.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.newIn
stance();

     	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(),"Se
rvice
/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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
 faultSubcode:
 faultString: Internal server error occurred.
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)

	{http://xml.apache.org/axi
s/}hostname:adapt20

Internal server error occurred.
	at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
	at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
	at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
	at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
	at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
	at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
	at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
	at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)

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

AxisFault
 faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
 faultSubcode:
 faultString: Service /etc/init.d/gdm is blacklisted
 faultActor:
 faultNode:
 faultDetail:
	{http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
	{http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
	at java.lang.Thread.run(Thread.java:595)

	{http://xml.apache.org/axi
s/}hostname:adapt20

Service /etc/init.d/gdm is blacklisted
	at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
	at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
	at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
	at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
	at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org


------------------------------------------------------------
---------
To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-11 18:33:38
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://sche
mas.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 <sal.campanahp.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:getaceresgmail.com]
> Sent: Tuesday, April 11, 2006 12:07 PM
> To: muse-userws.apache.org; wsrf-userws.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.newIn
stance();
>
>         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(),"Se
rvice
> /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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
>  faultSubcode:
>  faultString: Internal server error occurred.
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
>         at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>         at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>         at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>         at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>         at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>         at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>
>         {http://xml.apache.org/axi
s/}hostname:adapt20
>
> Internal server error occurred.
>         at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>         at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>         at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>         at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>         at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>         at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>
> and I get the following in the catalina.out log:
>
> AxisFault
>  faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
>  faultSubcode:
>  faultString: Service /etc/init.d/gdm is blacklisted
>  faultActor:
>  faultNode:
>  faultDetail:
>         {http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
>         {http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
>         at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>         at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>         at
java.lang.reflect.Method.invoke(Method.java:585)
>         at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>         at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>         at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>         at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>         at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>         at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>         at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>         at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
>         at java.lang.Thread.run(Thread.java:595)
>
>         {http://xml.apache.org/axi
s/}hostname:adapt20
>
> Service /etc/init.d/gdm is blacklisted
>         at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>         at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>         at
java.lang.reflect.Method.invoke(Method.java:585)
>         at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>         at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>         at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>         at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>         at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>         at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>         at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>         at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>         at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
> For additional commands, e-mail: wsrf-user-helpws.apache.org
>
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
> For additional commands, e-mail: wsrf-user-helpws.apache.org
>
>


--
Saludos.
José Antonio Sánchez

------------------------------------------------------------
---------
To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-12 08:46:48
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://sche
mas.xmlsoap.org/soap/envelope/"
xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
xmlnssi=&
quot;http://www.
w3.org/2001/XMLSchema-instance"
xmlns:fs="http://tomas.org/wsdm/init
"
xmlns:wsrp="http://docs.oasis-open.org/ws
rf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd&
quot;
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&g
t;
    <wsa:Action
soapenv:mustUnderstand="1">
      http://tomas.org/wsdm/init/InitPortType/Create&
lt;/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://sche
mas.xmlsoap.org/soap/envelope/"
xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
xmlnssi=&
quot;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 <getaceresgmail.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://sche
mas.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
<sal.campanahp.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:getaceresgmail.com]
> > Sent: Tuesday, April 11, 2006 12:07 PM
> > To: muse-userws.apache.org; wsrf-userws.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.newIn
stance();
> >
> >         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(),"Se
rvice
> > /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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
> >  faultSubcode:
> >  faultString: Internal server error occurred.
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
> >         at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
> >         at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
> >         at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
> >         at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
> >         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
> >         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
> >         at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
> >
> >         {http://xml.apache.org/axi
s/}hostname:adapt20
> >
> > Internal server error occurred.
> >         at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
> >         at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
> >         at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
> >         at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
> >         at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
> >         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
> >         at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
> >         at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
> >
> > and I get the following in the catalina.out log:
> >
> > AxisFault
> >  faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
> >  faultSubcode:
> >  faultString: Service /etc/init.d/gdm is
blacklisted
> >  faultActor:
> >  faultNode:
> >  faultDetail:
> >         {http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
> >         {http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
> >         at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
> >         at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
> >         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
> >         at
java.lang.reflect.Method.invoke(Method.java:585)
> >         at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
> >         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >         at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
> >         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
> >         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
> >         at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
> >         at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
> >         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
> >         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
> >         at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
> >         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
> >         at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
> >         at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
> >         at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
> >         at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
> >         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
> >         at java.lang.Thread.run(Thread.java:595)
> >
> >         {http://xml.apache.org/axi
s/}hostname:adapt20
> >
> > Service /etc/init.d/gdm is blacklisted
> >         at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
> >         at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >         at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
> >         at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
> >         at
java.lang.reflect.Method.invoke(Method.java:585)
> >         at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
> >         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> >         at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
> >         at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> >         at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
> >         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
> >         at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
> >         at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
> >         at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
> >         at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
> >         at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
> >         at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
> >         at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
> >         at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
> >         at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
> >         at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
> >         at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
> > For additional commands, e-mail:
wsrf-user-helpws.apache.org
> >
> >
> >
------------------------------------------------------------
---------
> > To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
> > For additional commands, e-mail:
wsrf-user-helpws.apache.org
> >
> >
>
>
> --
> Saludos.
> José Antonio Sánchez
>


--
Saludos.
José Antonio Sánchez

------------------------------------------------------------
---------
To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-19 14:06:43
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://sche
mas.xmlsoap.org/soap/envelope/"
>xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
>xmlnssi=&
quot;http://www.
w3.org/2001/XMLSchema-instance"
>xmlns:fs="http://tomas.org/wsdm/init
"
>xmlns:wsrp="http://docs.oasis-open.org/ws
rf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd&
quot;
>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&g
t;
>    <wsa:Action
soapenv:mustUnderstand="1">
>      http://tomas.org/wsdm/init/InitPortType/Create&
lt;/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://sche
mas.xmlsoap.org/soap/envelope/"
>xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
>xmlnssi=&
quot;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 <getaceresgmail.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://sche
mas.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
<sal.campanahp.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:getaceresgmail.com]
>>>Sent: Tuesday, April 11, 2006 12:07 PM
>>>To: muse-userws.apache.org;
wsrf-userws.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.newIn
stance();
>>>
>>>        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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
>>> faultSubcode:
>>> faultString: Internal server error occurred.
>>> faultActor:
>>> faultNode:
>>> faultDetail:
>>>        {http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
>>>        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>>>        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>>>        at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>>>        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>>>
>>>        {http://xml.apache.org/axi
s/}hostname:adapt20
>>>
>>>Internal server error occurred.
>>>        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
>>>        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
>>>        at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
>>>        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
>>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
>>>        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
>>>
>>>and I get the following in the catalina.out log:
>>>
>>>AxisFault
>>> faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
>>> faultSubcode:
>>> faultString: Service /etc/init.d/gdm is
blacklisted
>>> faultActor:
>>> faultNode:
>>> faultDetail:
>>>        {http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
>>>        {http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
>>>        at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>>>        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>>>        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>>>        at
java.lang.reflect.Method.invoke(Method.java:585)
>>>        at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>>>        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>>>        at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>>>        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>>>        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>>>        at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>>>        at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>>>        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>>>        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>>>        at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>>>        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>>>        at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>>>        at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>>>        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>>>        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>>>        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(ThreadPool.java:684)
>>>        at java.lang.Thread.run(Thread.java:595)
>>>
>>>        {http://xml.apache.org/axi
s/}hostname:adapt20
>>>
>>>Service /etc/init.d/gdm is blacklisted
>>>        at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
>>>        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
>>>        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
>>>        at
java.lang.reflect.Method.invoke(Method.java:585)
>>>        at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
>>>        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>>>        at
org.apache.axis.transport.http.AxisServletBase.service(AxisS
ervletBase.java:327)
>>>        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>>>        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFi
lter(ApplicationFilterChain.java:252)
>>>        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(App
licationFilterChain.java:173)
>>>        at
org.apache.catalina.core.StandardWrapperValve.invoke(Standar
dWrapperValve.java:213)
>>>        at
org.apache.catalina.core.StandardContextValve.invoke(Standar
dContextValve.java:178)
>>>        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHo
stValve.java:126)
>>>        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepo
rtValve.java:105)
>>>        at
org.apache.catalina.core.StandardEngineValve.invoke(Standard
EngineValve.java:107)
>>>        at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAd
apter.java:148)
>>>        at
org.apache.coyote.http11.Http11Processor.process(Http11Proce
ssor.java:869)
>>>        at
org.apache.coyote.http11.Http11BaseProtocol$Http11Connection
Handler.processConnection(Http11BaseProtocol.java:667)
>>>        at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Poo
lTcpEndpoint.java:527)
>>>        at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
>>>        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.ru
n(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-unsubscribews.apache.org
>>>For additional commands, e-mail:
wsrf-user-helpws.apache.org
>>>
>>>
>>>------------------------------------------------
---------------------
>>>To unsubscribe, e-mail:
wsrf-user-unsubscribews.apache.org
>>>For additional commands, e-mail:
wsrf-user-helpws.apache.org
>>>
>>>
>>>      
>>>
>>--
>>Saludos.
>>José Antonio Sánchez
>>
>>    
>>
>
>
>--
>Saludos.
>José Antonio Sánchez
>
>--------------------------------------------------------
-------------
>To unsubscribe, e-mail: wsrf-user-unsubscribews.apache.org
>For additional commands, e-mail: wsrf-user-helpws.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-unsubscribews.apache.org
For additional commands, e-mail: wsrf-user-helpws.apache.org

Throwing Faults
user name
2006-04-19 16:49:25
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 <scampapache.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://sche
mas.xmlsoap.org/soap/envelope/"
> >xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
> >xmlnssi=&
quot;http://www.
w3.org/2001/XMLSchema-instance"
> >xmlns:fs="http://tomas.org/wsdm/init
"
> >xmlns:wsrp="http://docs.oasis-open.org/ws
rf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd&
quot;
> >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&g
t;
> >    <wsa:Action
soapenv:mustUnderstand="1">
> >      http://tomas.org/wsdm/init/InitPortType/Create&
lt;/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://sche
mas.xmlsoap.org/soap/envelope/"
> >xmlnssd=&
quot;http://www.w3.org/20
01/XMLSchema"
> >xmlnssi=&
quot;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 <getaceresgmail.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://sche
mas.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
<sal.campanahp.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:getaceresgmail.com]
> >>>Sent: Tuesday, April 11, 2006 12:07 PM
> >>>To: muse-userws.apache.org;
wsrf-userws.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.newIn
stance();
> >>>
> >>>        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+o
f+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://sche
mas.xmlsoap.org/soap/envelope/}Server
> >>> faultSubcode:
> >>> faultString: Internal server error
occurred.
> >>> faultActor:
> >>> faultNode:
> >>> faultDetail:
> >>>        {http://xml.apache.org/axi
s/}stackTrace:Internal server error occurred.
> >>>        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
> >>>        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
> >>>        at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
> >>>
> >>>        {http://xml.apache.org/axi
s/}hostname:adapt20
> >>>
> >>>Internal server error occurred.
> >>>        at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFau
ltBuilder.java:221)
> >>>        at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaul
tBuilder.java:128)
> >>>        at
org.apache.axis.encoding.DeserializationContext.endElement(D
eserializationContext.java:1087)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser
.endElement(AbstractSAXParser.java:633)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScanner
Impl.scanEndElement(XMLNSDocumentScannerImpl.java:719)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFra
gmentScannerImpl.java:1685)
> >>>        at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentS
cannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:
368)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:834)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XML11Configuratio
n.parse(XML11Configuration.java:764)
> >>>        at
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(X
MLParser.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(Deseri
alizationContext.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(M
ustUnderstandChecker.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:3
2)
> >>>
> >>>and I get the following in the catalina.out
log:
> >>>
> >>>AxisFault
> >>> faultCode: {http://sche
mas.xmlsoap.org/soap/envelope/}Server.generalException
> >>> faultSubcode:
> >>> faultString: Service /etc/init.d/gdm is
blacklisted
> >>> faultActor:
> >>> faultNode:
> >>> faultDetail:
> >>>        {http://xml.apache.org/axi
s/}exceptionName:org.tomas.wsdm.init.ServiceBlacklistedF
aultException
> >>>        {http://xml.apache.org/axi
s/}stackTrace:Service /etc/init.d/gdm is blacklisted
> >>>        at
org.tomas.wsdm.init.InitPortService.create(InitPortService.j
ava:116)
> >>>        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>>        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
ssorImpl.java:39)
> >>>        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
thodAccessorImpl.java:25)
> >>>        at
java.lang.reflect.Method.invoke(Method.java:585)
> >>>        at
org.apache.ws.resource.handler.ResourceHandler.invokeService
Method(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(Invocati
onStrategy.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(AxisServle
t.java:699)
> >>>        at
javax.se