views:

37

answers:

0

Hi, is there a way to modify SoapBody message using Apache CXF ? I have tried to use Interceptors feature with Phase.SEND mode to try to add an xml schema with a result in SoapBody. I did not have any luck.

The issue was that I want to validate the result message with xml schema. The current output of the SoapBody sent a result message with the xml schema that used the reference of the schema location which was not available at target location.

In order to validate the result response message, I added "schema-validation-enabled" as true into ResponseContext in BindingProvider; however, I am not sure whether it works or not.

I was try to add/attache original schema instead of using its reference with response message for SoapBody. Is there any way to use annotation or any other methods to use the given xml schema for validation ?

Any idea, and response are appreciated.

<?xml version="1.0" encoding="utf-8"?>
    <xs:schema id="resultSet" targetNamespace="http://www.xxx.com/" xmlns:mstns="http://www.xxx.com/" xmlns="http://www.xxx.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:app1="http://www.xxx.com/ResultSet.xsd"&gt;
      <xs:import namespace="http://www.xxx.com/ResultSet.xsd" schemaLocation="RalsDeviceService_app1.xsd" />
      <xs:element name="resultSet" msdata:IsDataSet="true" msdata:Locale="en-US">
        <xs:complexType>
          <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element ref="app1:ResultSet" />
          </xs:choice>
        </xs:complexType>
      </xs:element>
    </xs:schema>
    <resultSet xmlns="http://www.xxx.com/"&gt;
      <ns2:ResultSet xmlns:ns2="http://www.xxx.com/ResultSet.xsd"&gt;
        <ns2:Results>
         ...
         ..
         .
    </resultSet>