public void createSoapBody(
      org.apache.axiom.soap.SOAPBody sb,
      SOAPBody soapBody,
      Message msgDef,
      Element message,
      String rpcWrapper)
      throws AxisFault {
    OMElement partHolder =
        isRPC
            ? soapFactory.createOMElement(
                new QName(soapBody.getNamespaceURI(), rpcWrapper, "odens"), sb)
            : sb;
    List<Part> parts = msgDef.getOrderedParts(soapBody.getParts());

    for (Part part : parts) {
      Element srcPartEl = DOMUtils.findChildByName(message, new QName(null, part.getName()));
      if (srcPartEl == null) {
        throw new AxisFault("Missing required part in ODE Message");
      }

      OMElement omPart = OMUtils.toOM(srcPartEl, soapFactory);
      if (isRPC) {
        partHolder.addChild(omPart);
      } else {
        for (Iterator<OMNode> i = omPart.getChildren(); i.hasNext(); ) {
          partHolder.addChild(i.next());
        }
      }
    }
  }
Exemplo n.º 2
0
  public Node getPartData(Element message, OMessageVarType.Part part) {
    // borrowed from ASSIGN.evalQuery()
    Node ret = DOMUtils.findChildByName(message, new QName(null, part.name));
    if (part.type instanceof OElementVarType) {
      QName elName = ((OElementVarType) part.type).elementType;
      ret = DOMUtils.findChildByName((Element) ret, elName);
    } else if (part.type == null) {
      // Special case of header parts never referenced in the WSDL def
      if (ret != null
          && ret.getNodeType() == Node.ELEMENT_NODE
          && ((Element) ret).getAttribute("headerPart") != null
          && DOMUtils.getTextContent(ret) == null)
        ret = DOMUtils.getFirstChildElement((Element) ret);
      // The needed part isn't there, dynamically creating it
      if (ret == null) {
        ret = message.getOwnerDocument().createElementNS(null, part.name);
        ((Element) ret).setAttribute("headerPart", "true");
        message.appendChild(ret);
      }
    }

    return ret;
  }