Sorry about previous posting on another thread. Here goes.
Hi,
I wanted to intercept the marshalling process and catch the exception
and throw a generic fault instead of the standard fault that I see when
I turn on validation.
I tried putting in a validation as given at the end of the email.
Questions:
1) Why doesn't this work?(My sysout doesn't show up) Is my phase
constant wrong?
2) Is this the best way to intercept the marshalling process?
Thanks
Santosh
Spring configuration
<bean name="theInterceptor"
class="com.company.MarshallInterceptor">
</bean>
</cxf:features>
<cxf:inInterceptors>
<ref bean="theInterceptor" />
</cxf:inInterceptors>
</cxf:bus>
<jaxws:endpoint
id="paymentService"
implementor="com.company.ComeServiceImpl"
wsdlLocation="config/wsdl/someService.wsdl"
address="/someService">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
Interceptor code:
package com.company;
import java.io.IOException;
import javax.xml.bind.helpers.AbstractMarshallerImpl;
import org.apache.cxf.attachment.AttachmentDeserializer;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
public class MarshallInterceptor extends
AbstractPhaseInterceptor<Message> {
public MarshallInterceptor() {
super(Phase.PRE_MARSHAL);
}
public void handleMessage(Message message) {
String contentType = (String) message.get(Message.CONTENT_TYPE);
System.out.println("handling the message "+contentType);
}
public void handleFault(Message messageParam) {
System.out.println("there was a fault ");
}
}
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete the material from any
computer.