Package org.apache.ode.bpel.iapi

Examples of org.apache.ode.bpel.iapi.Message


      throws BpelEngineException {

  }
 
  private void invokeProbeService(PartnerRoleMessageExchange prmx) {
    Message msg = prmx.getRequest();
    Element elm1 = prmx.getRequest().getPart("probeName");
    Element elm2 = prmx.getRequest().getPart("probeData");
   
    if ( elm1 != null && elm2 != null ) {
      String cat = elm2.getTextContent()+" -> "+elm1.getTextContent();
      elm2.setTextContent(cat);
            final Message response = prmx.createMessage(prmx.getOperation().getOutput().getMessage().getQName());
            response.setMessage(msg.getMessage());
            response.setPart("probeData", elm2);
      prmx.reply(response);
    }
  }
View Full Code Here


  }
 
  private void invokeFaultService(PartnerRoleMessageExchange prmx) {
    QName errorMsgType = new QName(FAULT_NS,"errorMessage");
    QName responseMsgType = new QName(FAULT_NS,"faultMessage");
    Message faultMsg = prmx.createMessage(errorMsgType);
    Message responseMsg = prmx.createMessage(responseMsgType);

    String ind1 = prmx.getRequest().getPart("faultIndicator1").getTextContent();
    String ind2 = prmx.getRequest().getPart("faultIndicator2").getTextContent();
    String inputData = prmx.getRequest().getPart("faultData").getTextContent();
   
    StringBuffer faultData = new StringBuffer("<message><errorID>FA-1</errorID><errorText>");
    faultData.append(inputData);
    faultData.append("</errorText></message>");
   
    StringBuffer responseData = new StringBuffer("<message><faultName>FA-NoFault</faultName><faultData>");
    responseData.append(inputData);
    responseData.append("</faultData></message>");
   
   
    Element faultResponse = null;
    Element response = null;
    try {
      faultResponse = DOMUtils.stringToDOM(faultData.toString());
      response = DOMUtils.stringToDOM(responseData.toString());
    } catch (SAXException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
   
   
    // TODO: Question - how does one set parts that are of a simple xsd type?
    faultMsg.setMessage(faultResponse);
    responseMsg.setMessage(response);
   
    if ( ind1.equals("yes")){
      prmx.replyWithFault(new QName(FAULT_NS,"FaultMessage1"), faultMsg);
    } else {
      if ( ind2.equals("yes")){
View Full Code Here

        // There will be multiple calls to invoke.
        partner.expects(atLeastOnce()).match(invokeOnOperation("invoke")).will(new CustomStub("invoke failing service") {
            public Object invoke(Invocation invocation) {
                PartnerRoleMessageExchange mex = (PartnerRoleMessageExchange) invocation.parameterValues.get(0);
                if (((TestService)_testService.proxy()).invoke()) {
                    Message response = mex.createMessage(mex.getOperation().getOutput().getMessage().getQName());
                    response.setMessage(DOMUtils.newDocument().createElementNS(NAMESPACE, "tns:ResponseElement"));
                    mex.reply(response);
                } else {
                    mex.replyWithFailure(MessageExchange.FailureType.COMMUNICATION_ERROR, "BangGoesInvoke", null);
                }
                return null;
View Full Code Here

            try {
                mex = _server.createMessageExchange(InvocationStyle.UNRELIABLE, _invocation.target, _invocation.operation,
                        new GUID().toString());

                Message request = mex.createMessage(_invocation.requestType);
                request.setMessage(_invocation.request);
                _invocation.invokeTime = System.currentTimeMillis();
                mex.setRequest(request);
                mex.invokeBlocking();

                CorrelationStatus cstatus = mex.getCorrelationStatus();
View Full Code Here

                public Void call() throws Exception {
                    PartnerRoleMessageExchange odeMex = null;
                    try {
                        odeMex = (PartnerRoleMessageExchange)_server.getBpelServer().getEngine().getMessageExchange(odeMexId);
                        if (odeMex != null) {
                            Message response = createResponseMessage(odeMex, operation, (Element)result);
                            odeMex.reply(response);
                        }
                    } catch (Exception ex) {
                        String errmsg = "Unable to process response: " + ex.getMessage();
                        if (odeMex != null) {
View Full Code Here

            __log.debug("Creating result message:");
            __log.debug(">>>" + DOMUtils.domToString(dom.getDocumentElement()));
        }

        QName id = partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName();
        Message response = partnerRoleMessageExchange.createMessage(id);
        response.setMessage(dom.getDocumentElement());

        return response;
    }
View Full Code Here

                public Void call() throws Exception {
                    PartnerRoleMessageExchange odeMex = null;
                    try {
                        odeMex = (PartnerRoleMessageExchange)_server.getBpelServer().getEngine().getMessageExchange(odeMexId);
                        if (odeMex != null) {
                            Message response = createResponseMessage(odeMex, operation, (Element)result);
                            odeMex.reply(response);
                        }
                    } catch (Exception ex) {
                        String errmsg = "Unable to process response: " + ex.getMessage();
                        if (odeMex != null) {
View Full Code Here

            __log.debug("Creating result message:");
            __log.debug(">>>" + DOMUtils.domToString(dom.getDocumentElement()));
        }

        QName id = partnerRoleMessageExchange.getOperation().getOutput().getMessage().getQName();
        Message response = partnerRoleMessageExchange.createMessage(id);
        response.setMessage(dom.getDocumentElement());

        return response;
    }
View Full Code Here

                // invoke the process
                txMgr.begin();
                mex = odeServer.getBpelServer().getEngine().createMessageExchange(new GUID().toString(),
                        new QName("http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl", "HelloService"), "hello");

                Message request = mex.createMessage(new QName("", ""));
                request.setMessage(DOMUtils.stringToDOM("<message><TestPart><hello xmlns=\"http://tuscany.apache.org/implementation/bpel/example/helloworld.wsdl\">Hello</hello></TestPart></message>"));
                onhold = mex.invoke(request);
                txMgr.commit();
            } catch (Exception e) {
                e.printStackTrace();
                txMgr.rollback();
View Full Code Here

     *
     * @param message
     * @return
     */
    protected Message cloneMessage(Message message) {
        Message clone = createMessage(message.getType());
        clone.setMessage((Element) message.getMessage().cloneNode(true));
        Map<String, Node> headerParts = message.getHeaderParts();
        for (String partName : headerParts.keySet()) {
            clone.setHeaderPart(partName, (Element) headerParts.get(partName).cloneNode(true));
        }
        Map<String, Node> parts = message.getHeaderParts();
        for (String partName : parts.keySet()) {
            clone.setHeaderPart(partName, (Element) parts.get(partName).cloneNode(true));
        }
        return clone;
    }
View Full Code Here

TOP

Related Classes of org.apache.ode.bpel.iapi.Message

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.