- 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
javax.xml.soap.SOAPConnection.call(SOAPMessage request, Object to)
Description
The javax.xml.soap.SOAPConnection.call(SOAPMessage request, Object to) method creates a MessageFactory object for the given String protocol.
Declaration
Following is the declaration for javax.xml.soap.SOAPConnection.call(SOAPMessage request, Object to) method
abstract SOAPMessage call(SOAPMessage request, Object to)
Parameters
request − the SOAPMessage object to be sent.
to − an Object that identifies where the message should be sent. It is required to support Objects of type java.lang.String, java.net.URL, and when JAXM is present javax.xml.messaging.URLEndpoint.
Return
SOAPMessage − the SOAPMessage object that is the response to the message that was sent.
Exception
SOAPException − if there is a SOAP error.
Example
The following example shows the usage of javax.xml.soap.SOAPConnection.call(SOAPMessage request, Object to) method.
package com.tutorialspoint; import javax.xml.soap.SOAPFactory; import javax.xml.soap.SOAPConstants; import javax.xml.soap.SOAPMessage; public class SoapConnectionDemo { public static void main(String[] args) { try { //create a default soap factory using SoapFactory implementation of //SAAJMetaFactory.newSOAPFactory(String protocol) SOAPFactory messageFactory = SOAPFactory.newInstance( SOAPConstants.SOAP_1_2_PROTOCOL); // create a new SOAPMessage SOAPMessage message = MessageFactory .newInstance() .createMessage(); message.writeTo(System.out); } catch (Exception ex) { ex.printStackTrace(); } } }
If we compile the code and execute it, this will produce the following result −
Mime Header Name: Content-Type Mime Header value: text/xml Mime Header Name: Encoding Mime Header value: UTF-8
To Continue Learning Please Login
Login with Google