Hi,

I'm using CXF in a client that is consuming the MS Exchange Web Service
(EWS).

I'm finding that one of the elements returned by this service (UniqueHash)
contains characters that are invalid in XML v1.0. As I have no control over
this I'm trying to use an inbound interceptor to drop the UniqueHash
elements (I don't need them) like this:

Map<String, String> inTransformMap = Collections.singletonMap(
"{http://schemas.microsoft.com/exchange/services/2006/types}UniqueHash";,
"");
TransformInInterceptor transformInInterceptor = new
TransformInInterceptor();
transformInInterceptor.setInTransformElements(inTransformMap);
client.getInInterceptors().add(transformInInterceptor);


I can see that the transform is running nice and early (post-stream):

FINE: Chain org.apache.cxf.phase.PhaseInterceptorChain@be78549 was created.
Current flow:
  receive [PolicyInInterceptor, LoggingInInterceptor,
AttachmentInInterceptor]
  post-stream [TransformInInterceptor, StaxInInterceptor]
  read [WSDLGetInterceptor, ReadHeadersInterceptor,
SoapActionInInterceptor, StartBodyInterceptor]
  pre-protocol [MustUnderstandInterceptor]
  post-protocol [CheckFaultInterceptor, JAXBAttachmentSchemaValidationHack]
  unmarshal [DocLiteralInInterceptor, SoapHeaderInterceptor]
  post-logical [WrapperClassInInterceptor]
  pre-invoke [SwAInInterceptor, HolderInInterceptor]


But even though it *appears* to be working as intended stepping through the
code, when DocLiteralInInterceptor fires later on it throws this
unmarshalling error (0x5 in this case is within the UniqueHash element I
thought I'd dropped):

org.apache.cxf.interceptor.Fault: Unmarshalling Error: Illegal character
entity: expansion character (code 0x5
 at [row,col {unknown-source}]: [1,2574]
 at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:881)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshall(JAXBEncoderDecoder.java:702)
 at org.apache.cxf.jaxb.io.DataReaderImpl.read(DataReaderImpl.java:160)
at
org.apache.cxf.interceptor.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:192)

Does anyone know what I'm doing wrong here? Any pointers on how I get rid
of this element and it's troublesome content?

BTW I'm using CXF v2.7.10 with Java 7.

Kind regards,
Mike

Reply via email to