This project provides an example implementation of a web service that's compatible with X-Road version 6. The implementation is based on XRd4J library. The service contains a single class that implements two services:
getRandom
: returns a random number between 1-100helloService
: returns a hello message with the given name
Example has support for X-Road version 6.3 and 6.4 message formats.
- Java 6 or later
- Tomcat 6 or later
Setting up development environment is explained in wiki.
By default the example works with X-Road 6.3 messages. Use maven profile "xroad-6.4" to build the example so that it uses X-Road 6.4 messages:
mvn clean install -Pxroad-6.4
Differences are pretty small, e.g. "sdsbInstance" in 6.3 is called "xRoadInstance" in 6.4.
- Build the project and produce
example-adapter-0.0.3-SNAPSHOT.war
file. - Copy the file
tomcat.home/webapps
folder. - Start/restart Tomcat. The application is now accessible at:
http://localhost:8080/example-adapter-0.0.3-SNAPSHOT/Endpoint
The WSDL description is accessible at:
http://localhost:8080/example-adapter-0.0.3-SNAPSHOT/Endpoint?wsdl
N.B. If you want to connect the services to X-Road Security Server you must update your server's IP address / host name to the WSDL file. Look for the below line and replace the default URL with your server's IP / host name.
<soap:address location="http://localhost:8080/example-adapter-0.0.3-SNAPSHOT/Endpoint" />
Calling the service after installation when Tomcat is running.
SOAP request can be found in the examples
folder.
curl -d @getRandom.xml --header "Content-Type: text/xml" -X POST http://localhost:8080/Adapter/Endpoint
Example SOAP response can be found in the examples
folder.
SOAP request can be found in the examples
folder.
curl -d @helloService.xml --header "Content-Type: text/xml" -X POST http://localhost:8080/Adapter/Endpoint
Example SOAP response can be found in the examples
folder.