Java 8 SOAPConnection - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SOAPConnection class.

This code example shows how to use the following methods:call, close
            throws SOAPException {
        SOAPConnection connection = null;
        SOAPMessage response = null;
        try { 
            connection = createConnection();
            response = connection.call(message, url);
        } finally { 
            if (connection != null) {
                closeConnection(connection);
            } 
        } 
        return response;
    } 
 
 
    /** 
     * Creates a SOAP connection to the SOAP server 
     * 
     * @return the SOAPconnection object 
     * @throws SOAPException 

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
	 
 
    public void callWebService() throws SOAPException, IOException {
        SOAPMessage request = createStudentRequest();
        SOAPConnection connection = connectionFactory.createConnection();
        SOAPMessage response = connection.call(request, url);
        if (!response.getSOAPBody().hasFault()) {
        	 
        	print(response);
        	 
        	writeStudentResponse(response);
        } 
        else { 
            SOAPFault fault = response.getSOAPBody().getFault();
            System.err.println("Received SOAP Fault");
            System.err.println("SOAP Fault Code :" + fault.getFaultCode());
            System.err.println("SOAP Fault String :" + fault.getFaultString());
        } 
    } 
 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
        msg.saveChanges();
         
        SOAPConnection con = conFac.createConnection();
        URL endpoint = new URL("http://localhost:" + PORT 
                               + "/SOAPServiceProviderRPCLit/SoapPortProviderRPCLit1"); 
        SOAPMessage response = con.call(msg, endpoint); 
        QName sayHiResp = new QName("http://apache.org/hello_world_rpclit", "sayHiResponse");
        assertNotNull(response.getSOAPBody().getChildElements(sayHiResp));
        assertEquals(2, response.countAttachments());
    } 
 
    private void doGreeterRPCLit(SOAPServiceRPCLit service,
                                 QName portName,
                                 int count,
                                 boolean doFault) throws Exception {
        String response1 = new String("TestGreetMeResponse");
        String response2 = new String("TestSayHiResponse");
        try { 
            GreeterRPCLit greeter = service.getPort(portName, GreeterRPCLit.class);
            updateAddressPort(greeter, PORT);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
    } 
 
    public void callWebService() throws SOAPException, IOException {
        SOAPMessage request = createEchoRequest();
        SOAPConnection connection = connectionFactory.createConnection();
        SOAPMessage response = connection.call(request, url);
        if (!response.getSOAPBody().hasFault()) {
        	print(response);
            writeEchoResponse(response);
        } 
        else { 
            SOAPFault fault = response.getSOAPBody().getFault();
            System.err.println("Received SOAP Fault");
            System.err.println("SOAP Fault Code :" + fault.getFaultCode());
            System.err.println("SOAP Fault String :" + fault.getFaultString());
        } 
    } 
 
    private void writeEchoResponse(SOAPMessage message) throws SOAPException {
        SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
        AttachmentPart ap = msg.createAttachmentPart();
        URL imageUrl = Classes.getResource("switchyard.png");
        ap.setDataHandler(new DataHandler(new URLDataSource(imageUrl)));
        ap.setContentId("switchyard.png");
        msg.addAttachmentPart(ap);
        return connection.call(msg, new URL(switchyard_web_service));
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
    } 
 
    public void callWebService() throws SOAPException, IOException {
        SOAPMessage request = createEchoRequest();
        SOAPConnection connection = connectionFactory.createConnection();
        SOAPMessage response = connection.call(request, url);
        if (!response.getSOAPBody().hasFault()) {
            writeEchoResponse(response);
        } 
        else { 
            SOAPFault fault = response.getSOAPBody().getFault();
            System.err.println("Received SOAP Fault");
            System.err.println("SOAP Fault Code :" + fault.getFaultCode());
            System.err.println("SOAP Fault String :" + fault.getFaultString());
        } 
    } 
 
    private void writeEchoResponse(SOAPMessage message) throws SOAPException {
        SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
        Name echoResponseName = envelope.createName("echoResponse", PREFIX, NAMESPACE_URI);
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
    protected SOAPMessage getReplyFromCall(SOAPMessage msg, String actionURI) 
         throws SOAPExceptionMimeHeaders mh = msg.getMimeHeaders();
        mh.setHeader("SOAPAction", actionURI);
        return conn.call(msg, ep);
    } 
 
    /** 
     * extract the content of the SOAP response.  The response is checked for 
     * faults.   
     */ 
    protected Element extractContent(SOAPMessage resp) 
         throws RegistryServiceException, SOAPException
    { 
        if (resp == null) 
            throw new RegistryServiceException("No response from registry"); 
 
        Node out = resp.getSOAPBody().getFirstChild();
        while (out != null && out.getNodeType() != Node.ELEMENT_NODE) {
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
        MessageFactory msgFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPMessage msg = msgFactory.createMessage();
        SOAPBodyElement bodyElement = msg.getSOAPBody().addBodyElement(new QName("urn:switchyard-quickstart:soap-mtom:1.0", "image"));
        bodyElement.setTextContent(imageData);
 
        return connection.call(msg, new URL(SWITCHYARD_WEB_SERVICE));
    } 
 
    private static String imageData = "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwg"
                            + "JC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyM" 
                            + "jIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAQABADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAA" 
                            + "AAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRV" 
                            + "S0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJi" 
                            + "pKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8Q" 
                            + "AHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhc" 
                            + "RMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN" 
                            + "0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6" 
                            + "Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDFs0162zJdeLvEepNFcxW0ywahLFDDKTyrsWLlSeAwC5wcHPTRbxbrd3r" 
                            + "994UfVbiJA8trDdwXEwkRo8hX3b9zcrzk89z1qjDoXi6W5i1nStG1KC8uI83dnc28iLIQRvB3/LsLYwpbdgAjkcJP4" 
                            + "I8S2fjE6yul3osBdi4JaFpZQrNkrtjBLMMkZAxxngVtotjHV77n/9k="; 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:call
        MessageFactory msgFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
        SOAPMessage msg = msgFactory.createMessage();
        SOAPBodyElement bodyElement = msg.getSOAPBody().addBodyElement(new QName("urn:switchyard-quickstart:soap-mtom:1.0", "image"));
        bodyElement.setTextContent(imageData);
 
        return connection.call(msg, new URL(SWITCHYARD_WEB_SERVICE));
    } 
 
    private static String imageData = "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwg"
                            + "JC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyM" 
                            + "jIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAQABADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAA" 
                            + "AAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRV" 
                            + "S0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJi" 
                            + "pKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8Q" 
                            + "AHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhc" 
                            + "RMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN" 
                            + "0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6" 
                            + "Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDFs0162zJdeLvEepNFcxW0ywahLFDDKTyrsWLlSeAwC5wcHPTRbxbrd3r" 
                            + "994UfVbiJA8trDdwXEwkRo8hX3b9zcrzk89z1qjDoXi6W5i1nStG1KC8uI83dnc28iLIQRvB3/LsLYwpbdgAjkcJP4" 
                            + "I8S2fjE6yul3osBdi4JaFpZQrNkrtjBLMMkZAxxngVtotjHV77n/9k="; 
3
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 SOAPConnection Methods: