use of jakarta.xml.soap.SOAPException in project metro-jax-ws by eclipse-ee4j.
the class SAAJMessageTester method init.
private void init() {
MessageFactory mf = null;
try {
mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
MimeHeaders mhs = new MimeHeaders();
mhs.addHeader("Content-Type", "text/xml");
mhs.addHeader("Content-Transfer-Encoding", "binary");
SOAPMessage sm = mf.createMessage(mhs, new ByteArrayInputStream(soap11Msg.getBytes()));
msg = new SAAJMessage(sm);
} catch (SOAPException e) {
e.printStackTrace();
assertTrue(false);
} catch (IOException e) {
e.printStackTrace();
assertTrue(false);
}
}
use of jakarta.xml.soap.SOAPException in project metro-jax-ws by eclipse-ee4j.
the class ProviderImpl method invoke.
/*
*/
public Source invoke(Source msg) {
if (!isInjectionDone()) {
throw new WebServiceException("Injection is not done");
}
// Test if we got the correct SOAPMessage that has handler changes
try {
MessageFactory fact = MessageFactory.newInstance();
SOAPMessage soap = fact.createMessage();
soap.getSOAPPart().setContent(msg);
SOAPBody body = soap.getSOAPBody();
Iterator i = body.getChildElements();
SOAPElement elem = (SOAPElement) i.next();
QName name = elem.getElementQName();
QName exp = new QName("urn:test:types", "MyVoidTest");
if (!exp.equals(name)) {
throw new WebServiceException("Handler changes aren't reflected");
}
} catch (SOAPException e) {
throw new WebServiceException("Got Incorrect Source");
}
printContext();
String content = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"><soapenv:Body> <VoidTestResponse xmlns=\"urn:test:types\"></VoidTestResponse></soapenv:Body></soapenv:Envelope>";
Source source = new StreamSource(new ByteArrayInputStream(content.getBytes()));
return source;
}
use of jakarta.xml.soap.SOAPException in project metro-jax-ws by eclipse-ee4j.
the class WsaTestImpl method createSOAPFault.
SOAPFault createSOAPFault(String message) {
try {
SOAPFault fault = SOAPVersion.SOAP_11.getSOAPFactory().createFault();
fault.setFaultString(message);
fault.setFaultCode(new QName("http://example.org/echo", "EmptyEchoString"));
return fault;
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
}
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;
}
Aggregations