Post Subject : Tutorial on J2EE using JBOSS-4.x, Eclipse-3.x, Lomboz-3.x and 
PostgreSQL-8.x on Windows XP

Ref. 1 : Tutorial for building J2EE Applications using JBOSS and ECLIPSE
         http://www.tusc.com.au/tutorial/html/chap9.html (Chapter 9 : Web 
Services (2/2))

Ref. 2 : Tutorial on J2EE using JBOSS, ECLIPSE and Lomboz (Forum on Ref. 1)
         http://www.jboss.org/index.html?module=bb&op=viewtopic&t=36910

=== Environment in use ;
- Windows XP SP2
- J2SDK 1.4.2_08
- Eclipse 3.0.2
- JBoss 4.0.2
- Lomboz 3.0.1 + emf-sdo-runtime-2.0.0
- PostgreSQL 8.0.3 (= DefaultDS)
- AXIS 1.2.1

Followings are some notes on Chapter 9 (Web Services (2/2)) in Ref. 1

* Task numbers are as below.

Task 1 : Installing AXIS
Task 2 : Configuring AXIS with JBoss
Task 3 : Create a Web Service named "MyStoreLoginService"
Task 4 : Deploy the Web Service
Task 5 : Create a Web Service Test Client named "TestClient"
Task 6 : Test the TestClient

Task 7 : Create a Web Client (Servlet named "Login")
Task 8 : Test the Web Client
Task 9 : Create a .NET Client named "DOTNETCLIENT" (using C#.Net)
Task 10 : Test the .NET Client

Task 11 : Create a Perl Client
Task 12 : Test the Perl Client

* The notes below cover the Task 7 - 10 only.
* No change has been made to the server definition file 
(jboss402postgres.server) thus far.

Task 7 : Create a Web Client (a Servlet named "Login")
(as per the steps in Ref. 1)
Note : switch "import" sections based on a selected "callWebService()" method, 
e.g.
   :import org.apache.axis.client.Call;
  | /*
  | // === activate for the 1st "callWebService()" methodimport java.net.URL;*/
  | 
  | // === activate for the 2nd "callWebService()" methodimport 
javax.xml.namespace.QName;
  | import org.apache.axis.client.Service;
  | public class Login extends HttpServlet {
  |   :
  |   :
  | /*
  | // === the 1st "callWebService()" method
  | private String callWebService() throws Exception {
  | 
  | // URL is used for creating the call, which uses the WSDL.  
  |    Call call = new Call( new 
URL("http://localhost:8080/axis/services/MyStoreLoginService?wsdl";) );
  |               
  | // Calls the object, passing in the username and passwd. The return value 
is stored as an object.
  |    String username = (String) call.invoke ("loginUser", new Object[] { new 
String("ANDY") , new String("PASSWD") } );
  |    return username;    
  |   }
  | */  
  | 
  | // === the 2nd "callWebService()" method
  | private String callWebService() throws Exception {
  | 
  |    // Endpoint is used for making the call
  |    String endpoint = 
"http://localhost:8080/axis/services/MyStoreLoginService";;
  | 
  |    // The Service object is the starting point for accessing the web 
service.
  |    Service service = new Service();
  | 
  |    // The call object is used to actually invoke the web service.
  |    Call call = (Call)service.createCall();
  | 
  |    // Sets the call objects endpoint address
  |    call.setTargetEndpointAddress(endpoint);
  | 
  |    // Sets the operation name associated with this Call object. 
  |    call.setOperationName(new QName("loginUser"));
  | 
  |    // Calls the object, passing in the username and passwd. The return 
value is stored as an object.
  |    Object returnValue = call.invoke(new Object[] { new String("ANDY") , new 
String("PASSWD") });
  |    return (String) returnValue;
  | 
  |   }
  | }
- start JBoss and deploy the web module ("Lomboz J2EE View" tag, "OnlineStore" 
(right click) and "deploy").

Task 8 : Test the Web Client
- go to "http://localhost:8080/OnlineStore/login"; for test.
= an error might occur as below;
   :
  | 00:16:57,625 INFO  [STDOUT] Entering Login.init()
  | 00:16:57,625 INFO  [STDOUT] Leaving Login.init()
  | 00:16:57,640 INFO  [STDOUT] Entering Login.processRequest()
  | 00:16:57,640 ERROR [[login]] Servlet.service() for servlet login threw 
exceptionjava.lang.NoClassDefFoundError: org/apache/axis/client/Service      at 
au.com.tusc.WebService.Login.callWebService(Login.java:107)
  |     at au.com.tusc.WebService.Login.processRequest(Login.java:77)
  |         :
= if error, undeploy "OnlineStore" or delete "OnlineStore.war" file from 
"/server/postgres/deploy" folder.
= then, copy and paste all files under "C:\axis\axis-1_2_1\lib" to 
"MyStorePgSQL/OnlineStore(WEB)/WEB-INF/lib" in Eclipse Package Explorer.

axis.jar
  | axis-ant.jar
  | commons-discovery-0.2.jar
  | commons-logging-1.0.4.jar
  | jaxrpc.jar
  | log4j-1.2.8.jar
  | log4j.properties
  | saaj.jar
  | wsdl4j-1.5.1.jar
= re-deploy and go to the URL.

Task 9 : Create a .NET Client named "DOTNETCLIENT"
- a platform used is C#.Net instead of VB.Net in Ref. 1.
- "add following URL of the Web Service" (as a test)
http://localhost:8080/axis/services/MyStoreLoginService?wsdl
- "btnGetID_Click()" is;
   :
  | private void btnGetID_Click(object sender, System.EventArgs e)
  |      {
  |        // string strResult;
  |        localhost.StoreAccessService objWebRef  = new 
localhost.StoreAccessService();
  | 
  |        // Call loginuser function and display the result ID to the 
lblOutput control
  |        lblOutput.Text = objWebRef.loginUser(TextBoxName.Text, 
TextBoxPassword.Text);
  |      }
  |    :
Task 10 : Test the .NET Client
(as per the steps in Ref. 1)


jbosszone


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3884065#3884065

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3884065


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to