JEasy
GUI
Java
SWING
XML
               JEasy - a framework for JAVA applications using XML


 

Using the JEasy JEHttpConnector

Methodinvocation with http and XML

The JEHttpClient and the servlet JEHttpConnector are used to invoke methods over http.
The idea is like in SOAP to describe the method and a parameter in XML,
to send it it to a servlet over http and then to invoke the method at the server.
The client specifies the URL in the constructor of the JEHttpClient.
The next is to get a session from the servlet JEHttpConnector.
The simulation flag is for local testing without an application server.

     httpClient = new JEHttpClient("<id>HT_DVF</id><URL>http://127.0.0.1/JEasy/servlet/JEHttpConnector</URL>");
     httpClient.setSimulate(true);
     httpClient.setSession(true);
To call the service "revers" use
     httpClient.setParameters(this, "revers", "myString");
     Thread t = new Thread (httpClient);
     t.start();
The implementation in JEHttpClient let you define one service with one parameter.
The parameter should be an XML-String that can hold one or more variables in different tags.

The return of the server is a methodinvocation !

Implement your services in a class called JEDispatcher (see the template in examples).
The method dispatch is called by the servlet JEHttpConnector. In the example the
dispatcher is routing all calls to a class ExampleServer where the method is invoked.
The method revers :

public String revers(String s){
       String t=""
       for (int i = s.length();i != 0 ;i-- ){
           t += s.charAt(i-1);
       }
       String mi="<methodinvocation><JEObject>DF_HttpOut</JEObject>"
       mi += "<method>setText</method><param1Class>java.lang.String</param1Class>";
       mi +="<param1Value>"+t+"</param1Value></methodinvocation>";
       return(mi);
}
builds an XML string for methodinvocation that is returned to the JEHttpClient.

Start of the Tomcat application server

The following batch JEasy\Tomcat\bin\JEasyTomcatStart.bat will be called.
If the server doesn't work please make changes to the batchfile.

echo Starte Tomcat !
java -cp .;\jeasy\tomcat\bin\bootstrap.jar;\programme\javasoft\jre\1.3\lib\tools.jar;\JEasy\examples
                -Dcatalina.home="\jeasy\tomcat" org.apache.catalina.startup.Bootstrap start


Communication between the objects




JEasy Copyright @ 1997-2002 Harry Pfohl CBSE Convergent Business and Software Engineering GmbH
Projects and consulting Westernacher & Partner Unternehmensberatung AG www.westernacher.com