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 (1/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 (1/2)) in Ref. 1
* Task numbers below are based on the appearance order of tasks since the
numbers are not shown in Ref. 1.
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
Task 10 : Test the .NET Client
Task 11 : Create a Perl Client
Task 12 : Test the Perl Client
* The notes in this post cover the 1st half of Chapter 9, i.e. Task 1 - 6 only.
* No change has been made to the server definition file
(jboss402postgres.server) thus far.
Task 1 : Installing AXIS
- download "axis-bin-1_2_1.zip"
http://ws.apache.org/axis/
- make a new folder named "axis" under "C:\"
- unzip under "C:\axis"
Task 2 : Configuring AXIS with JBoss
- make a new folder "webapps" under "C:\jboss-4.0.2\server\postgres\deploy"
- copy "axis" folder under "C:\axis\axis-1_2_1\webapps" to
"C:\jboss-4.0.2\server\postgres\deploy\webapps"
==> "C:\jboss-4.0.2\server\postgres\deploy\webapps\axis" as a result.
- rename "axis" under "\server\postgres\deploy\webapps" to "axis.war"
==> "C:\jboss-4.0.2\server\postgres\deploy\webapps\axis.war" as a result.
- set Windows environment variables as follows;
AXIS_HOME C:\axis\axis-1_2_1
| AXIS_LIB C:\axis\axis-1_2_1\lib
| AXISCLASSPATH (see below)
| .;
| %AXIS_LIB%\axis.jar;
| %AXIS_LIB%\commons-discovery-0.2.jar;
| %AXIS_LIB%\commons-logging-1.0.4.jar;
| %AXIS_LIB%\jaxrpc.jar;
| %AXIS_LIB%\log4j-1.2.8.jar;
| %AXIS_LIB%\saaj.jar;
| %AXIS_LIB%\wsdl4j-1.5.1.jar
|
| Note : The values for "AXISCLASSPATH" should be in one line.
- start Eclipse and JBoss.
- go to each URL shown in Ref. 1 to test the configuration, i.e.;
http://127.0.0.1:8080/axis
http://127.0.0.1:8080/axis/services/AdminService?wsdl
http://127.0.0.1:8080/axis/servlet/AxisServlet
and
http://127.0.0.1:8080/axis/services/Version?method=getVersion
= the result of "getVersion" is;
<?xml version="1.0" encoding="UTF-8" ?>
| - <soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
| - <soapenv:Body>
| - <getVersionResponse
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
| <getVersionReturn xsi:type="xsd:string">Apache Axis version: 1.2.1 Built
on Jun 14, 2005 (09:15:57 EDT)</getVersionReturn>
| </getVersionResponse>
| </soapenv:Body>
| </soapenv:Envelope>
- re-boot Windows XP.
Task 3 : Create a Web Service named "MyStoreLoginService"
- create "deploy.wsdd" under "au.com.tusc.WebService"
= a part of the original descriptions has been revised as follows.
<?xml version="1.0" encoding="UTF-8"?>
| <deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
| <service name="MyStoreLoginService" provider="java:EJB">
|
| <!-- original - ->
| <parameter name="beanJndiName" value="StoreAccessLocal"/>
| <parameter name="homeInterfaceName"
value="au.com.tusc.session.StoreAccessLocalHome"/>
| <parameter name="remoteInterfaceName"
value="au.com.tusc.session.StoreAccessLocal"/>
| <!- - -->
| <!-- revised -->
| <parameter name="beanJndiName" value="StoreAccessBean"/>
| <parameter name="homeInterfaceName"
value="au.com.tusc.session.StoreAccessHome"/>
| <parameter name="remoteInterfaceName"
value="au.com.tusc.session.StoreAccess"/>
| <!-- -->
| <parameter name="allowedMethods" value="loginUser"/>
| <parameter name="jndiURL" value="jnp://localhost:1099"/>
| <parameter name="jndiContextClass"
value="org.jnp.interfaces.NamingContextFactory"/>
| </service>
| </deployment>
Task 4 : Deploy the Web Service
- deploy the WSDD in the command console using;java
org.apache.axis.client.AdminClient deploy.wsdd
= if error/failure, try following;java -cp %AXISCLASSPATH%
org.apache.axis.client.AdminClient deploy.wsdd
- on completion of the deployment, go to
http://127.0.0.1:8080/axis/servlet/AxisServlet
- click "(wsdl)" of "MyStoreLoginService"
(http://localhost:8080/axis/services/MyStoreLoginService?wsdl)
<?xml version="1.0" encoding="UTF-8" ?>
| - <wsdl:definitions
targetNamespace="http://127.0.0.1:8080/axis/services/MyStoreLoginService"
| xmlns:apachesoap="http://xml.apache.org/xml-soap"
|
xmlns:impl="http://127.0.0.1:8080/axis/services/MyStoreLoginService"
|
xmlns:intf="http://127.0.0.1:8080/axis/services/MyStoreLoginService"
| xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
| xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
| xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema">
| - <!--
| Apache Axis version: 1.2.1
| Built on Jun 14, 2005 (09:15:57 EDT) / [en]-(WSDL created by Apache Axis
version: 1.2.1
| Built on Jun 14, 2005 (09:15:57 EDT))
|
| -->
| - <wsdl:message name="loginUserRequest">
| <wsdl:part name="in0" type="soapenc:string" />
| <wsdl:part name="in1" type="soapenc:string" />
| </wsdl:message>
| - <wsdl:message name="loginUserResponse">
| <wsdl:part name="loginUserReturn" type="soapenc:string" />
| </wsdl:message>
| - <wsdl:portType name="StoreAccess">
| - <wsdl:operation name="loginUser" parameterOrder="in0 in1">
| <wsdl:input message="impl:loginUserRequest" name="loginUserRequest" />
| <wsdl:output message="impl:loginUserResponse" name="loginUserResponse" />
| </wsdl:operation>
| </wsdl:portType>
| - <wsdl:binding name="MyStoreLoginServiceSoapBinding"
type="impl:StoreAccess">
| <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
| - <wsdl:operation name="loginUser">
| <wsdlsoap:operation soapAction="" />
| - <wsdl:input name="loginUserRequest">
| <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://session.tusc.com.au" use="encoded" />
| </wsdl:input>
| - <wsdl:output name="loginUserResponse">
| <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
|
namespace="http://127.0.0.1:8080/axis/services/MyStoreLoginService"
use="encoded" />
| </wsdl:output>
| </wsdl:operation>
| </wsdl:binding>
| - <wsdl:service name="StoreAccessService">
| - <wsdl:port binding="impl:MyStoreLoginServiceSoapBinding"
name="MyStoreLoginService">
| <wsdlsoap:address
location="http://127.0.0.1:8080/axis/services/MyStoreLoginService" />
| </wsdl:port>
| </wsdl:service>
| </wsdl:definitions>
- save the wsdl as "MyStoreLoginService.wsdl" under "au.com.tusc.WebService"
Task 5 : Create a Web Service test client named "TestClient"
- add external jars (C:\axis\axis-1_2_1\lib) into the libraries as per the
steps in Ref. 1
axis.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
log4j-1.2.8.jar
saaj.jar
wsdl4j-1.5.1.jar
- generate SOAP clients
= select "1.2" as the "Type version" in the wizard.
= as "deploy.wsdd" has been modified, the file names generated in
"au.com.tusc.WebService" are different from Ref. 1
- add a new file named "TestClient.java" as per steps in Ref. 1
Task 6 : Test the TestClient
- remove AXIS 1.1 jar files in the Java Build Path Libraries before testing
= right click "MyStorePgSQL" in the Project Explorer of Eclipse, go to
Properties/Java Build Path/Libraries.
= remove following jar files in the libraries, which are from AXIS ver.1.1
AXIS/axis.jar - /c:\eclipse\plugins\org.apache.axis_1.1.0\axis.jar
AXIS/jaxrpc.jar - /c:\eclipse\plugins\org.apache.axis_1.1.0\jaxrpc.jar
AXIS/saaj.jar - /c:\eclipse\plugins\org.apache.axis_1.1.0\saaj.jar
AXIS/wsdl4j.jar - /c:\eclipse\plugins\org.apache.axis_1.1.0\wsdl4j.jar
- run "TestClient"
==> USERID recvd is : U2
jbosszone
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882723#3882723
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3882723
-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user