{"id":142357,"date":"2026-03-30T19:31:34","date_gmt":"2026-03-30T16:31:34","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=142357"},"modified":"2026-03-30T19:31:37","modified_gmt":"2026-03-30T16:31:37","slug":"get-raw-xml-from-soap-in-java","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html","title":{"rendered":"Get Raw XML from SOAP in Java"},"content":{"rendered":"<p>SOAP (Simple Object Access Protocol) is widely used in enterprise applications for communication between services. While working with SOAP-based systems in Java, developers often need access to the raw XML of a SOAP message for logging, debugging, auditing, or transformation purposes. Let us delve into understanding how to extract a SOAP message&#8217;s raw XML for effective debugging and monitoring in Java applications.<\/p>\n<h2><a name=\"section-1\"><\/a>1. SOAP Fundamentals<\/h2>\n<p><a href=\"https:\/\/www.w3.org\/TR\/soap\/\" target=\"_blank\" rel=\"noopener\">SOAP (Simple Object Access Protocol)<\/a> is a protocol used for exchanging structured information between applications over a network. It relies on XML as its message format and typically uses HTTP or HTTPS as the transport protocol. SOAP is widely used in enterprise systems because of its extensibility, strict standards, and built-in error handling mechanisms. A SOAP message is a well-defined XML document that follows a specific structure. Understanding this structure is crucial when working with raw SOAP messages, especially for debugging, logging, or implementing custom handlers.<\/p>\n<h3>1.1 Understanding Raw XML in SOAP<\/h3>\n<p>Raw XML refers to the complete SOAP message in its original, unprocessed XML format as it is sent over the network. It represents the exact payload exchanged between the client and the server without any abstraction or transformation by frameworks such as JAX-WS or Spring WS. Accessing raw XML is particularly useful in the following scenarios:<\/p>\n<ul>\n<li>Debugging request\/response issues<\/li>\n<li>Logging complete SOAP messages for auditing<\/li>\n<li>Validating message structure against XSD schemas<\/li>\n<li>Interoperability testing with external systems<\/li>\n<\/ul>\n<p>A raw SOAP message consists of the following core components:<\/p>\n<ul>\n<li>Envelope \u2013 The root element that defines the XML document as a SOAP message. It contains all other elements and specifies the namespace.<\/li>\n<li>Header (optional) \u2013 Contains metadata such as authentication credentials, transaction IDs, security tokens, or routing information. This element is optional but commonly used in enterprise applications.<\/li>\n<li>Body \u2013 The main part of the message that contains the actual request or response data. This is where the business payload resides.<\/li>\n<\/ul>\n<p>Below is an example of a raw SOAP XML request:<\/p>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;soapenv:Envelope xmlns:soapenv=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\" \n                  xmlns:ns=\"http:\/\/example.com\/user\"&gt;\n\n   &lt;soapenv:Header&gt;\n      &lt;ns:AuthToken&gt;abc123&lt;\/ns:AuthToken&gt;\n   &lt;\/soapenv:Header&gt;\n\n   &lt;soapenv:Body&gt;\n      &lt;ns:getUser&gt;\n         &lt;ns:id&gt;101&lt;\/ns:id&gt;\n      &lt;\/ns:getUser&gt;\n   &lt;\/soapenv:Body&gt;\n\n&lt;\/soapenv:Envelope&gt;\n<\/pre>\n<p>In this example, the <code>Envelope<\/code> defines the SOAP message boundaries, the <code>Header<\/code> carries an authentication token, and the <code>Body<\/code> contains the actual operation (<code>getUser<\/code>) along with its input parameter.<\/p>\n<p>When we talk about &#8220;getting raw XML&#8221; in Java, we essentially mean accessing this complete SOAP message as a string or stream before it is parsed into Java objects (or after it is generated but before being sent over the network).<\/p>\n<h2><a name=\"section-2\"><\/a>2. Extracting Raw XML Using SAAJ (SOAPMessage)<\/h2>\n<p>SAAJ (SOAP with Attachments API for Java) provides low-level control over SOAP messages.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ SaajExample.java\nimport javax.xml.soap.*;\nimport java.io.ByteArrayOutputStream;\n\npublic class SaajExample {\n\n    public static void main(String[] args) throws Exception {\n        MessageFactory factory = MessageFactory.newInstance();\n        SOAPMessage message = factory.createMessage();\n\n        SOAPBody body = message.getSOAPBody();\n        body.addBodyElement(\n            message.getSOAPPart().getEnvelope().createName(\"test\", \"ns\", \"http:\/\/example.com\")\n        ).addTextNode(\"Hello World\");\n\n        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n        message.writeTo(outputStream);\n\n        String rawXml = new String(outputStream.toByteArray());\n        System.out.println(rawXml);\n    }\n}\n<\/pre>\n<h3>2.1 Code Explanation<\/h3>\n<p>This code demonstrates how to create and extract raw SOAP XML using the SAAJ API in Java. It starts by creating a <code>MessageFactory<\/code> instance to generate a new <code>SOAPMessage<\/code>. Then, it retrieves the <code>SOAPBody<\/code> from the message and adds a new body element named <code>test<\/code> with a namespace <code>http:\/\/example.com<\/code>, inserting the text value &#8220;Hello World&#8221; into it. After constructing the SOAP message, a <code>ByteArrayOutputStream<\/code> is used to capture the entire SOAP message in its raw XML format by calling <code>message.writeTo(outputStream)<\/code>. Finally, the byte stream is converted into a string representing the complete raw SOAP XML, which is printed to the console.<\/p>\n<h3>2.2 Code Output<\/h3>\n<pre class=\"brush:xml; wrap-lines:false;\">&lt;SOAP-ENV:Envelope&gt;\n  &lt;SOAP-ENV:Body&gt;\n    &lt;ns:test&gt;Hello World&lt;\/ns:test&gt;\n  &lt;\/SOAP-ENV:Body&gt;\n&lt;\/SOAP-ENV:Envelope&gt;\n<\/pre>\n<p>The output represents the raw SOAP XML message generated by the SAAJ API. The <code>SOAP-ENV:Envelope<\/code> is the root element that wraps the entire SOAP message and defines it as a valid SOAP structure. Inside it, the <code>SOAP-ENV:Body<\/code> contains the actual payload of the message. Within the body, the custom element <code>ns:test<\/code> is present, which was programmatically added in the code using a namespace and assigned the value &#8220;Hello World&#8221;. The absence of a <code>Header<\/code> element indicates that no additional metadata (such as authentication or transaction details) was included in this message. Overall, this output shows a minimal SOAP request structure with a single operation and its corresponding data.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2><a name=\"section-3\"><\/a>3. Capturing SOAP Messages with JAX-WS Handlers<\/h2>\n<p>JAX-WS allows interception of SOAP messages using handlers.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ LoggingSOAPHandler.java\nimport javax.xml.namespace.QName;\nimport javax.xml.ws.handler.soap.*;\nimport javax.xml.ws.handler.MessageContext;\nimport javax.xml.soap.SOAPMessage;\nimport java.io.ByteArrayOutputStream;\nimport java.util.Set;\n\npublic class LoggingSOAPHandler implements SOAPHandler&lt;SOAPMessageContext&gt; {\n\n    @Override\n    public boolean handleMessage(SOAPMessageContext context) {\n        try {\n            SOAPMessage message = context.getMessage();\n            ByteArrayOutputStream out = new ByteArrayOutputStream();\n            message.writeTo(out);\n\n            String rawXml = new String(out.toByteArray());\n            System.out.println(\"SOAP Message:\\n\" + rawXml);\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n        return true;\n    }\n\n    @Override\n    public Set&lt;QName&gt; getHeaders() {\n        return null;\n    }\n\n    @Override\n    public boolean handleFault(SOAPMessageContext context) {\n        return true;\n    }\n\n    @Override\n    public void close(MessageContext context) {}\n}\n<\/pre>\n<h3>3.1 Code Explanation<\/h3>\n<p>This code defines a custom SOAP handler named <code>LoggingSOAPHandler<\/code> that implements the <code>SOAPHandler&lt;SOAPMessageContext&gt;<\/code> interface to intercept and log SOAP messages in their raw XML form. Inside the <code>handleMessage<\/code> method, the current <code>SOAPMessage<\/code> is retrieved from the <code>SOAPMessageContext<\/code>, and a <code>ByteArrayOutputStream<\/code> is used to capture the entire SOAP message by invoking <code>message.writeTo()<\/code>. The resulting byte stream is then converted into a string to obtain the raw XML, which is printed to the console for logging or debugging purposes. The method returns <code>true<\/code> to allow further processing in the handler chain. The <code>getHeaders<\/code> method returns <code>null<\/code>, indicating that this handler does not process specific SOAP headers, while <code>handleFault<\/code> simply returns <code>true<\/code> to continue fault processing if an error occurs. The <code>close<\/code> method is left empty as no resource cleanup is required. Overall, this handler is useful for inspecting inbound and outbound SOAP messages in JAX-WS-based applications.<\/p>\n<h3>3.2 Code Output<\/h3>\n<pre class=\"brush:xml; wrap-lines:false;\">SOAP Message:\n&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\n   &lt;SOAP-ENV:Header\/&gt;\n   &lt;SOAP-ENV:Body&gt;\n      &lt;ns:getUser xmlns:ns=\"http:\/\/example.com\"&gt;\n         &lt;ns:id&gt;101&lt;\/ns:id&gt;\n      &lt;\/ns:getUser&gt;\n   &lt;\/SOAP-ENV:Body&gt;\n&lt;\/SOAP-ENV:Envelope&gt;\n<\/pre>\n<p>The output shows the complete raw SOAP XML message intercepted by the <code>LoggingSOAPHandler<\/code>. The line <code>\"SOAP Message:\"<\/code> is printed first, followed by the full SOAP envelope captured from the message context. The <code>Envelope<\/code> element wraps the entire message and defines the SOAP namespace, while the <code>Header<\/code> is present but empty, indicating that no additional metadata was included. The <code>Body<\/code> contains the actual business request, in this case the <code>getUser<\/code> operation with an input parameter <code>id<\/code> set to <code>101<\/code>. This output confirms that the handler successfully intercepted the SOAP message and converted it into raw XML format using <code>writeTo()<\/code>, making it useful for debugging, logging, or monitoring SOAP requests and responses in real-time.<\/p>\n<h2><a name=\"section-4\"><\/a>4. Intercepting SOAP Messages with Apache CXF<\/h2>\n<p>Apache CXF provides interceptors to access raw SOAP messages.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ CXFLoggingInterceptor.java\nimport org.apache.cxf.interceptor.AbstractPhaseInterceptor;\nimport org.apache.cxf.phase.Phase;\nimport org.apache.cxf.message.Message;\n\nimport java.io.InputStream;\nimport java.io.ByteArrayOutputStream;\n\npublic class CXFLoggingInterceptor extends AbstractPhaseInterceptor&lt;Message&gt; {\n\n    public CXFLoggingInterceptor() {\n        super(Phase.RECEIVE);\n    }\n\n    @Override\n    public void handleMessage(Message message) {\n        try {\n            InputStream is = message.getContent(InputStream.class);\n            ByteArrayOutputStream buffer = new ByteArrayOutputStream();\n\n            int nRead;\n            byte[] data = new byte[1024];\n\n            while ((nRead = is.read(data, 0, data.length)) != -1) {\n                buffer.write(data, 0, nRead);\n            }\n\n            String rawXml = buffer.toString(\"UTF-8\");\n            System.out.println(\"Raw SOAP XML:\\n\" + rawXml);\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n    }\n}\n<\/pre>\n<h3>4.1 Code Explanation<\/h3>\n<p>This code defines a custom Apache CXF interceptor named <code>CXFLoggingInterceptor<\/code> that extends <code>AbstractPhaseInterceptor&lt;Message&gt;<\/code> to intercept SOAP messages at a specific phase in the CXF processing pipeline. In the constructor, the interceptor is registered for the <code>Phase.RECEIVE<\/code>, meaning it will execute when an incoming SOAP request is received. Inside the <code>handleMessage<\/code> method, the raw message content is accessed as an <code>InputStream<\/code> using <code>message.getContent(InputStream.class)<\/code>. The stream is then read in chunks using a byte buffer and written into a <code>ByteArrayOutputStream<\/code> to reconstruct the full message. After reading the entire stream, it is converted into a UTF-8 encoded string representing the raw SOAP XML, which is printed to the console. This interceptor is particularly useful for logging, debugging, or auditing incoming SOAP requests in Apache CXF-based applications by allowing developers to inspect the exact XML payload being processed.<\/p>\n<h3>4.2 Code Output<\/h3>\n<pre class=\"brush:xml; wrap-lines:false;\">Raw SOAP XML:\n&lt;soap:Envelope xmlns:soap=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\n   &lt;soap:Header\/&gt;\n   &lt;soap:Body&gt;\n      &lt;ns:getUser xmlns:ns=\"http:\/\/example.com\"&gt;\n         &lt;ns:id&gt;101&lt;\/ns:id&gt;\n      &lt;\/ns:getUser&gt;\n   &lt;\/soap:Body&gt;\n&lt;\/soap:Envelope&gt;\n<\/pre>\n<p>The output displays the complete raw SOAP XML message intercepted by the <code>CXFLoggingInterceptor<\/code> during the <code>RECEIVE<\/code> phase. The prefix <code>\"Raw SOAP XML:\"<\/code> is printed first, followed by the full SOAP message captured from the input stream. The <code>Envelope<\/code> element defines the SOAP structure and namespace, enclosing both the <code>Header<\/code> and <code>Body<\/code>. The <code>Header<\/code> is empty, indicating no additional metadata was included, while the <code>Body<\/code> contains the actual request payload, in this case the <code>getUser<\/code> operation with an <code>id<\/code> value of <code>101<\/code>. This output confirms that the interceptor successfully read the incoming message stream, reconstructed it into a string, and logged the exact SOAP XML being received by the application, which is highly useful for debugging and monitoring purposes.<\/p>\n<h2><a name=\"section-5\"><\/a>5. Handling SOAP Messages in Spring Web Services<\/h2>\n<p>Spring Web Services provides built-in interceptors for handling SOAP messages.<\/p>\n<pre class=\"brush:java; wrap-lines:false;\">\/\/ SpringSoapInterceptor.java\nimport org.springframework.ws.context.MessageContext;\nimport org.springframework.ws.server.EndpointInterceptor;\nimport org.springframework.ws.soap.SoapMessage;\n\nimport java.io.ByteArrayOutputStream;\n\npublic class SpringSoapInterceptor implements EndpointInterceptor {\n\n    @Override\n    public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception {\n        SoapMessage soapMessage = (SoapMessage) messageContext.getRequest();\n\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        soapMessage.writeTo(out);\n\n        String rawXml = new String(out.toByteArray());\n        System.out.println(\"Request XML:\\n\" + rawXml);\n\n        return true;\n    }\n\n    @Override\n    public boolean handleResponse(MessageContext messageContext, Object endpoint) {\n        return true;\n    }\n\n    @Override\n    public boolean handleFault(MessageContext messageContext, Object endpoint) {\n        return true;\n    }\n\n    @Override\n    public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex) {}\n}\n<\/pre>\n<h3>5.1 Code Explanation<\/h3>\n<p>This code defines a custom Spring Web Services interceptor named <code>SpringSoapInterceptor<\/code> that implements the <code>EndpointInterceptor<\/code> interface to intercept and log SOAP request messages. In the <code>handleRequest<\/code> method, the incoming request is retrieved from the <code>MessageContext<\/code> and cast to a <code>SoapMessage<\/code>, allowing direct access to the SOAP payload. A <code>ByteArrayOutputStream<\/code> is then used to capture the full SOAP message by invoking <code>soapMessage.writeTo()<\/code>, which writes the complete XML (including envelope, header, and body) into the stream. This byte data is converted into a string to obtain the raw XML representation, which is printed to the console with the label &#8220;Request XML&#8221;. The method returns <code>true<\/code> to allow the request to proceed further in the processing chain. The <code>handleResponse<\/code> and <code>handleFault<\/code> methods simply return <code>true<\/code>, indicating no additional processing for responses or faults, while <code>afterCompletion<\/code> is left empty as no cleanup is required. This interceptor is useful for logging and debugging SOAP requests in Spring WS applications by exposing the exact XML being received.<\/p>\n<h3>5.2 Code Output<\/h3>\n<pre class=\"brush:xml; wrap-lines:false;\">Request XML:\n&lt;soapenv:Envelope xmlns:soapenv=\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\"&gt;\n   &lt;soapenv:Header\/&gt;\n   &lt;soapenv:Body&gt;\n      &lt;ns:getUser xmlns:ns=\"http:\/\/example.com\"&gt;\n         &lt;ns:id&gt;101&lt;\/ns:id&gt;\n      &lt;\/ns:getUser&gt;\n   &lt;\/soapenv:Body&gt;\n&lt;\/soapenv:Envelope&gt;\n<\/pre>\n<p>The output shows the raw SOAP request XML intercepted by the <code>SpringSoapInterceptor<\/code> during request processing. The label <code>\"Request XML:\"<\/code> is printed first, followed by the complete SOAP message captured from the incoming request. The <code>Envelope<\/code> element defines the SOAP structure and namespace, enclosing both the <code>Header<\/code> and <code>Body<\/code>. The <code>Header<\/code> is empty, indicating no additional metadata is present, while the <code>Body<\/code> contains the actual request payload, specifically the <code>getUser<\/code> operation with an <code>id<\/code> value of <code>101<\/code>. This output confirms that the interceptor successfully captured and logged the full SOAP message as raw XML, which is helpful for debugging, auditing, and monitoring incoming requests in Spring Web Services applications.<\/p>\n<h2><a name=\"section-6\"><\/a>6. Conclusion<\/h2>\n<p>Extracting raw XML from SOAP messages in Java is essential for debugging and monitoring, and depending on your stack, you can use SAAJ for low-level control, JAX-WS handlers for standard SOAP services, Apache CXF interceptors for enterprise setups, and Spring WS interceptors for Spring-based applications; choosing the right approach ultimately depends on your application architecture and performance requirements.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SOAP (Simple Object Access Protocol) is widely used in enterprise applications for communication between services. While working with SOAP-based systems in Java, developers often need access to the raw XML of a SOAP message for logging, debugging, auditing, or transformation purposes. Let us delve into understanding how to extract a SOAP message&#8217;s raw XML for &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[1200,604,107],"class_list":["post-142357","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-java","tag-soap","tag-xml"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get Raw XML from SOAP in Java - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get Raw XML from SOAP in Java - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2026-03-30T16:31:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-30T16:31:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Get Raw XML from SOAP in Java\",\"datePublished\":\"2026-03-30T16:31:34+00:00\",\"dateModified\":\"2026-03-30T16:31:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html\"},\"wordCount\":1445,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Java\",\"SOAP\",\"XML\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html\",\"name\":\"Get Raw XML from SOAP in Java - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2026-03-30T16:31:34+00:00\",\"dateModified\":\"2026-03-30T16:31:37+00:00\",\"description\":\"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/get-raw-xml-from-soap-in-java.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Get Raw XML from SOAP in Java\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Get Raw XML from SOAP in Java - Java Code Geeks","description":"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html","og_locale":"en_US","og_type":"article","og_title":"Get Raw XML from SOAP in Java - Java Code Geeks","og_description":"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.","og_url":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2026-03-30T16:31:34+00:00","article_modified_time":"2026-03-30T16:31:37+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Get Raw XML from SOAP in Java","datePublished":"2026-03-30T16:31:34+00:00","dateModified":"2026-03-30T16:31:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html"},"wordCount":1445,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Java","SOAP","XML"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html","url":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html","name":"Get Raw XML from SOAP in Java - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2026-03-30T16:31:34+00:00","dateModified":"2026-03-30T16:31:37+00:00","description":"Java soap message raw xml: Access Java SOAP message raw XML for debugging, logging, and monitoring SOAP requests easily.","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/get-raw-xml-from-soap-in-java.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Get Raw XML from SOAP in Java"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=142357"}],"version-history":[{"count":1,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142357\/revisions"}],"predecessor-version":[{"id":142519,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/142357\/revisions\/142519"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=142357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=142357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=142357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}