public void toODE(org.apache.ode.bpel.iapi.Message odeMsg, NormalizedMessage nmsMsg, Message msgdef) throws MessageTranslationException { // The assertions assume isRecognized was called! assert msgdef.getParts().size() == 1 : "multi part!"; Part partdef = (Part) msgdef.getParts().values().iterator().next(); assert partdef.getElementName() != null : "non-element part!"; Element el = parse(nmsMsg.getContent()); if (!DOMUtils.getNodeQName(el).equals(partdef.getElementName())) { String errmsg = "NMS message did not contain element " + partdef.getElementName(); __log.debug(errmsg); throw new MessageTranslationException(errmsg); } Document doc = newDocument(); Element msgel = doc.createElement("message"); doc.appendChild(msgel); Element pel = doc.createElement(partdef.getName()); msgel.appendChild(pel); pel.appendChild(doc.importNode(el,true)); odeMsg.setMessage(msgel); }
if (n == null || n.getNodeType() != Node.ELEMENT_NODE) { WSDLException we = new WSDLException(WSDLException.OTHER_ERROR, __msgs.msgCannotBeDocumentRootElement(DOMUtils.getNodeQName(el).toString())); we.setLocation(XPathUtils.getXPathExprFromNode(el)); throw we; __msgs.msgMustBeChildOfDef(DOMUtils.getNodeQName(el).toString())); we.setLocation(XPathUtils.getXPathExprFromNode(el)); throw we;
QName sourceQName = getNodeQName(sourceNode); String nodeName = sourceQName.getLocalPart(); String namespaceURI = sourceQName.getNamespaceURI();
public Recognized isRecognized(NormalizedMessage nmsMsg, Operation op) { Message in = op.getInput() == null ? null : op.getInput().getMessage(); Message out = op.getOutput() == null ? null : op.getOutput().getMessage(); // First we check if the signature of the operation makes this mapper // a possibility. if (!checkMessageDef(in) || !checkMessageDef(out)) return Recognized.FALSE; // Ok, if it is possible, then we have to check the content of the // input message to see if it matches doc lit style, if the input // message is empty, then we have an ambiguous match if (in == null) return Recognized.UNSURE; Part inpart = (Part) in.getParts().values().iterator().next(); assert inpart != null; assert inpart.getElementName() != null; Element msg; try { msg = parse(nmsMsg.getContent()); } catch (MessageTranslationException e) { __log.debug("Failed to parse NMS message: " + nmsMsg, e); return Recognized.FALSE; } QName elName = DOMUtils.getNodeQName(msg); // If the message element matches the single part element, then // we are using doc-lit style messaging. return inpart.getElementName().equals(elName) ? Recognized.TRUE : Recognized.FALSE; }