use of jakarta.xml.soap.SOAPElement in project openmq by eclipse-ee4j.
the class MessageUtil method getJMSChildElementValue.
public static String getJMSChildElementValue(SOAPElement soapElement, String localName) throws SOAPException {
String value = null;
SOAPElement se = getJMSChildElement(soapElement, localName);
if (se != null) {
value = se.getValue();
}
return value;
}
use of jakarta.xml.soap.SOAPElement in project openmq by eclipse-ee4j.
the class MessageUtil method setService.
/**
* XXX chiaming 06/19/2008- OLD -- to be removed
*/
public static void setService(SOAPMessage soapm, String value) throws SOAPException {
SOAPHeaderElement mh = MessageUtil.getMessageHeaderElement(soapm);
SOAPElement service = MessageUtil.addJMSChildElement(mh, Constants.SERVICE);
service.setValue(value);
soapm.saveChanges();
}
use of jakarta.xml.soap.SOAPElement in project metro-jax-ws by eclipse-ee4j.
the class MUTube method addHeader.
private static void addHeader(Message m, Set<QName> notUnderstoodHeaders) throws SOAPException {
for (QName qname : notUnderstoodHeaders) {
SOAPElement soapEl = SOAPVersion.SOAP_12.getSOAPFactory().createElement(MU_HEADER_DETAIL);
soapEl.addNamespaceDeclaration("abc", qname.getNamespaceURI());
soapEl.setAttribute("qname", "abc:" + qname.getLocalPart());
Header header = new DOMHeader<Element>(soapEl);
m.getHeaders().add(header);
}
}
use of jakarta.xml.soap.SOAPElement in project metro-jax-ws by eclipse-ee4j.
the class SOAPFaultBuilderTest method createFault.
private static SOAPFault createFault(SOAPVersion soapVersion) throws Exception {
SOAPFactory fac = soapVersion.getSOAPFactory();
SOAPFault sf = fac.createFault("This is a fault.", soapVersion.faultCodeClient);
Detail d = sf.addDetail();
SOAPElement de = d.addChildElement(DETAIL1_QNAME);
de.addAttribute(new QName("", "msg1"), "This is the first detail message.");
de = d.addChildElement(DETAIL2_QNAME);
de.addAttribute(new QName("", "msg2"), "This is the second detail message.");
return sf;
}
use of jakarta.xml.soap.SOAPElement in project metro-jax-ws by eclipse-ee4j.
the class SAAJFactoryTest method testResetDefaultNamespaceToGlobalWithWoodstax.
/**
* Test whether SAAJFactory.readAsSOAPMessage can handle default namespace reset correctly.
*
* <p>
* This test emulates JDK-8159058 issue. The issue is that the default namespace reset was not respected
* with built-in JDK XML input factory (it worked well with woodstax).
* </p>
*
* <p>
* This test operates against woodstax.
* </p>
*/
public void testResetDefaultNamespaceToGlobalWithWoodstax() throws Exception {
XMLInputFactory inputFactory = XMLInputFactory.newFactory();
XMLStreamReader envelope = inputFactory.createXMLStreamReader(new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<s:Body>" + "<SampleServiceRequest xmlns=\"http://sample.ex.org/\">" + "<RequestParams xmlns=\"\">" + "<Param1>hogehoge</Param1>" + "<Param2>fugafuga</Param2>" + "</RequestParams>" + "</SampleServiceRequest>" + "</s:Body>" + "</s:Envelope>"));
StreamMessage streamMessage = new StreamMessage(SOAPVersion.SOAP_11, envelope, null);
SAAJFactory saajFac = new SAAJFactory();
SOAPMessage soapMessage = saajFac.readAsSOAPMessage(SOAPVersion.SOAP_11, streamMessage);
// check object model
SOAPElement request = (SOAPElement) soapMessage.getSOAPBody().getFirstChild();
assertEquals("SampleServiceRequest", request.getLocalName());
assertEquals("http://sample.ex.org/", request.getNamespaceURI());
SOAPElement params = (SOAPElement) request.getFirstChild();
assertEquals("RequestParams", params.getLocalName());
assertNull(params.getNamespaceURI());
SOAPElement param1 = (SOAPElement) params.getFirstChild();
assertEquals("Param1", param1.getLocalName());
assertNull(param1.getNamespaceURI());
Element param2 = (Element) params.getChildNodes().item(1);
assertEquals("Param2", param2.getLocalName());
assertNull(param2.getNamespaceURI());
// check the message as string
assertEquals("<SampleServiceRequest xmlns=\"http://sample.ex.org/\">" + "<RequestParams xmlns=\"\">" + "<Param1>hogehoge</Param1>" + "<Param2>fugafuga</Param2>" + "</RequestParams>" + "</SampleServiceRequest>", nodeToText(request));
}
Aggregations