![Javax.xml.parsers package examples](/java/xml/images/javaxml-mini-logo.jpg)
- Javax.xml.bind classes
- Home
- Binder
- DatatypeConverter
- JAXB
- JAXBContext
- JAXBElement
- JAXBElement.GlobalScope
- JAXBIntrospector
- Marshaller.Listener
- SchemaOutputResolver
- Unmarshaller.Listener
- Javax.xml.bind.util classes
- JAXBResult
- JAXBSource
- ValidationEventCollector
- Javax.xml.parsers classes
- DocumentBuilder
- DocumentBuilderFactory
- SAXParser
- SAXParserFactory
- Javax.xml.soap classes
- AttachmentPart
- MessageFactory
- MimeHeader
- MimeHeaders
- SAAJMetaFactory
- SOAPConnection
- SOAPConnectionFactory
- SOAPFactory
- SOAPMessage
- SOAPPart
- Javax.xml.validation classes
- Schema
- SchemaFactory
- TypeInfoProvider
- Validator
- ValidatorHandler
- Javax.xml.xpath classes
- XPathConstants
- XPathFactory
- Java Useful Resources
- Java - Quick Guide
- Java - Useful Resources
String getValue() Method
Description
The javax.xml.soap.MimeHeader.getValue() method returns the value of this MimeHeader object.
Declaration
Following is the declaration for javax.xml.soap.MimeHeader.getValue() method
String getValue()
Return Value
value of this MimeHeader object
Example
The following example shows the usage of javax.xml.soap.MimeHeader.getValue() method.
package com.tutorialspoint; import java.io.ByteArrayInputStream; import java.util.Iterator; import javax.xml.soap.MessageFactory; import javax.xml.soap.MimeHeader; import javax.xml.soap.MimeHeaders; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPMessage; public class MimeHeaderDemo { public static void main(String[] args) { try { //create a default message factory MessageFactory messageFactory = MessageFactory.newInstance( SOAPConstants.SOAP_1_2_PROTOCOL); String contents = "Hello World!"; // add raw content ByteArrayInputStream bis = new ByteArrayInputStream( contents.getBytes()); MimeHeaders headers = new MimeHeaders(); headers.setHeader("Content-Type", "text/xml"); // create a new SOAPMessage SOAPMessage message = MessageFactory .newInstance() .createMessage(headers,bis); Iterator<MimeHeader> iterator = message.getMimeHeaders().getAllHeaders(); while (iterator.hasNext()) { MimeHeader header = iterator.next(); System.out.println("Mime Header Value: " + header.getValue()); } } catch (Exception ex) { ex.printStackTrace(); } } }
If we compile the code and execute it, this will produce the following result −
Mime Header value: text/xml
javax_xml_soap_mimeheader.htm
Advertisements