Getting Error while returning SOAP response: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified

I am working on a SOAP based API which is configured using apache camel.

For one of the use cases in the, the SOAP API returns a very simple response which is an ‘SessionException’ object with 3 parameters i.e. code(long), message(string), reason(string).
Below is the response before being marshaled to xml format and returned from the API.

code=1,message=Unexpected Exception,reason=No session found in the session store for the input msisdn

Below is the schema file(xsd) for being used in my example project:

<xs:schema version="1.0" targetNamespace="http://crmwschannel.tibco.com/" xmlns:tns="http://crmwschannel.tibco.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="SessionException">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="code" type="xs:int"/>
                <xs:element name="message" type="xs:string" minOccurs="0"/>
                <xs:element name="reason" type="xs:string" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getActiveSessions">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="MSISDN" type="xs:string" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getActiveSessionsResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="ActiveSessions" type="tns:activeSession" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getSessionHistory">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="MSISDN" type="xs:string" minOccurs="0"/>
                <xs:element name="Date" type="xs:dateTime" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getSessionHistoryResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Sessions" type="tns:session" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getSessionHistoryRange">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="MSISDN" type="xs:string" minOccurs="0"/>
                <xs:element name="StartDate" type="xs:dateTime" minOccurs="0"/>
                <xs:element name="EndDate" type="xs:dateTime" minOccurs="0"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="getSessionHistoryRangeResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Sessions" type="tns:session" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="session">
        <xs:sequence>
            <xs:element name="id" type="xs:string" minOccurs="0"/>
            <xs:element name="startDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="endDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="consumedVolumePerBalance" type="tns:volume" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
            <xs:element name="remainingVolumePerBalance" type="tns:volume" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
            <xs:element name="rechargeHistory" type="tns:recharge" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
            <xs:element name="downgradedQualityOfServicePerBalance" type="tns:qualityOfService"
                        nillable="true" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="volume">
        <xs:sequence>
            <xs:element name="id" type="xs:string" minOccurs="0"/>
            <xs:element name="startDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="endDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="total" type="xs:long"/>
            <xs:element name="upload" type="xs:long"/>
            <xs:element name="download" type="xs:long"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="recharge">
        <xs:sequence>
            <xs:element name="id" type="xs:string" minOccurs="0"/>
            <xs:element name="activatedDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="expiredDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="qualityOfService" type="tns:qualityOfService" minOccurs="0"/>
            <xs:element name="volume" type="tns:volume" minOccurs="0"/>
            <xs:element name="grantedQualityOfService" type="tns:qualityOfService" minOccurs="0"/>
            <xs:element name="grantedVolume" type="tns:volume" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="qualityOfService">
        <xs:sequence>
            <xs:element name="id" type="xs:string" minOccurs="0"/>
            <xs:element name="uploadBandwidth" type="xs:long"/>
            <xs:element name="downloadBandwidth" type="xs:long"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="activeSession">
        <xs:sequence>
            <xs:element name="id" type="xs:string" minOccurs="0"/>
            <xs:element name="startDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="initialQualityOfService" type="tns:qualityOfService" minOccurs="0"/>
            <xs:element name="currentQualityOfService" type="tns:qualityOfService" minOccurs="0"/>
            <xs:element name="downgradedQualityOfServicePerBalance" type="tns:qualityOfService"
                        nillable="true" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="rechargeHistory" type="tns:recharge" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
            <xs:element name="initialVolumePerBalance" type="tns:volume" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
            <xs:element name="remainingVolumePerBalance" type="tns:volume" nillable="true" minOccurs="0"
                        maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

Below is the java code for my apache camel route ‘GetActiveSessions’ in which the response body is being set in the method ‘processGetSessionRecordResponse’ and it is marshaled using jaxB before being returned.

package com.openet.orchestration.provisioning.route.soap;

import com.openet.modules.udsf.api.model.RecordMeta;
import com.openet.orchestration.customorchestrationgateway.router.processor.SBARouterContextInitProcessor;
import com.openet.orchestration.provisioning.common.JacksonConfig;
import com.openet.orchestration.provisioning.pojo.RecordSearchResult;
import com.openet.orchestration.provisioning.processor.NudsfDataRepositorySearchRecordEgressProcessor;
import com.openet.orchestration.provisioning.processor.NudsfDataRepositorySearchRecordIngressProcessor;
import com.openet.orchestration.provisioning.processor.NudsfResponseProcessor;
import com.openet.orchestration.provisioning.sba.router.AddSbaRouterData;
import com.tibco.crmwschannel.GetActiveSessions;
import com.tibco.crmwschannel.GetActiveSessionsResponse;
import com.tibco.crmwschannel.SessionException;
import lombok.extern.slf4j.Slf4j;
import org.apache.camel.Exchange;
import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jackson.JacksonDataFormat;
import org.apache.camel.converter.jaxb.JaxbDataFormat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.openet.orchestration.provisioning.util.RouterConstants.DIRECT_SBA_ROUTER;
import static org.apache.camel.LoggingLevel.DEBUG;


@Component
@Slf4j
public class GetActiveSessionsRoute extends RouteBuilder {
    @Autowired
    private AddSbaRouterData addSbaRouterDataNudsfDataRepository;
    @Autowired
    private NudsfDataRepositorySearchRecordIngressProcessor nudsfDataRepositorySearchRecordIngressProcessor;
    @Autowired
    private NudsfDataRepositorySearchRecordEgressProcessor nudsfDataRepositorySearchRecordEgressProcessor;
    @Autowired
    private NudsfResponseProcessor nudsfResponseProcessor;
    @Autowired
    private JacksonConfig jacksonConfig;
    @Override
    public void configure() throws Exception {

        JacksonDataFormat jackSubsResponse = new JacksonDataFormat(jacksonConfig.jsonObjectMapper(), RecordSearchResult.class);
        JacksonDataFormat getSessionsResponse=new JacksonDataFormat(jacksonConfig.jsonObjectMapper(),RecordMeta.class);
        JaxbDataFormat jaxbReq = new JaxbDataFormat(GetActiveSessions.class.getPackage().getName());
        jaxbReq.setSchema("classpath:wsdl/PolicyCRMImplService_schema1.xsd");
        JaxbDataFormat jaxbRes = new JaxbDataFormat(GetActiveSessionsResponse.class.getPackage().getName());
        jaxbRes.setSchema("classpath:wsdl/PolicyCRMImplService_schema1.xsd");
        JaxbDataFormat jaxbExc = new JaxbDataFormat(SessionException.class.getPackage().getName());
        jaxbExc.setSchema("classpath:wsdl/PolicyCRMImplService_schema1.xsd");


        from("spring-ws:rootqname:{http://crmwschannel.tibco.com/}getActiveSessions?endpointMapping=#bean:endpointMapping")
                .log(LoggingLevel.INFO, "STARTING ROUTE {}", GetActiveSessionsRoute.class.getSimpleName())
                .unmarshal(jaxbReq)
                .doTry()
                    .process(nudsfDataRepositorySearchRecordIngressProcessor)
                    .process(new SBARouterContextInitProcessor())
                    .process(addSbaRouterDataNudsfDataRepository)
                    .log(DEBUG, "sending to SBA router")
                    .to(DIRECT_SBA_ROUTER)
                    .choice()
                        .when(simple("${header.CamelHttpResponseCode} == 204"))
                            .log("Error in GetActive sessions route due to no session being present in the udsf")
                            .bean(NudsfResponseProcessor.class,"handleGetActiveSessionException")
                            .marshal(jaxbExc)
                            .stop()
                        .endChoice()
                        .when(simple("${header.CamelHttpResponseCode} != 204"))
                            .log("inside when != 204")
                            .unmarshal(jackSubsResponse)
                            .process(x -> jackSubsResponse.close())
                            .process(nudsfDataRepositorySearchRecordEgressProcessor)
                            .loop(exchangeProperty(Exchange.LOOP_SIZE))
                                .process(nudsfResponseProcessor)
                                .to(DIRECT_SBA_ROUTER)
                                .unmarshal(getSessionsResponse)
                                .process(x -> getSessionsResponse.close())
                                .bean(NudsfResponseProcessor.class,"processGetSessionRecordResponse")
                            .end()
                            .bean(NudsfResponseProcessor.class,"constructGetActiveSessionHistoryFinalResponse")
                            .marshal(jaxbRes)
                        .endChoice()
                    .end()
                .endDoTry()
                .doCatch(Exception.class)
                    .log("exception in getActiveSessions route")
                    .marshal(jaxbExc)
                .end();
    }
}

Below is implementation of method “handleGetActiveSessionException” :

public void handleGetActiveSessionException(Exchange exchange){
        SessionException sessionException=new SessionException();
        sessionException.setCode(1L);
        sessionException.setMessage("Unexpected Exception");
        sessionException.setReason("No session found in the session store for the input msisdn");
        exchange.getIn().setBody(sessionException);
        log.debug("session exception response: {}", ReflectionToStringBuilder.toString(sessionException));
        exchange.getIn().setHeader(Exchange.HTTP_RESPONSE_CODE,500);
    }

Below is the SOAP Request being sent:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:crm="http://crmwschannel.tibco.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <crm:getActiveSessions>
         <MSISDN>98243311655600</MSISDN>
      </crm:getActiveSessions>
   </soapenv:Body>
</soapenv:Envelope>

Below are more error logs after consuming the ‘getActiveSessions’ SOAP API:

2024-07-13T07:21:20,356 [http-nio-8080-exec-7] TRACE org.apache.camel.converter.jaxb.FallbackTypeConverter – – – Marshal from value com.tibco.crmwschannel.SessionException@45f92bf1 to type interface javax.xml.transform.Source
2024-07-13T07:21:20,356 [http-nio-8080-exec-7] DEBUG jakarta.xml.bind – – – Checking system property jakarta.xml.bind.JAXBContextFactory
2024-07-13T07:21:20,356 [http-nio-8080-exec-7] DEBUG jakarta.xml.bind – – – not found
2024-07-13T07:21:20,357 [http-nio-8080-exec-7] DEBUG jakarta.xml.bind – – – ServiceProvider loading Facility used; returning object [org.glassfish.jaxb.runtime.v2.JAXBContextFactory]
2024-07-13T07:21:20,357 [http-nio-8080-exec-7] DEBUG jakarta.xml.bind – – – Using jakarta.xml.bind-api on the class path.
2024-07-13T07:21:20,357 [http-nio-8080-exec-7] DEBUG org.glassfish.jaxb.runtime.v2.ContextFactory – – – Property org.glassfish.jaxb.XmlAccessorFactoryis not active. Using JAXB’s implementation
2024-07-13T07:21:20,367 [http-nio-8080-exec-7] DEBUG org.springframework.ws.soap.server.endpoint.SoapFaultAnnotationExceptionResolver – – – Resolving exception from endpoint [Consumer[spring-ws://rootqname:%7Bhttp://crmwschannel.tibco.com/%7DgetActiveSessions?endpointMapping=%23bean%3AendpointMapping]]: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
2024-07-13T07:21:20,368 [http-nio-8080-exec-7] DEBUG org.springframework.ws.soap.server.endpoint.SimpleSoapExceptionResolver – – – Resolving exception from endpoint [Consumer[spring-ws://rootqname:%7Bhttp://crmwschannel.tibco.com/%7DgetActiveSessions?endpointMapping=%23bean%3AendpointMapping]]: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
2024-07-13T07:21:20,378 [http-nio-8080-exec-7] DEBUG org.springframework.ws.soap.server.SoapMessageDispatcher – – – Endpoint invocation resulted in exception – responding with Fault
org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.
at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.createAttribute(CoreDocumentImpl.java:573) ~[?:?]
at com.sun.org.apache.xerces.internal.dom.ElementImpl.setAttribute(ElementImpl.java:503) ~[?:?]
at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.setAttribute(ElementImpl.java:87) ~[saaj-impl-3.0.2.jar!/:3.0.2]
at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.addAttributeBare(ElementImpl.java:749) ~[saaj-impl-3.0.2.jar!/:3.0.2]
at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.addAttributeBare(ElementImpl.java:730) ~[saaj-impl-3.0.2.jar!/:3.0.2]
at com.sun.xml.messaging.saaj.soap.impl.ElementImpl.addAttribute(ElementImpl.java:715) ~[saaj-impl-3.0.2.jar!/:3.0.2]
at org.springframework.ws.soap.saaj.SaajSoapElement.addAttribute(SaajSoapElement.java:59) ~[spring-ws-core-4.0.6.jar!/:?]
at org.apache.camel.component.spring.ws.filter.impl.BasicMessageFilter.doProcessSoapHeader(BasicMessageFilter.java:124) ~[camel-spring-ws-4.2.0.jar!/:4.2.0]
at org.apache.camel.component.spring.ws.filter.impl.BasicMessageFilter.processSoapHeader(BasicMessageFilter.java:81) ~[camel-spring-ws-4.2.0.jar!/:4.2.0]
at org.apache.camel.component.spring.ws.filter.impl.BasicMessageFilter.processHeaderAndAttachments(BasicMessageFilter.java:69) ~[camel-spring-ws-4.2.0.jar!/:4.2.0]
at org.apache.camel.component.spring.ws.filter.impl.BasicMessageFilter.filterConsumer(BasicMessageFilter.java:58) ~[camel-spring-ws-4.2.0.jar!/:4.2.0]
at org.apache.camel.component.spring.ws.SpringWebserviceConsumer.invoke(SpringWebserviceConsumer.java:82) ~[camel-spring-ws-4.2.0.jar!/:4.2.0]
at org.springframework.ws.server.endpoint.adapter.MessageEndpointAdapter.invoke(MessageEndpointAdapter.java:43) ~[spring-ws-core-4.0.6.jar!/:?]
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:230) [spring-ws-core-4.0.6.jar!/:?]
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:174) [spring-ws-core-4.0.6.jar!/:?]
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:88) [spring-ws-core-4.0.6.jar!/:?]
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:60) [spring-ws-core-4.0.6.jar!/:?]
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:288) [spring-ws-core-4.0.6.jar!/:?]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at com.openet.orchestration.provisioning.route.soap.WebServiceConfig$WSDLQuestionMarkReplaceFilter.doFilter(WebServiceConfig.java:118) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:6.0.13]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:340) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:391) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:896) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1744) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [inwi-ussd-cog-service-1.0.0-SNAPSHOT.jar:1.0.0-SNAPSHOT]
at java.lang.Thread.run(Thread.java:840) [?:?]
2024-07-13T07:21:20,380 [http-nio-8080-exec-7] DEBUG com.openet.orchestration.provisioning.route.soap.SoapEndpointResponseInterceptor – – – In Soap Endpoint Response Interceptor handle fault
2024-07-13T07:21:20,381 [http-nio-8080-exec-7] DEBUG com.openet.orchestration.provisioning.route.soap.SoapEndpointResponseInterceptor – – – In change soap envelope fault:com.sun.xml.messaging.saaj.soap.ver1_1.Fault1_1Impl@336ecc8b
2024-07-13T07:21:20,411 [http-nio-8080-exec-7] DEBUG org.springframework.ws.soap.server.endpoint.interceptor.SoapEnvelopeLoggingInterceptor – – – Fault: <SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”>SOAP-ENV:BodySOAP-ENV:FaultSOAP-ENV:ServerINVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
2024-07-13T07:21:20,417 [http-nio-8080-exec-7] DEBUG com.sun.xml.messaging.saaj.soap.impl – – – SAAJ0190: Omit XML declaration set to yes
2024-07-13T07:21:20,418 [http-nio-8080-exec-7] DEBUG com.sun.xml.messaging.saaj.soap.impl – – – SAAJ0191: Encoding is set to utf-8
2024-07-13T07:21:20,418 [http-nio-8080-exec-7] TRACE org.springframework.ws.server.MessageTracing.sent – – – Sent response [<SOAP-ENV:Envelope xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/”>SOAP-ENV:BodySOAP-ENV:FaultSOAP-ENV:ServerINVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.</SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>] for request [<soapenv:Envelope xmlns:crm=”http://crmwschannel.tibco.com/” xmlns:soapenv=”http://schemas.xmlsoap.org/soap/envelope/”>
soapenv:Header/
soapenv:Body
crm:getActiveSessions

98243311655600
</crm:getActiveSessions>
</soapenv:Body>
</soapenv:Envelope>]
2024-07-13T07:21:20,426 [http-nio-8080-exec-7] DEBUG com.sun.xml.messaging.saaj.soap.impl – – – SAAJ0190: Omit XML declaration set to yes
2024-07-13T07:21:20,426 [http-nio-8080-exec-7] DEBUG com.sun.xml.messaging.saaj.soap.impl – – – SAAJ0191: Encoding is set to utf-8
2024-07-13T07:21:20,428 [http-nio-8080-exec-7] DEBUG org.springframework.ws.transport.http.MessageDispatcherServlet – – – Completed 500 INTERNAL_SERVER_ERROR, headers={masked}

I am using the axb2-maven-plugin maven plugin to generate the sources or java classes from the schema(xsd) file.

Below is the generated ‘SessionException’ class:

//
// This file was generated by the Eclipse Implementation of JAXB, v3.0.0 
// See https://eclipse-ee4j.github.io/jaxb-ri 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2024.07.13 at 08:34:48 AM IST 
//


package com.openet.provisioning;

import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;


/**
 * <p>Java class for anonymous complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="code" type="{http://www.w3.org/2001/XMLSchema}int"/>
 *         <element name="message" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "code",
    "message",
    "reason"
})
@XmlRootElement(name = "SessionException")
public class SessionException {

    protected int code;
    protected String message;
    protected String reason;

    /**
     * Gets the value of the code property.
     * 
     */
    public int getCode() {
        return code;
    }

    /**
     * Sets the value of the code property.
     * 
     */
    public void setCode(int value) {
        this.code = value;
    }

    /**
     * Gets the value of the message property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getMessage() {
        return message;
    }

    /**
     * Sets the value of the message property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setMessage(String value) {
        this.message = value;
    }

    /**
     * Gets the value of the reason property.
     * 
     * @return
     *     possible object is
     *     {@link String }
     *     
     */
    public String getReason() {
        return reason;
    }

    /**
     * Sets the value of the reason property.
     * 
     * @param value
     *     allowed object is
     *     {@link String }
     *     
     */
    public void setReason(String value) {
        this.reason = value;
    }

}

I am able to unmarshal the request with the same schema and also marshal responses like getSessionHistoryResponse without any xml validation error and return from the SOAP API successfully.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật