Apache Axis: Installation: Application Deployment: SOAP Message Monitoring #Java Short Notes

Apache Axis: Installation: Application Deployment: SOAP Message Monitoring ….. …. …. …. …. … … … …

  • Video Tutorial Explaining the Concepts in this Short-Note
  • JAX-RPC is about SOA, SOAP, XML, Remote communications
  • Apache Axis implements JAX-RPC API. Hence, when you code to this API, your application will run with other implementation of JAX-RPC API like Sun and BEA
  • Axis comes as axis.jar that implements JAX-RPC. jaxrpc.jar and saaj.jar files contain the declarations for JAX-RPC
  • From axis distribution you have to copy webapps/axis to your servlet container (tomcat 6.0/webapps/axis) or to your applications (to convert your current application to SOA application)
  • Axis needs an XML parser. You can use the default crimson parser that comes with jdk (from 1.4). Though Xerces parser is recommended for Apache Axis
  • To add Xerces parser to your axis installation use xml-apis.jar and xercesImpl.jar. Place them under axis/WEB-INF/lib directory. Or you can [point your CLASSPATH or AXISCLASSPATH environment variable to these jar files. Otherwise you will get erros like ClassNotFound errors relating to Xerces or DOM
  • jaxrpc.jar and saaj.jar contain javax packages. The way jdk loads jar files – based on the version these jar files may not get loaded sometimes. Sometimes axis (axis/happyaxis.jsp) may not find these jar files, copying these jar files from axis/WEB-INF/lib to CATALINA_HOME/common/lib may help. restarting Tomcat is required
  • Weblogic webservices.jar may conflict with Axis’ saaj.jar. Hence, you have to find a way out. Consult Axis and weblogic documentation
  • Test apache axis installation: Go to http://localhost:8080/axis – change the port as appropriate – If you do not see any error message – axis is working – you can click on the validation – you will see notes about your installation
  • Test a SOAP endpoint: Go to http://localhost/axis/services/Version?method=getVersion – you will see an XML output
  • Web services can be deployed as java files or jws web-services. To test a jws endpoint please go to – at http://localhost:8080/axis/EchoHeaders.jws?method=list and you will see the XML listing of your application headers
  • How to add your own Web Service:
    • Copy the classes and libraries of your new service into the Axis WAR directory tree
    • Tell the AxisEngine about your new services and point to the files. 1. submit XML deployment descriptor via the Admin web-service ( done with AdminClient or ant task)
  • You can deploy your classes under axis/WEB-INF/classes directory or you can deploy your application jar files under axis/WEB-INF/lib directory [in the Axis installation]
  • For your web-services to work java must find the jar files such as: axis.jar, commons-discovery.jar, commons-logging.jar, jaxrpc.jar, saaj.jar, log4j-1.2.8.jar (or another logging jar), and the XML parser jar (e.g., xerces.jar)
  • You can copy these jars under your web application server (WEB-INF/lib for Tomcat) so that deployed services get them, you can also bind them as part of your application, or you can use the following (or similar) environment variables
    Setting environment variables – temporary set up – dos commands
    set AXIS_HOME=c:axis
    set AXIS_LIB=%AXIS_HOME%lib
    set AXISCLASSPATH=%AXIS_LIB%axis.jar;%AXIS_LIB%commons-discovery.jar;
    %AXIS_LIB%commons-logging.jar;%AXIS_LIB%jaxrpc.jar;%AXIS_LIB%saaj.jar;
    %AXIS_LIB%log4j-1.2.8.jar;%AXIS_LIB%xml-apis.jar;%AXIS_LIB%xercesImpl.jar
    You can set them parmanently from: my computer -> properties -> advanced -> environment variables
  • Example use: java -cp %AXISCLASSPATH% …
  • You can provide everything from AXISCLASSPATH to CLASSPATH
  • Linux equivalent:
    set AXIS_HOME=/usr/axis
    set AXIS_LIB=$AXIS_HOME/lib
    set AXISCLASSPATH=$AXIS_LIB/axis.jar:$AXIS_LIB/commons-discovery.jar:
    $AXIS_LIB/commons-logging.jar:$AXIS_LIB/jaxrpc.jar:$AXIS_LIB/saaj.jar:
    $AXIS_LIB/log4j-1.2.8.jar:$AXIS_LIB/xml-apis.jar:$AXIS_LIB/xercesImpl.jar
    export AXIS_HOME; export AXIS_LIB;
    export AXISCLASSPATH
    or set them in your user configuration files
  • Deployment descriptor: when you unzip Axis, under axis/samples/stock – you can see deploy.wsdd as the deployment descriptor. Axis uses axis/WEB-INF/server-config.wsdd as the deployment descriptor to tell about it’s own states
  • In axis distribution there are some sample web-services under axis/samples – stock is one of them
  • To deploy stock as a web-service under tomcat you can execute
    java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd or
    java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd
    Depends how you configured your classpaths. You need all the jar files as mentioned before. Also you need mailapi.jar, activation.jar, and tools.jar in the classpath
  • Then you can execute the GetQuote operation of the stock service as following:
    java -cp .;%AXISCLASSPATH% samples.stock.GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX or
    java samples.stock.GetQuote -lhttp://localhost:8080/axis/servlet/AxisServlet -uuser1 -wpass1 XXX
    Depends how you configured your classpaths. You need all the jar files as mentioned before. Also you need mailapi.jar, activation.jar, and tools.jar in the classpath
    Additionally, you need to be in the right directory – i.e. just where samples folder starts. change directory to until samples.
  • How to convert your existing web-applications to axis-based SOA applications:
    • Add axis to your application. Add axis.jar, wsdl.jar, saaj.jar, jaxrpc.jar and the other dependent libraries to your application/WAR file
    • Copy Axis Servlet declarations and mappings from axis/WEB-INF/web.xml to your web.xml file
    • Build and deploy
    • Run AdminClient against your own webapp [using java org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService deploy.wsdd ][URL change will be required]
  • How to enable SOAP monitor:
    • Using SOAP monitor, you can monitor SOAP requests and responses
    • Go to $AXIS_HOME/webapps/axis and compile SOAPMonitorApplet.java . be careful about your classpath
    • Copy the class files to the root directory of the web application using the SOAP Monitor (e.g. …/tomcat 6.0/webapps/axis)
    • create a deploy-monitor.wsdd file with contents as below:

      v v

    • Deploy the SOAPMonitorService web service using java org.apache.axis.client.AdminClient -lhttp://localhost/axis/services/AdminService deploy-monitor.wsdd
    • For each service that is to be monitored, add request and response flow definitions to the service’s deployment descriptor and deploy (or redeploy) the service as follows:

    • Monitor the message flow using: http://localhost:8080/axis/SOAPMonitor

From: http://sitestree.com/?p=5082
Categories:Java Short Notes
Tags:
Post Data:2010-07-13 11:09:28

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada