Example usage for javax.xml.soap SOAPException toString

List of usage examples for javax.xml.soap SOAPException toString

Introduction

In this page you can find the example usage for javax.xml.soap SOAPException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:org.soapfromhttp.service.CallSOAP.java

/**
 * Calcule d'une proprit depuis une requte SOAP.
 *
 * @param envelope/*from w w  w.  j  a v a  2s .  c om*/
 * @param servicePath
 * @param method
 * @thorw CerberusException
 * @return String
 */
public String calculatePropertyFromSOAPResponse(final String envelope, final String servicePath,
        final String method) {
    String result = null;
    ByteArrayOutputStream out = null;
    // Test des inputs ncessaires.
    if (envelope != null && servicePath != null && method != null) {

        SOAPConnectionFactory soapConnectionFactory;
        SOAPConnection soapConnection = null;
        try {
            soapConnectionFactory = SOAPConnectionFactory.newInstance();
            soapConnection = soapConnectionFactory.createConnection();
            MyLogger.log(CallSOAP.class.getName(), Level.INFO, "Connection opened");

            // Cration de la requete SOAP
            MyLogger.log(CallSOAP.class.getName(), Level.INFO, "Create request");
            SOAPMessage input = createSOAPRequest(envelope, method);

            // Appel du WS
            MyLogger.log(CallSOAP.class.getName(), Level.INFO, "Calling WS");
            MyLogger.log(CallSOAP.class.getName(), Level.INFO, "Input :" + input);
            SOAPMessage soapResponse = soapConnection.call(input, servicePath);

            out = new ByteArrayOutputStream();

            soapResponse.writeTo(out);
            MyLogger.log(CallSOAP.class.getName(), Level.INFO, "WS response received");
            MyLogger.log(CallSOAP.class.getName(), Level.DEBUG, "WS response : " + out.toString());
            result = out.toString();

        } catch (SOAPException e) {
            MyLogger.log(CallSOAP.class.getName(), Level.ERROR, e.toString());
        } catch (IOException e) {
            MyLogger.log(CallSOAP.class.getName(), Level.ERROR, e.toString());
        } catch (ParserConfigurationException e) {
            MyLogger.log(CallSOAP.class.getName(), Level.ERROR, e.toString());
        } catch (SAXException e) {
            MyLogger.log(CallSOAP.class.getName(), Level.ERROR, e.toString());
        } finally {
            try {
                if (soapConnection != null) {
                    soapConnection.close();
                }
                if (out != null) {
                    out.close();
                }
                MyLogger.log(CallSOAP.class.getName(), Level.INFO, "Connection and ByteArray closed");
            } catch (SOAPException ex) {
                Logger.getLogger(CallSOAP.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(CallSOAP.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
            }
        }
    }
    return result;
}

From source file:org.apache.axis.handlers.HandlerChainImpl.java

private void postInvoke(SOAPMessageContext msgContext) {
    Boolean propFormOptimization = (Boolean) msgContext
            .getProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION);
    if (propFormOptimization != null && !propFormOptimization.booleanValue()) {
        msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.TRUE);
        SOAPMessage message = msgContext.getMessage();
        ArrayList oldList = (ArrayList) msgContext.getProperty(JAXRPC_METHOD_INFO);
        if (oldList != null) {
            if (!Arrays.equals(oldList.toArray(), getMessageInfo(message).toArray())) {
                throw new RuntimeException(Messages.getMessage("invocationArgumentsModified00"));
            }/*from  ww  w  .  j a  va  2s  .  c  o m*/
        }
        try {
            if (message != null) {
                message.saveChanges();
            }
        } catch (SOAPException e) {
            log.debug("Exception in postInvoke : ", e);
            throw new RuntimeException("Exception in postInvoke : " + e.toString());
        }
    }
}

From source file:org.apache.axis.message.SOAPHeader.java

public Node appendChild(Node newChild) throws DOMException {
    SOAPHeaderElement headerElement = null;
    if (newChild instanceof SOAPHeaderElement)
        headerElement = (SOAPHeaderElement) newChild;
    else/*ww w. j  av  a 2s .c  o m*/
        headerElement = new SOAPHeaderElement((Element) newChild);
    try {
        addChildElement(headerElement);
    } catch (SOAPException e) {
        throw new DOMException(DOMException.INVALID_STATE_ERR, e.toString());
    }
    return headerElement;
}