Search in sources :

Example 1 with SOAPException

use of jakarta.xml.soap.SOAPException in project openmq by eclipse-ee4j.

the class SendServiceImpl method rollback.

@Override
public void rollback(SOAPMessage sm) throws JMSException {
    try {
        String sid = MessageUtil.getServiceClientId(sm);
        if (sid == null) {
            throw new JMSException("Cannot rollback a transaction because sid is null.");
        }
        Client client = cache.getClient(sm);
        this.rollback(client);
    } catch (SOAPException soape) {
        JMSException jmse = new JMSException(soape.getMessage());
        jmse.setLinkedException(soape);
        throw jmse;
    }
}
Also used : SOAPException(jakarta.xml.soap.SOAPException) JMSException(jakarta.jms.JMSException)

Example 2 with SOAPException

use of jakarta.xml.soap.SOAPException in project openmq by eclipse-ee4j.

the class MessageUtil method getServiceAttribute.

public static String getServiceAttribute(SOAPMessage soapm, String localName) throws SOAPException {
    SOAPHeaderElement mh = getMessageHeaderElement(soapm);
    SOAPElement serviceElement = getJMSChildElement(mh, Constants.SERVICE);
    if (serviceElement == null) {
        throw new SOAPException("Message does not contain a Service SOAP Header Element.");
    }
    Name n = createJMSName(localName);
    String value = serviceElement.getAttributeValue(n);
    return value;
}
Also used : SOAPHeaderElement(jakarta.xml.soap.SOAPHeaderElement) SOAPException(jakarta.xml.soap.SOAPException) SOAPElement(jakarta.xml.soap.SOAPElement) Name(jakarta.xml.soap.Name)

Example 3 with SOAPException

use of jakarta.xml.soap.SOAPException in project openmq by eclipse-ee4j.

the class MessageUtil method getServiceReceiveTimeout.

public static long getServiceReceiveTimeout(SOAPMessage soapm) throws SOAPException {
    // in milli secconds
    long timeout = 30000;
    String str = getServiceAttribute(soapm, Constants.RECEIVE_TIMEOUT);
    if (str != null) {
        try {
            timeout = Integer.parseInt(str);
        } catch (Exception e) {
            throw new SOAPException(e);
        }
    }
    return timeout;
}
Also used : SOAPException(jakarta.xml.soap.SOAPException) SOAPException(jakarta.xml.soap.SOAPException)

Example 4 with SOAPException

use of jakarta.xml.soap.SOAPException in project openmq by eclipse-ee4j.

the class SOAPtoJMSServlet method generateResponseMessage.

/**
 * Add a MessageStatus element with the value of "published" to
 * the soapMessage.
 */
public SOAPMessage generateResponseMessage(SOAPMessage soapMessage) {
    try {
        SOAPPart soapPart = soapMessage.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        SOAPBody soapBody = envelope.getBody();
        soapBody.addChildElement("MessageStatus").addTextNode("published");
        soapMessage.saveChanges();
    } catch (SOAPException soape) {
        soape.printStackTrace();
    }
    return soapMessage;
}
Also used : SOAPBody(jakarta.xml.soap.SOAPBody) SOAPException(jakarta.xml.soap.SOAPException) SOAPPart(jakarta.xml.soap.SOAPPart) SOAPEnvelope(jakarta.xml.soap.SOAPEnvelope)

Example 5 with SOAPException

use of jakarta.xml.soap.SOAPException in project metro-jax-ws by eclipse-ee4j.

the class AddNumbersClient method invokeAsyncPollAddNumbers.

private void invokeAsyncPollAddNumbers(String msgString) throws RemoteException {
    SOAPMessage message = null;
    try {
        MessageFactory factory = MessageFactory.newInstance();
        message = factory.createMessage();
        message.getSOAPPart().setContent((Source) new StreamSource(new StringReader(msgString)));
        message.saveChanges();
    } catch (SOAPException e) {
        e.printStackTrace();
    }
    Dispatch<SOAPMessage> smDispatch = null;
    smDispatch = service.createDispatch(portQName, SOAPMessage.class, Service.Mode.MESSAGE);
    System.out.println("\nInvoking async poll message: " + msgString);
    Response<SOAPMessage> response = smDispatch.invokeAsync(message);
    while (!response.isDone()) {
    // go do some work
    }
    String xmlString = null;
    try {
        SOAPMessage result = response.get();
        Source sourceResult = (Source) result.getSOAPPart().getContent();
        xmlString = sourceToXMLString(sourceResult);
    } catch (SOAPException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
    System.out.println("Received response: " + xmlString);
}
Also used : MessageFactory(jakarta.xml.soap.MessageFactory) StreamSource(javax.xml.transform.stream.StreamSource) SOAPException(jakarta.xml.soap.SOAPException) StringReader(java.io.StringReader) ExecutionException(java.util.concurrent.ExecutionException) SOAPMessage(jakarta.xml.soap.SOAPMessage) StreamSource(javax.xml.transform.stream.StreamSource) Source(javax.xml.transform.Source)

Aggregations

SOAPException (jakarta.xml.soap.SOAPException)64 SOAPMessage (jakarta.xml.soap.SOAPMessage)31 WebServiceException (jakarta.xml.ws.WebServiceException)29 SOAPBody (jakarta.xml.soap.SOAPBody)23 Node (org.w3c.dom.Node)18 QName (javax.xml.namespace.QName)12 SOAPFault (jakarta.xml.soap.SOAPFault)11 MessageFactory (jakarta.xml.soap.MessageFactory)9 SOAPElement (jakarta.xml.soap.SOAPElement)9 XMLStreamException (javax.xml.stream.XMLStreamException)8 SOAPHeader (jakarta.xml.soap.SOAPHeader)5 StreamSource (javax.xml.transform.stream.StreamSource)5 Message (com.sun.xml.ws.api.message.Message)4 DataHandler (jakarta.activation.DataHandler)4 JMSException (jakarta.jms.JMSException)4 ByteArrayInputStream (java.io.ByteArrayInputStream)4 Map (java.util.Map)4 Source (javax.xml.transform.Source)4 Detail (jakarta.xml.soap.Detail)3 MimeHeaders (jakarta.xml.soap.MimeHeaders)3