Setting up axis2 soap server
I am trying to create a simple SOAP webservice (calculator) to learn the basics of this technology. I am new to SOAP so I have already done some things but I am not sure what to do next.
I have chosen a top-down approach, which means creating a wdsl file first and then generating the code automatically. I have created a wsdl file with the service description and used that to generate java files. I have it both in 1.1 and 2.0 format. To get 2.0 files I used the wsdl2java tool of axis2, for 1.1 I used java wsimport tool.
From the wsimport tool I got the following files:
- package-info.java
- ObjectFactory.java
- CalculatorService.java (name of my service)
- Calculator.java (name of my portType)
- Input.java (name of a complex type)
The wsdl2java tool gave me the following files:
- services.xml
- CalculatorService.wsdl
- Output.java (name of output element)
- Input.java (name of input element)
- cInput.jaba (name of input complex element)
- ExtensionMapper.java
- CalculatorServiceCallbackHandler.java
- CalculatorServiceMessageReceiverInOut.java
- CalculatorServiceSkeleton.java (includes implementation of inte开发者_开发问答rface)
- CalculatorServiceSkeletonInterface.java
- CalculatorServiceStub.java
In the wsdl2java files I guess I have everything I need excpept the server implementation. As for the wsimport ones they are missing an implementation and I am not sure where to add it. The server implementation is also missing.
At first I would like to run it as a local service (local server) to test that it is working and also write a client later.
I found an example of a server implementation here: In-process SOAP service server for Java. It seems quite simple and if possible I would like to use this approach. But I am not sure if it would work with the files I have generated (wsdl2java or wsimport). I also have an Apache server installed if it would be of use. So I am looking for advice, which set of files to use to set up the server and what would be the easiest way to do it.
Also I am wondering if the namespaces used in the wsdl file affect the service availability? Becuase they have to be URI-s but I do not have one for my service at the moment. So for targetNamespace, xmlns:tns, endpoint address, etc I used random URL-s. Would it work if I am trying to run it locally or would it create issues?
Ok, I think I found the solution myself.
Used Tomcat server and eclipse axis2 plugins to get the server and client working.
This was a good tutorial in my opinion: http://eclipse.dzone.com/articles/web-services-development-with-
精彩评论