forked from fabienfelix/formation-programmation-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercice-soap.txt
28 lines (21 loc) · 959 Bytes
/
exercice-soap.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Projet service SOAP
- créer un project Dynamic Web Project (en cochant la génération du descripteur de déploiement - web.xml)
- créer une classe CurrencyConverter (dans un package correct) ainsi :
@WebService
public class CurrencyConverter {
private final double EXCHANGE_RATE_USD_EUR = 0.89f;
@WebMethod
public double usdToEur(double usd) {
return usd * EXCHANGE_RATE_USD_EUR;
}
}
- Click droit sur WEB-INF > New > Other > XML > XML File. Nommer le fichier 'sun-jaxws.xml'. Voici le contenu du fichier :
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>
<endpoint
name='CurrencyConverterWebService'
implementation='fr.lteconsulting.soapserver.CurrencyConverter'
url-pattern='/convert' />
</endpoints>
- WSDL wsgen
"\Program Files\Java\jdk1.8.0_102\bin\wsgen.exe" -verbose -cp . fr.lteconsulting.soapserver.CurrencyConverter -wsdl