Scandelli Francesco wrote:
Hi
I'm not managing to throw customized faults (i.e. the ones that I define
through the element <fault> within my <operation>s in the portType
section of my wsdl). In fact when I try to launch an exception from my
custom methods in *Service.java I get the following SOAP message:
[soapClient] SOAP request failed with HTTP status: 500 Internal Server
Error
[soapClient] <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soape
nv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001
/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[soapClient] <soapenv:Body>
[soapClient] <soapenv:Fault>
[soapClient] <faultcode
xmlns:ns1="http://xml.apache.org/axis/">ns1:Server</f
aultcode>
[soapClient] <faultstring>Server Error</faultstring>
[soapClient] <detail>
[soapClient] <ns2:stackTrace
xmlns:ns2="http://xml.apache.org/axis/">Server
Error
[soapClient] at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.
java:473)
[soapClient] at
org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
[soapClient] at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet
.java:699)
[soapClient] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
[soapClient] at
org.apache.axis.transport.http.AxisServletBase.service(AxisSe
rvletBase.java:327)
[soapClient] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[soapClient] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFil
ter(ApplicationFilterChain.java:252)
[soapClient] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
icationFilterChain.java:173)
[soapClient] at
org.apache.catalina.core.StandardWrapperValve.invoke(Standard
WrapperValve.java:213)
[soapClient] at
org.apache.catalina.core.StandardContextValve.invoke(Standard
ContextValve.java:178)
[soapClient] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHos
tValve.java:126)
[soapClient] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepor
tValve.java:105)
[soapClient] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardE
ngineValve.java:107)
[soapClient] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAda
pter.java:148)
[soapClient] at
org.apache.coyote.http11.Http11Processor.process(Http11Proces
sor.java:869)
[soapClient] at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionH
andler.processConnection(Http11BaseProtocol.java:664)
[soapClient] at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Pool
TcpEndpoint.java:527)
[soapClient] at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(L
eaderFollowerWorkerThread.java:80)
[soapClient] at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:684)
[soapClient] at java.lang.Thread.run(Unknown Source)
[soapClient] </ns2:stackTrace>
[soapClient] <ns3:hostname
xmlns:ns3="http://xml.apache.org/axis/">iitcw308<
/ns3:hostname>
[soapClient] </detail>
[soapClient] </soapenv:Fault>
[soapClient] </soapenv:Body>
[soapClient] </soapenv:Envelope>
I tried to launch an exception by modifying the filesystem example but
the outcome doesn't change. Here the details:
I modified UnixFileSystem::mount() in UnixFileSystem.java in the
following way:
public void mount() throws Exception
{
m_isMounted = true;
throw new Exception("dummy
exceptionnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn");
}
In this way an exception MountDeviceBusyFaultException is also generated
in
FilesystemService::mount(org.apache.ws.resource.example.filesystem.Mount
Document) when I trigger the webservice with the following message:
[echo] ========================== REQUEST ============================
[concat] <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"
[concat]
xmlns:fs="http://ws.apache.org/resource/example/filesystem
">
[concat] <Header
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressi
ng">
[concat] <wsa:To
mustUnderstand="1">http://localhost:8080/muse/services
/filesystem</wsa:To>
[concat] <wsa:Action
mustUnderstand="1">http://ws.apache.org/resource/e
xample/filesystem/FileSystemPortType/Mount</wsa:Action>
[concat] <fs:ResourceIdentifier
mustUnderstand="1">/dev/vg00/lvol1</fs:
ResourceIdentifier>
[concat] </Header>
[concat] <Body>
[concat] <fs:Mount />
[concat] </Body>
[concat] </Envelope>
I get the following answer where there is not information about the
custom fault MountDeviceBusyFault:
[echo] ========================== RESPONSE ============================
[soapClient] SOAP request failed with HTTP status: 500 Internal Server
Error
[soapClient] <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope
xmlns:soape
nv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001
/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
[soapClient] <soapenv:Body>
[soapClient] <soapenv:Fault>
[soapClient] <faultcode
xmlns:ns1="http://xml.apache.org/axis/">ns1:Server</f
aultcode>
[soapClient] <faultstring>Server Error</faultstring>
[soapClient] <detail>
[soapClient] <ns2:stackTrace
xmlns:ns2="http://xml.apache.org/axis/">Server
Error
[soapClient] at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.
java:473)
[soapClient] at
org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
[soapClient] at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet
.java:699)
[soapClient] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
[soapClient] at
org.apache.axis.transport.http.AxisServletBase.service(AxisSe
rvletBase.java:327)
[soapClient] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[soapClient] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFil
ter(ApplicationFilterChain.java:252)
[soapClient] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(Appl
icationFilterChain.java:173)
[soapClient] at
org.apache.catalina.core.StandardWrapperValve.invoke(Standard
WrapperValve.java:213)
[soapClient] at
org.apache.catalina.core.StandardContextValve.invoke(Standard
ContextValve.java:178)
[soapClient] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHos
tValve.java:126)
[soapClient] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorRepor
tValve.java:105)
[soapClient] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardE
ngineValve.java:107)
[soapClient] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAda
pter.java:148)
[soapClient] at
org.apache.coyote.http11.Http11Processor.process(Http11Proces
sor.java:869)
[soapClient] at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionH
andler.processConnection(Http11BaseProtocol.java:664)
[soapClient] at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Pool
TcpEndpoint.java:527)
[soapClient] at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(L
eaderFollowerWorkerThread.java:80)
[soapClient] at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:684)
[soapClient] at java.lang.Thread.run(Unknown Source)
[soapClient] </ns2:stackTrace>
[soapClient] <ns3:hostname
xmlns:ns3="http://xml.apache.org/axis/">iitcw308<
/ns3:hostname>
[soapClient] </detail>
[soapClient] </soapenv:Fault>
[soapClient] </soapenv:Body>
[soapClient] </soapenv:Envelope>
Can you help me?
Thanks
Francesco
The launching of custom fualts is done by you throwing that fault
exception in your code. So if your method was generated to throw a
certain type of fault exception, then you need to create that...
I need to know how you have instantiated that exception, how you threw
it and what the generated java file for the exception contains....