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;
}
}
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;
}
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;
}
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;
}
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);
}
Aggregations