public InNamespaceMergeInterceptor() { super(Phase.UNMARSHAL); addAfter(DocLiteralInInterceptor.class.getName()); }
@Override public void handleMessage(Message message) throws Fault { if (isGET(message)) { return; } StringPayloadHolder payloadHolder = message.getContent(StringPayloadHolder.class); if (payloadHolder != null) { String payload = payloadHolder.get(SOAP_BODY); if (isXmlContent(payload)) { Document document = (Document) message.getContent(Node.class); if (document != null) { // The Node representation of the message is usually produced // by CXF's ReadHeadersInterceptor, but this does not happen when the message // does not contain SOAP headers (i.e. when the request is invalid, because // it does not fulfill the IHE requirement of using WS-Addressing). // Let us hope that in this unhappy case all relevant XML namespaces // are defined directly in the SOAP body and not in the SOAP envelope. payloadHolder.put(SOAP_BODY, enrichNamespaces(document, payload)); } } } }
@Override protected void configureInterceptors(ServerFactoryBean svrFactory) { svrFactory.getInInterceptors().add(new InPayloadExtractorInterceptor(SOAP_BODY)); svrFactory.getInInterceptors().add(new InNamespaceMergeInterceptor()); svrFactory.getInInterceptors().add(new InPayloadInjectorInterceptor(0)); svrFactory.setDataBinding(new PlainXmlDataBinding()); super.configureInterceptors(svrFactory); } }
addNamespacesFromElement(envelope, namespaces); addNamespacesFromElement(body, namespaces);
@Override protected void configureInterceptors(ServerFactoryBean svrFactory) { super.configureInterceptors(svrFactory); svrFactory.getInInterceptors().add(new InPayloadExtractorInterceptor(SOAP_BODY)); svrFactory.getInInterceptors().add(new InNamespaceMergeInterceptor()); svrFactory.getInInterceptors().add(new InPayloadInjectorInterceptor(0)); svrFactory.setDataBinding(new PlainXmlDataBinding()); }
@Override protected void configureInterceptors(Client client) { super.configureInterceptors(client); client.getInInterceptors().add(new InPayloadExtractorInterceptor(SOAP_BODY)); client.getInInterceptors().add(new InNamespaceMergeInterceptor()); client.getInInterceptors().add(new InPayloadInjectorInterceptor(0)); client.getEndpoint().getService().setDataBinding(new PlainXmlDataBinding()); } }