Hi,
I am writing a client application running on JDK 21.
When it gets an error response containing a SOAP Fault XML string from the server, there are no issues if the XML string is in single-line format.
But when the XML string is in multi-line (pretty-print) format, there is an exception thrown.
An example of XML string causing the error is as follows.
<se:Envelope xmlns:ns="http://ns.ukmail.com/msg/header/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:man="http://ukmail.business-post.com/mailmark/manifest" xmlns:se="http://www.w3.org/2003/05/soap-envelope">
<se:Header>
<ns:ukmail>
<ns:Timestamp>2025-01-17T01:47:41.305Z</ns:Timestamp>
<ns:Application>Inter</ns:Application>
<ns:MessageType>item_manifest-1</ns:MessageType>
<ns:Version>1.0</ns:Version>
<ns:MessageId>71fb4bb7-d284-4d81-b6af-53c5f07d4706</ns:MessageId>
</ns:ukmail>
</se:Header>
<se:Body>
<se:Fault>
<se:Code>
<se:Value>ERR007</se:Value>
</se:Code>
<se:Reason>
<se:Text xml:lang="">Data Integrity Error</se:Text>
</se:Reason>
<se:Role>http://ukmail.business-post.com/mailmark/manifest</se:Role>
<se:Detail>Item ID has already been used on a previous day</se:Detail>
</se:Fault>
</se:Body>
</se:Envelope>
And here is the exception stack trace.
Caused by: java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a 4 event
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:393)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:371)
at com.sun.xml.internal.ws.message.stream.StreamMessage.readPayloadAsJAXB(StreamMessage.java:313)
at com.sun.xml.internal.ws.api.message.MessageWrapper.readPayloadAsJAXB(MessageWrapper.java:171)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.create(SOAPFaultBuilder.java:540)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:237)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy37.itemManifest1(Unknown Source)
The related dependencies in the pom.xml file are as follows.
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>4.0.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.ws</groupId>
<artifactId>jakarta.xml.ws-api</artifactId>
<version>4.0.2</version>
</dependency>
Thank you for your help.
Hi,
I am writing a client application running on JDK 21.
When it gets an error response containing a SOAP Fault XML string from the server, there are no issues if the XML string is in single-line format.
But when the XML string is in multi-line (pretty-print) format, there is an exception thrown.
An example of XML string causing the error is as follows.
And here is the exception stack trace.
The related dependencies in the pom.xml file are as follows.
Thank you for your help.