Example usage for javax.xml.soap SOAPConnection close

List of usage examples for javax.xml.soap SOAPConnection close

Introduction

In this page you can find the example usage for javax.xml.soap SOAPConnection close.

Prototype

public abstract void close() throws SOAPException;

Source Link

Document

Closes this SOAPConnection object.

Usage

From source file:org.wso2.carbon.identity.provisioning.connector.UserUpdation.java

/**
 * Method for create SOAP connection//  ww  w . j ava2s .  c  om
 */
public static boolean invokeSOAP(String userId, String serviceId, String loginId, String login,
        String firstName, String name, String mail, String phone, String status, String role,
        String extraFields) throws IdentityProvisioningException {
    try {
        SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
        SOAPConnection soapConnection = soapConnectionFactory.createConnection();
        String url = InweboConnectorConstants.INWEBO_URL;
        SOAPMessage soapResponse = soapConnection.call(createUserObject(userId, serviceId, loginId, login,
                firstName, name, mail, phone, status, role, extraFields), url);
        String updationStatus = soapResponse.getSOAPBody().getElementsByTagName("loginUpdateReturn").item(0)
                .getTextContent().toString();
        soapConnection.close();
        boolean processStatus = StringUtils.equals("OK", updationStatus);
        if (!processStatus) {
            String error = soapResponse.getSOAPBody().getElementsByTagName("loginUpdateReturn").item(0)
                    .getTextContent().toString();
            throw new IdentityProvisioningException(
                    "Error occurred while updating the user in InWebo:" + error);
        }
        return processStatus;
    } catch (SOAPException e) {
        throw new IdentityProvisioningException("Error occurred while sending SOAP Request to Server", e);
    } catch (IdentityProvisioningException e) {
        throw new IdentityProvisioningException("Error occurred while sending SOAP Request to Server", e);
    }
}