Presentation is loading. Please wait.

Presentation is loading. Please wait.

Module 6 Practical part: Creation of X-Road dataservice and client based on WSDL (on Java platform) Name Date.

Similar presentations


Presentation on theme: "Module 6 Practical part: Creation of X-Road dataservice and client based on WSDL (on Java platform) Name Date."— Presentation transcript:

1 Module 6 Practical part: Creation of X-Road dataservice and client based on WSDL (on Java platform) Name Date

2 Creation of X-Road dataservice
For creating an X-Road dataservice, we use Eclipse web service creation wizard, which generates a server source code for the X-Road dataservice. We activate the web service creation wizard: Select a WSDL file (example: person_register.wsdl) Select in the menu: File -> New -> Web Service Click ‘Next>’ Käesolevas peatükis loome eelnevalt valmistatud X-tee andmeteenuse WSDL-kirjelduse baasil uue X-tee andmeteenuse ja testime X-tee teenust erinevate vahenditega. Kasutatav meetod: “Top Down“ - ehk olemasoleva WSDL-i baasil genereerime Java koodi, mida hiljem saab käsitsi muuta vastavalt vajadusele.

3 In the following form: Change: ‘Web service runtime’ value: Apache CXF 2.x Click ‘Next’

4 If necessary, change ‘Package Name’ so that it would match Java rules (the name generated automatically from namespace may not be suitable, in which case a relevant error message is displayed) Click: Next

5 Change the default values. Tick the following check boxes:
‘Enable processing of Implicit SOAP headers’ ‘Enable auto name resolution’ Select: Finish

6 Check the generated dataservice
A new dataservice is generated. To make sure it has happened, check whether: the source code of the service has been generated in the src folder; a new Java package has been created, e.g.: ee.x_road.persons_register (name depends on WSDL); check the dataservice endpoint and WSDL: The generated service has been activated and responds at the address: For validating the dataservice, enter the mentioned address into the browser; information of the created dataservice is displayed: endpoint address of the dataservice WSDL address of the dataservice (link to WSDL) Check whether the WSDL address of the dataservice is displayed when clicking on the WSDL link e.g.:  This WSDL address is later used for the setup of the service in the X-Road security server and testing through SoapUI.

7 Adaptation of generated X-Road dataservice code
X-Road header fields X-Road dataservice must return the same X-Road header field values in response. To realise this, change the file <PersonRegister>Impl.java, method: <personList> (NB! Instead of <PersonRegister> and <personList>, each developer has their own name based on WSDL used when creating the dataservice.) The following code lines may be added for copying the header fields:             // X-road: request SOAP headers must be copied to response             protocolVersion1.value = protocolVersion;             client1.value = client;             userId1.value = userId;             id1.value = id;             service1.value = service; From the same file, remove the generated code which fills response header fields with generated data (when changing the file, example is provided in the sample file PersonRegisterImpl.java).

8 Data of request response
The generated X-Road dataservice returns constant generated data in a request response In real life, generated data must be removed from the code and relevant database request must be used for obtaining the data For testing, data generated in the response may also be used or the data can be changed manually

9 Creation of X-Road Java client application
Creation of a Java client application: Create a new project in Eclipse, as described in clause 5.1, only with another project name. Copy the created WSDL file from the previous project also to the new project Activate web service wizard: Select the WSDL file and select in the menu: Web Services -> Generate Client:

10 Change: ‘Web service runtime’ value: Apache CXF 2.x
Click: ‘Next’

11 If necessary, change ‘Package Name’ so that it would match Java rules
(a name generated automatically from namespace may not be suitable, in which case a relevant error message is displayed) Click: Next

12 Muuda vaikimisi väärtused, märkides ära järgmised märkeruudud:
„Enable processing of Implicit SOAP headers“ „Enable auto name resolution“ Vali: Finish

13 Java code of dataservice client was generated. Now check whether:
the generated code is located in the src folder sample challenge of service is implemented in main() method of <PersonRegister_PersonRegister>SOAP_Client.java file, where PersonRegister is replaced by the name of a specific dataservice depending on WSDL. Data objects initialised with the generated data are created for challenging the service. Activation of service client programme: Select file *SOAP_Client.java Select in the menu: Run as / Java Application Check the programme output in the console

14 Testing Java client through X-Road security server
Adapt *SOAP_Client.java generated code, making the content of the X-Road header fields accurate with the generated data (as in previous testing with SoapUI program) if necessary, see the sample file PersonRegister_PersonRegisterSOAP_Client.java

15 Thank You! First name Surname firstname.surname@amet.ee
The training materials for developers of X-Road interfaces have been compiled with funding from the structural funds support scheme “Raising Public Awareness about the Information Society” of the European Regional Development Fund.


Download ppt "Module 6 Practical part: Creation of X-Road dataservice and client based on WSDL (on Java platform) Name Date."

Similar presentations


Ads by Google