Example #1
0
  public XmlDocument wrapBodyContent(XmlElement bodyContent) throws XsulException {
    if (bodyContent == null) {
      return null;
    }
    if (bodyContent.getParent() != null) {
      XmlContainer top = bodyContent.getRoot();
      if (top instanceof XmlDocument) {
        return (XmlDocument) top;
      }
    }
    XmlDocument doc = builder.newDocument();

    final XmlNamespace soapNs = builder.newNamespace("S", NS_URI_SOAP11);
    XmlElement envelope = doc.addDocumentElement(soapNs, ELEM_ENVELOPE);
    envelope.declareNamespace(soapNs);
    // declare prefixes for some common namespaces
    envelope.declareNamespace(XmlConstants.XS_NS);
    envelope.declareNamespace(XmlConstants.XSI_NS);

    XmlElement body = envelope.addElement(soapNs, "Body");
    body.addElement(bodyContent);

    return doc;
  }
Example #2
0
 public XmlElement requiredBodyContent(XmlDocument respDoc) throws XsulException {
   // check if response has Envelope/Body
   XmlElement root = respDoc.getDocumentElement();
   return requiredBodyContent(root);
 }