Translate

miércoles, 4 de febrero de 2015

Webservice Example with axis2 part 4: How to create the web service using maven and the template class

This is the fourth post to show how to create a web service with a simple operation and a complex operation based on Axis2.

In this series of posts we are going to show this points:




  • Setting up the environtment
  • Understanding  a web service
  • How to define the web services operations in a template class
  • How to create the  web service using maven and the template class
  • How to package the web service using maven and deploy it.
  • How to test the deployed web service using maven.


In this post we are going to learn about how to use maven to create a WSDL file based on the template class created in the part 3 of these seral of posts. And after that based on the created WSDL we are going to create the basic architeture of the web service generating the server side stubs also with maven.

Note: You need to have medium knowledge of apache maven, especially with maven profiles and maven plugins.

With maven you can build the pom.xml but you can build a profile also, this profile contains a subset of tasks to be executed.

The maven plugin that we are going to use are:


  • maven-compiler-plugin: To compile the template class and all classed used by it.
  • axis2-java2wsdl-maven-plugin: To create the WSDL based on template class
  • axis2-wsdl2code-maven-plugin: To create the server side stubs based on the WSDL
  • maven-antrun-plugin: Move and rename the generated files.



To do this tasks we only need to modify the pom.xml adding to this profile the 4 plugins. Look at the pom.xml file from lines 290 to 413 and execute the next maven command.

mvn -P java2wsdl2code clean compile -e

-P parameter means that we are going to appy the java2wsdl2code.
- e parameter means more detailed message if an error happen.

The first part of the profile consists on compile the template class created in the step 3 of this tutorial series. It compile the class Axis2ServiceExample, and his related classes ComplexOperationResponse and Axis2ServiceException. Here I had added some configuration to use de compile plugin in the generate-sources phase and avoid the default phase of this plugin (compile phase)



The second plugin is one of the important plugins, axis2-java2wsdl-maven-plugin this plugin generates the WSDL file and service-xml based on the compiled classes by the last plugin. The input parameters are

  1. the main class to read Axis2ServiceExample
  2. the target name space for that webservice.
  3. The path and name of the WSDL where is going to be generated.
--
--

At this point in the target folder should be generated an Axis2ServiceExample.wsdl and a services.xml. Now we are going to generate the server Stubs based on this WSDL file. These server stubs are .class and .java files and all the generated classes will be the architecture of the web service. The databinding framework selected to create the architecture is XMLBEAMS the axis2-wsdl2code plugin provides the next posible framework options XMLBEANS, ADB, AXIOM and JIBX.

The input parameters applied to this plugin are:

  1. packageName: The package where the class files will be created,
  2. wsdlFile: Location of the WSDL file generated in the last step.
  3. databindingName: The Databinding framework selected
  4. outputDirectory: Directory where the source files will be created
  5. generateServerSide: True to generate server side stubs of the WSDL, false to generated clients of the WSDL.
  6. generateServerSideInterface
  7. generateServicesXml
  8. generateServicesXml: Specify the name space.

--
--
Besides the java classes and the source code, a build.xml file is generated it will be used in the next maven pluglin, it will help to package all the classes generated.


The last plugin aplied is the maven-antrun-plugin, is only a special plugin to apply ant sentences in a maven phase. The objetive of this step is only execute the build.xml file generated in the last step and move the files generated to the build directory.

--
--

To execute all of this actions yoy have to execute the next command:

mvn -P  java2wsdl2code clean compile 

We are going execute the clean and copile phases executing the java2wsdl2code  profile, and after maven execution the results are in the target directory.



You will find the source code generated in target/wsdl2java/src folder, the compiled classes in target/build folder and the generated artifacts in wsdl2java folder.

Now we have to copy

  1. The Axis2ServiceExample.wsdl and service.xml to the [ProjectHome]/src/main/resources. This files are needed to describe the web service created based on the template file
  2. The Axis2ServiceExampleServerStubs.jat and XBeans-packaged.jar to [ProjectHome]/lib foder. This files cotains all the classes generated based on the template file 
  3. Axis2ServiceExampleSkeleton.java to [ProjectHome]\src\main\java\com\antuansoft\services\template this file is  needed to add functionaly to the web service operations.

Now we are ready to codify, we will see in the next chapter.









53 comentarios:

  1. this is really nice information of how to use the HTML coding for template classes.
    Java training in Chennai

    ResponderEliminar
  2. Wow.. Thanks much for sharing.. My friend also recommended you so that i can have a helping hand to make my blog as effective as possible.
    Office Interior Designers in Coimbatore

    ResponderEliminar
  3. this is really nice information of how to use the HTML coding for template classes.

    PHP Training Institute in Chennai

    ResponderEliminar
  4. I am a regular reader of your blog and being students it is great to read that your responsibilities have not prevented you from continuing your study and other activities. Love
    angularjs online Training

    angularjs Training in marathahalli

    angularjs interview questions and answers

    angularjs Training in bangalore

    angularjs Training in bangalore

    angularjs online Training

    ResponderEliminar
  5. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us
    Java training in Chennai | Java training institute in Chennai | Java course in Chennai

    Java training in Bangalore | Java training institute in Bangalore | Java course in Bangalore

    Java online training | Java Certification Online course-Gangboard

    Java training in Pune

    ResponderEliminar
  6. This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me.

    rpa training in chennai
    rpa training in bangalore
    rpa course in bangalore
    best rpa training in bangalore
    rpa online training

    ResponderEliminar
  7. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    python course in pune
    python course in chennai
    python course in Bangalore

    ResponderEliminar
  8. Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
    Best Devops Training in pune
    excel advanced excel training in bangalore
    Devops Training in Chennai

    ResponderEliminar
  9. A very nice guide. I will definitely follow these tips. Thank you for sharing such detailed article. I am learning a lot from you.

    python training Course in chennai
    python training in Bangalore
    Python training institute in bangalore

    ResponderEliminar
  10. Your very own commitment to getting the message throughout came to be rather powerful and have consistently enabled employees just like me to arrive at their desired goals.
    Online DevOps Certification Course - Gangboard
    Best Devops Training institute in Chennai

    ResponderEliminar
  11. When I initially commented, I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same comment. Is there any way you can remove people from that service? Thanks.

    AWS Training in Bangalore | Amazon Web Services Training in Bangalore
    Amazon Web Services Training in Pune | Best AWS Training in Pune
    AWS Online Training | Online AWS Certification Course - Gangboard
    Top 110 AWS Interview Question and Answers

    ResponderEliminar
  12. Nice tutorial. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated tutorials…
    Devops Training in Bangalore
    Best Devops Training in pune

    ResponderEliminar
  13. Thanks For Sharing the Information The Information Shared Is very valuable Please Keep Updating us Time Just Went On Reading The article Python Online training Hadoop Online training Data Science Online training AWS Online training

    ResponderEliminar
  14. Attend The Python training in bangalore From ExcelR. Practical Python training in bangalore Sessions With Assured Placement Support From Experienced Faculty. ExcelR Offers The Python training in bangalore.
    python training in bangalore

    ResponderEliminar
  15. Nice Post! Thank you for sharing very good post, it was so Nice to read and useful to improve my knowledge as updated one, keep blogging.
    Angular js Training in Electronic City

    ResponderEliminar
  16. Hi,
    Good job & thank you very much for the new information, i learned something new. Very well written. It was sooo good to read and usefull to improve knowledge. Who want to learn this information most helpful. One who wanted to learn this technology IT employees will always suggest you take python training in pune. Because Python course in pune is one of the best that one can do while choosing the course.

    ResponderEliminar
  17. Meet Bosnia is Travel agent located in Sarajevo, specialized in tours in Bosnia and Herzegovina and Balkan region. Years of experience is behind us and lots of satisfied customers, what is reason to continue in doing thing we love. balkan packages

    ResponderEliminar
  18. I just got to this amazing site not long ago. I was actually captured with the piece of resources you have got here. Big thumbs up for making such wonderful blog page!highly informative and professionally written and I am glad to be a visitor of this perfect blog, thank youJava training in Chennai

    Java Online training in Chennai

    Java Course in Chennai

    Best JAVA Training Institutes in Chennai

    Java training in Bangalore

    Java training in Hyderabad

    Java Training in Coimbatore

    Java Training

    Java Online Training

    ResponderEliminar
  19. I am a regular reader of your blog and being students it is great to read that your responsibilities have not prevented you from continuing your study and other activities. Thanks for sharing this information.

    angular js training in chennai

    angular training in chennai

    angular js online training in chennai

    angular js training in bangalore

    angular js training in hyderabad

    angular js training in coimbatore

    angular js training

    angular js online training


    ResponderEliminar

  20. I recently came across your article and have been reading along. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.Your post is just outstanding! thanks for such a post,its really going great and great work.You have provided great knowledge
    Thanks for sharing an informative blog keep rocking bring more details.I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!


    Azure Training in Chennai

    Azure Training in Bangalore

    Azure Training in Hyderabad

    Azure Training in Pune

    Azure Training | microsoft azure certification | Azure Online Training Course

    Azure Online Training

    ResponderEliminar
  21. Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work
    DevOps Training in Chennai

    DevOps Online Training in Chennai

    DevOps Training in Bangalore

    DevOps Training in Hyderabad

    DevOps Training in Coimbatore

    DevOps Training

    DevOps Online Training

    ResponderEliminar
  22. Excellent Blog! I would Thanks for sharing this wonderful content.its very useful to us.This is incredible,I feel really happy to have seen your webpage.I gained many unknown information, the way you have clearly explained is really fantastic.keep posting such useful information.
    Full Stack Training in Chennai | Certification | Online Training Course
    Full Stack Training in Bangalore | Certification | Online Training Course

    Full Stack Training in Hyderabad | Certification | Online Training Course
    Full Stack Developer Training in Chennai | Mean Stack Developer Training in Chennai
    Full Stack Training

    Full Stack Online Training


    ResponderEliminar
  23. Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care and we take your comments to heart.As always, we appreciate your confidence and trust in us



    AWS Course in Bangalore

    AWS Course in Hyderabad

    AWS Course in Coimbatore

    AWS Course

    AWS Certification Course

    AWS Certification Training

    AWS Online Training

    AWS Training

    ResponderEliminar
  24. very nice blogs!!! i have to learning for lot of information for this sites...Sharing for wonderful information.Thanks for sharing this valuable information to our vision. You have posted a trust worthy blog keep sharing

    IELTS Coaching in chennai

    German Classes in Chennai

    GRE Coaching Classes in Chennai

    TOEFL Coaching in Chennai

    spoken english classes in chennai | Communication training


    ResponderEliminar
  25. Am Dhinesh,Am really impressed about this blog because this blog is very easy to learn and understand clearly.This blog is very useful for the college students and researchers to take a good notes in good manner.
    For more..
    Data Science Training In Chennai

    Data Science Online Training In Chennai

    Data Science Training In Bangalore

    Data Science Training In Hyderabad

    Data Science Training In Coimbatore

    Data Science Training

    Data Science Online Training

    ResponderEliminar
  26. Appreciate this post. Thanks to sharing a very informative great blog about student club

    ResponderEliminar
  27. Is this blog important for business? That's a question that I get asked quite frequently and the answer is a resounding yes! This blog has been one of the most powerful tools to increase my online sales dramatically. It's not a blog where I post sad stories or thoughts about my last vacation or what I ate for dinnerBuy instagram accounts the night before. Rather, it's a place where I post up relevant articles related to my business that are regularly monitored and updated so that my visitors always stay well informed and up to date on what I'm doing and why.
    Buy pinterest accounts

    ResponderEliminar
  28. This post is so interactive and informative.keep update more information...
    German Classes in Tambaram
    German Classes in chennai

    ResponderEliminar
  29. شركة نقل عفش بتبوك
    شركة نقل العفش بتبوك …. يعتبر نقل العفش إحدى الصعوبات التي يواجهها الشخص من اتفاقية مع سيارات النقل وعمالة للانتقال من مكان إلى آخر ، وقد يكون العمل بدون تدريب ويخدش ويضر العفش ، لذلك في أن أحسن الحلول هو الاتفاق مع شركة نقل العفش بتبوك للقيام بعملية النقل لما تتمتع به من خبرة وكفاءة كبيرة في هذا المجال حيث تعتمد على عمالة مدربة وتستخدم أحدث الأجهزة لنقل العفش بدون تكسير أو خدش.

    شركة نقل عفش بتبوك
    شركة تركيب طارد الحمام بتبوك
    شركة مكافحة الحمام بتبوك
    شركة دهانات بتبوك
    مؤسسة النجاح
    مؤسسة النجاح
    مؤسسة النجاح
    مؤسسة النجاح

    ResponderEliminar
  30. "Upgrade your digital world with AM Computers LLC - Experience superior performance, shop now and Buy Laptop Online UAE!"

    ResponderEliminar
  31. "Experience the smooth sophistication of A2Z Tobacco with a touch of luxury - ignite your senses with Cognac Backwoods today!"

    ResponderEliminar
  32. "Experience the ultimate in luxury with Diamond Swisher - elevate your smoking experience with A2Z Tobacco's unrivaled craftsmanship."

    ResponderEliminar
  33. "Protect your property with Taylor Made Solutions, the leading experts in Alarms Exeter . Experience peace of mind with our advanced alarm systems tailored to your security needs."

    ResponderEliminar
  34. Experience peace of mind with Invigilo's cutting-edge Video Surveillance solutions – Watch over what matters most, effortlessly.

    ResponderEliminar
  35. Thank you for sharing your knowledge. The blog was beneficial. Visit the website: CURTAIN WALLS in Fujairah

    ResponderEliminar
  36. Nice informative content. Thanks for sharing the valuable information.

    Upgrade your hygiene routine with the cutting-edge Applied Physics USA Disinfectant Fogger – harnessing the power of advanced technology and fine-tuned precision, just like our innovative Polystyrene Beads, for a cleaner and safer environment. Elevate your space with the perfect synergy of science and protection – invest in Applied Physics USA today!

    ResponderEliminar
  37. "Elevate your outreach game with 1st Position Ranking - where precision meets impact. Unleash the potential of your brand through our Email Marketing Strategys, forging connections and securing your position at the forefront of success!"

    ResponderEliminar

  38. "Transform your locks into masterpieces at The Head Game, the premier destination for exquisite hair transformations in Hair Salons In Rosevillen."

    ResponderEliminar
  39. "Unlock your path to financial freedom with My Off Plan Investment - where strategic foresight meets lucrative opportunities, shaping your wealth journey."

    ResponderEliminar

  40. "Unlock your full potential with The Head Game: where strategy meets victory in every head game challenge!"

    ResponderEliminar
  41. "Elevate your wellness journey with Karatom Point – where quality meets commitment, proudly partnering with happy hippo herbals for your holistic needs!"

    ResponderEliminar
  42. "Andtowing: Your trusted ally for tow truck in roseville. Experience peace of mind on the road with Andtowing – your reliable solution for prompt assistance and expert towing in Roseville's neighborhoods."

    ResponderEliminar
  43. "Unlock the potency of relaxation with Karatom Point: Your trusted destination for premium blends, including the renowned mit 45."

    ResponderEliminar