Example usage for javax.xml.soap SOAPException SOAPException

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

Introduction

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

Prototype

public SOAPException(Throwable cause) 

Source Link

Document

Constructs a SOAPException object initialized with the given Throwable object.

Usage

From source file:org.apache.axis2.saaj.SOAPPartImpl.java

public void setParentElement(SOAPElement parent) throws SOAPException {
    throw new SOAPException("Cannot set the parent element of SOAPPart");
}

From source file:org.jbpm.bpel.integration.server.SoapHandler.java

protected ObjectMessage sendRequest(SOAPMessage soapMessage, Session jmsSession, JbpmContext jbpmContext)
        throws SOAPException, JMSException {
    // create a jms message to deliver the incoming content
    ObjectMessage jmsRequest = jmsSession.createObjectMessage();

    // put the partner link identified by handle in a jms property
    PartnerLinkEntry partnerLinkEntry = integrationControl.getPartnerLinkEntry(portTypeName, serviceName,
            portName);//from  www  . j a v a  2s .c om
    long partnerLinkId = partnerLinkEntry.getId();
    jmsRequest.setLongProperty(IntegrationConstants.PARTNER_LINK_ID_PROP, partnerLinkId);

    Operation operation = determineOperation(soapMessage);
    if (operation == null)
        throw new SOAPException("could not determine operation to perform");

    // put the operation name in a jms property
    String operationName = operation.getName();
    jmsRequest.setStringProperty(IntegrationConstants.OPERATION_NAME_PROP, operationName);

    log.debug("received request: partnerLink=" + partnerLinkId + ", operation=" + operationName);

    // extract message content
    HashMap requestParts = new HashMap();
    formatter.readMessage(operationName, soapMessage, requestParts, MessageDirection.INPUT);
    jmsRequest.setObject(requestParts);

    // fill message properties
    BpelProcessDefinition process = integrationControl.getDeploymentDescriptor()
            .findProcessDefinition(jbpmContext);
    MessageType requestType = process.getImportDefinition()
            .getMessageType(operation.getInput().getMessage().getQName());
    fillCorrelationProperties(requestParts, jmsRequest, requestType.getPropertyAliases());

    // set up producer
    MessageProducer producer = jmsSession.createProducer(partnerLinkEntry.getDestination());
    try {
        // is the exchange pattern request/response?
        if (operation.getOutput() != null) {
            Destination replyTo = integrationControl.getIntegrationServiceFactory().getResponseDestination();
            jmsRequest.setJMSReplyTo(replyTo);

            // have jms discard request message if response timeout expires
            Number responseTimeout = getResponseTimeout(jbpmContext);
            if (responseTimeout != null)
                producer.setTimeToLive(responseTimeout.longValue());
        } else {
            // have jms discard message if one-way timeout expires
            Number oneWayTimeout = getOneWayTimeout(jbpmContext);
            if (oneWayTimeout != null)
                producer.setTimeToLive(oneWayTimeout.longValue());
        }

        // send request message
        producer.send(jmsRequest);
        log.debug("sent request: " + RequestListener.messageToString(jmsRequest));

        return jmsRequest;
    } finally {
        // release producer resources
        producer.close();
    }
}