Showing posts with label Remote Task Flow call. Show all posts
Showing posts with label Remote Task Flow call. Show all posts

Thursday, August 29, 2013

ADF Calling Bounded Task Flow Using URL

Task Flow can be called through a URL. Both calling and called Task flows should use pages not page fragments(.jsff).Task flow reference and remote-app-url property combined generate URL of remote task flow URL.
Create  an ADF application and create a bounded task flow in it.

Note the URL invoke property is set to url-invoke-allowed in the task flow.

Code for the remoteCallView.jspx
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
        <af:document title="remoteCallView.jspx" id="d1">
            <af:form id="f1">
                <af:panelGroupLayout id="pgl1">
                    <af:outputText value="Remote call" id="ot1"/>
                </af:panelGroupLayout>
            </af:form>
        </af:document>
    </f:view>

</jsp:root>
Run the remote task flow 

Create another ADF application and a bounded task flow as below.
For the task flow call activity give the properties as shown. Give a value to Document,ID,and a remote application through a managed bean.Create a managed bean in the request scope as  below 
package test.view;


public class RemoteCall {
   private String remoteURL;

    public void setRemoteURL(String remoteURL) {
        this.remoteURL = remoteURL;
    }

    public String getRemoteURL() {
        remoteURL="http://127.0.0.1:7101/TFAppRemote-ViewController-context-root/faces/adf.task-flow?adf.tfId=remoteCallTesting&adf.tfDoc=/remoteCallTesting.xml";
        return remoteURL;
    }
}

Code for remote_view1.jspx 
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
          xmlns:f="http://java.sun.com/jsf/core">
  <jsp:directive.page contentType="text/html;charset=UTF-8"/>
  <f:view>
    <af:document id="d1">
      <af:form id="f1">
        <af:panelGroupLayout id="pgl1">
          <af:outputText value="Remote view " id="ot1"/>
          <af:button text="button 1" id="b1" action="toTFCall"/>
        </af:panelGroupLayout>
      </af:form>
    </af:document>
  </f:view>
</jsp:root>

For calling bounded task flow using URL we can add a context parameter in web.xml for the URL.We can access the URL using #{initParam.remoteURL}

The url reference in the task flow
Though it shows an error message in the task flow diagram ,it works.