Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle Data Services
Viewing all articles
Browse latest Browse all 58696

LifeCycle DS ES communication with Tomcat WebServer

$
0
0

Hi,

    I have written a simple program to accept Name using Flex SDK 3.2 HttpService in Flex builder 3. Using LifeCycle DS ES to communicate with struts 1.2 on Web Server(Tomcat 5.0). My flex code runs and Struts code runs independently. The problem is when trying to send data from client to Server, it does not work. Below given are my client ans Server side code. Copy of services-config.xml & proxy-config.xml is same on both client side and server side. Please help me to run this code.

 

Client Side
========

 

hello.mxml
-----------------

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
  public function hello1():void{
   HelloCall.send();
  }
]]>
</mx:Script>

<mx:HTTPService id= "HelloCall" destination= "myHello">
    <mx:request xmlns= " ">
            <name>  {nameInput.text}</name>
    </mx:request>
</mx:HTTPService>

<mx:Label x= "312" y= "47" text= "Enter Name" fontSize= "20" />
<mx:TextInput id= "nameInput" x="260" y= "104" fontSize= "20" />
<mx:Button x= "301" y= "186" label= "Submit" fontSize= "20" click= "hello1();" />
<mx:Label x= "312" y= "285" text= "{HelloCall.lastResult.jlc.message}" fontSize= "20" />
</mx:Application>


Server-Side
============

proxy-config.xml
----------------

<?xml version="1.0" encoding="UTF-8"?>
<service id="proxy-service"
    class="flex.messaging.services.HTTPProxyService">

    <properties>
        <connection-manager>
            <max-total-connections>100</max-total-connections>
            <default-max-connections-per-host>2</default-max-connections-per-host >
        </connection-manager>
        <allow-lax-ssl>true</allow-lax-ssl>
    </properties>

    <adapters>
        <adapter-definition id="http-proxy" class="flex.messaging.services.http.HTTPProxyAdapter" default="true"/>
        <adapter-definition id="soap-proxy" class="flex.messaging.services.http.SOAPProxyAdapter"/>
    </adapters>

    <default-channels>
        <channel ref="my-http"/>
        <channel ref="my-amf"/>
    </default-channels>

  

<destination id="myHello">
    <properties>
         <url>/http://localhost:8000/JLCAPP/hello.jsp</url>
    </properties>
</destination>
</service>


struts-config.xml
------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd">

<struts-config> 

  <form-beans>

       <form-bean name= "helloForm" type= "org.apache.struts.action.DynaActionForm">
              <form-property name= "name" type="java.lang.String" />
       </form-bean>
   </form-beans>

  <global-forwards>
  <forward name= "success" path= "/index.jsp" />
  </global-forwards>
 

<action-mappings>
    <action path= "/hello" name= "helloForm" type="com.jlcindia.struts.HelloAction" input= "/hello.html" />

</action-mappings>

  <message-resources parameter="com.jlcindia.struts.ApplicationResources" />
</struts-config>

 

services-config.xml
-----------------------------

<?xml version="1.0" encoding="UTF-8"?>
<services-config>

    <services>
        <service-include file-path="remoting-config.xml" />
        <service-include file-path="proxy-config.xml" />
        <service-include file-path="messaging-config.xml" />
        <service-include file-path="data-management-config.xml" />
        <service class="fiber.data.services.ModelDeploymentService" id="model-deploy-service" />
       
        <!--
     Application level default channels. Application level default channels are
     necessary when a dynamic destination is being used by a service component
     and no ChannelSet has been defined for the service component. In that case,
     application level default channels will be used to contact the destination.
        -->  
        <default-channels>
           <channel ref="my-rtmp"/>
        </default-channels>

    </services>

    <security>
  <login-command class="flex.messaging.security.TomcatLoginCommand" server="Tomcat"/>       
        <!-- Uncomment the correct app server
        <login-command class="flex.messaging.security.JRunLoginCommand" server="JRun"/>
        <login-command class="flex.messaging.security.WeblogicLoginCommand" server="Weblogic"/>
        <login-command class="flex.messaging.security.WebSphereLoginCommand" server="WebSphere"/>
        -->
        <security-constraint id="basic-read-access">
            <auth-method>Basic</auth-method>
            <roles>
                <role>guests</role>
                <role>accountants</role>
                <role>employees</role>
                <role>managers</role>
            </roles>
        </security-constraint>
    </security>

    <!-- Socket servers that NIO endpoints all share -->
    <servers>
        <server id="my-nio-server" class="flex.messaging.socketserver.SocketServer">
        </server>
        <!--
        <server id="secure-nio-server" class="flex.messaging.socketserver.SocketServer">
            <properties>
                <keystore-file>{context.root}/WEB-INF/flex/localhost.keystore</keysto re-file>
                <keystore-password>changeit</keystore-password>
            </properties>
        </server>
        -->
    </servers>

    <channels>

        <!-- Servlet Based endpoints -->
        <channel-definition id="my-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://localhost:8400/JLCAPP/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>

        <channel-definition id="my-polling-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://localhost:8400/JLCAPP/messagebroker/amfpolling" class="flex.messaging.endpoints.AMFEndpoint"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-seconds>8</polling-interval-seconds>
            </properties>
        </channel-definition>

        <channel-definition id="my-http" class="mx.messaging.channels.HTTPChannel">
            <endpoint url="http://{server.name}:{server.port}/{context.root}/messagebroker/http" class="flex.messaging.endpoints.HTTPEndpoint"/>
        </channel-definition>

        <!-- Secure Servlet-based endpoints -->
        <channel-definition id="my-secure-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/amfse cure" class="flex.messaging.endpoints.SecureAMFEndpoint"/>
            <properties>
                <!--HTTPS requests on some browsers do not work when pragma "no-cache" are set-->
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>

        <channel-definition id="my-secure-http" class="mx.messaging.channels.SecureHTTPChannel">
            <endpoint url="https://{server.name}:{server.port}/{context.root}/messagebroker/https ecure" class="flex.messaging.endpoints.SecureHTTPEndpoint"/>
            <properties>
             <!--HTTPS requests on some browsers do not work when pragma "no-cache" are set-->
                <add-no-cache-headers>false</add-no-cache-headers>
            </properties>
        </channel-definition>

        <!-- NIO based endpoints -->
        <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
            <endpoint url="rtmp://{server.name}:2048" class="flex.messaging.endpoints.RTMPEndpoint"/>
            <properties>
                <idle-timeout-minutes>20</idle-timeout-minutes>
                <!-- for deployment on WebSphere, must be mapped to a WorkManager available in the web application's jndi context.
                <websphere-workmanager-jndi-name>java:comp/env/wm/MessagingWorkManage r</websphere-workmanager-jndi-name>
                -->
            </properties>
        </channel-definition>

        <channel-definition id="my-nio-amf" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:2888/nioamf" class="flex.messaging.endpoints.NIOAMFEndpoint"/>
            <server ref="my-nio-server"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>

        <channel-definition id="my-nio-amf-poll" class="mx.messaging.channels.AMFChannel">
            <endpoint url="http://{server.name}:2888/nioamfpoll" class="flex.messaging.endpoints.NIOAMFEndpoint"/>
            <server ref="my-nio-server"/>
            <properties>
                <polling-enabled>true</polling-enabled>
                <polling-interval-millis>3000</polling-interval-millis>
            </properties>
        </channel-definition>

        <channel-definition id="my-nio-http" class="mx.messaging.channels.HTTPChannel">
            <endpoint url="http://{server.name}:2888/niohttp" class="flex.messaging.endpoints.NIOHTTPEndpoint"/>
            <server ref="my-nio-server"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>

        <!-- Secure NIO based endpoints -->
        <!--
        <channel-definition id="secure-nio-amf" class="mx.messaging.channels.SecureAMFChannel">
            <endpoint url="https://{server.name}:2443/securenioamf" class="flex.messaging.endpoints.SecureNIOAMFEndpoint"/>
            <server ref="secure-nio-server"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>

        <channel-definition id="secure-nio-http" class="mx.messaging.channels.SecureHTTPChannel">
            <endpoint url="https://{server.name}:2443/secureniohttp" class="flex.messaging.endpoints.SecureNIOHTTPEndpoint"/>
            <server ref="secure-nio-server"/>
            <properties>
                <polling-enabled>false</polling-enabled>
            </properties>
        </channel-definition>
        -->
    </channels>

    <logging>
        <target class="flex.messaging.log.ConsoleTarget" level="Debug">
            <properties>
                <prefix>[LCDS] </prefix>
                <includeDate>false</includeDate>
                <includeTime>false</includeTime>
                <includeLevel>false</includeLevel>
                <includeCategory>false</includeCategory>
            </properties>
            <filters>
                <pattern>Endpoint.*</pattern>
                <pattern>Service.*</pattern>
                <pattern>Configuration</pattern>
                <pattern>SocketServer.*</pattern>
            </filters>
        </target>
    </logging>

    <system>
        <redeploy>
            <enabled>true</enabled>
            <watch-interval>20</watch-interval>
            <watch-file>{context.root}/WEB-INF/flex/services-config.xml</watch-fi le>
            <watch-file>{context.root}/WEB-INF/flex/proxy-config.xml</watch-file>
            <watch-file>{context.root}/WEB-INF/flex/remoting-config.xml</watch-fi le>
            <watch-file>{context.root}/WEB-INF/flex/messaging-config.xml</watch-f ile>
            <watch-file>{context.root}/WEB-INF/flex/data-management-config.xml</w atch-file>
            <touch-file>{context.root}/WEB-INF/web.xml</touch-file>
        </redeploy>
    </system>

</services-config>


HelloAction.java
------------------

package com.jlcindia.struts;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.*;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.DynaActionForm;

import java.io.PrintWriter;

public class HelloAction extends Action{

 

public ActionForward execute(ActionMapping am,ActionForm af,HttpServletRequest req,HttpServletResponse res) throws Exception {

 

    System.out.println("Hi am here");
    DynaActionForm daf= (DynaActionForm)af;
    String name= daf.get("name").toString();
    String msg= "Hello!"+ name + "Welcome to JLC FLex LCDS with HttpService";
    res.setContentType("text/html");
    PrintWriter out= res.getWriter();
    out.println("<message>" + msg + "</message>");
    out.close();
    return am.findForward("success");
}
}

 

Any Help will be appriciated.



Viewing all articles
Browse latest Browse all 58696

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>