cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michał Mech (Created) (JIRA) <j...@apache.org>
Subject [jira] [Created] (CXF-3925) WebFaultOutInterceptor expects the Fault.
Date Fri, 18 Nov 2011 12:32:51 GMT
WebFaultOutInterceptor expects the Fault.
-----------------------------------------

                 Key: CXF-3925
                 URL: https://issues.apache.org/jira/browse/CXF-3925
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.4.4
            Reporter: Michał Mech


WebFaultOutInterceptor reports NullPointerException when message content doesn't contains
Exception.

I was trying to create custom interceptor to transform SoapFault to SoapMessage ([read more|http://stackoverflow.com/questions/8066474/how-to-transform-soapfault-to-soapmessage-via-interceptor-in-cxf])
and when I registered interceptor like:
{code:title=InternalActServiceFaultOutInterceptor.java|borderStyle=solid}
public class InternalActServiceFaultOutInterceptor extends
		AbstractSoapInterceptor {

	public InternalActServiceFaultOutInterceptor() {
		super(Phase.PRE_STREAM);

		addBefore(Arrays.asList(StaxOutInterceptor.class.getName(), AttachmentOutInterceptor.class.getName()));
	}

	@Override
	public void handleMessage(SoapMessage soapMessage) throws Fault {
		Exception exception = soapMessage.getContent(Exception.class);
		if (exception != null) {
			soapMessage.getExchange().put(Exception.class, null);

			for (Class<?> contentFormat : soapMessage.getContentFormats()) {
				soapMessage.setContent(contentFormat, null);
			}

			soapMessage.setContent(List.class, new MessageContentsList(createSoapMessage(RegisterDocumentResponse.class)));
		}
	}

	private <T> RegisterDocumentResponse createSoapMessage(Class<T> messageType)
{
		RegisterDocumentResponse response = new RegisterDocumentResponse();
		response.setStatus(ServiceStatusType.SUCCESS);

		return response;
	}
}
{code}
I saw:
{noformat}
WARN  [http-8080-1][,,][PhaseInterceptorChain.doLog()] Interceptor for {http://...}InternalActServiceImplService#{http://...}registerDocument
has thrown exception, unwinding now
java.lang.NullPointerException
	at org.apache.cxf.jaxws.interceptors.WebFaultOutInterceptor.handleMessage(WebFaultOutInterceptor.java:83)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
	at org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:105)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:323)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:218)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:200)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:114)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
{noformat}

It's all because WebFaultOutInterceptor expecting in line 83 Fault in message.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

Mime
View raw message