Bonjour,
Je souhaiterais réaliser un service web java avec Eclipse. Je débute et pour l'instant, je souhaiterais simplement afficher une simple chaîne de caractères.
quand j'exécute mon client, j'ai toujours comme retour null , je ne comprends pas trop pourquoi
Voici mon wsdl :
Voici mon fichier java côté serveur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 <?xml version="1.0" encoding="UTF-8" standalone="no"?> <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://127.0.0.1:8080/LocalisationMagasins3/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LocalisationMagasins" targetNamespace="http://127.0.0.1:8080/LocalisationMagasins3/"> <wsdl:types> <xsd:schema targetNamespace="http://127.0.0.1:8080/LocalisationMagasins3/"> </xsd:schema> </wsdl:types> <wsdl:message name="VideRequest"> </wsdl:message> <wsdl:message name="ListeResponse"> <wsdl:part name="ListeResponse" type="xsd:string" /> </wsdl:message> <wsdl:portType name="LocalisationMagasins3"> <wsdl:operation name="ListerMagasins"> <wsdl:input message="tns:VideRequest"/> <wsdl:output message="tns:ListeResponse"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="LocalisationMagasins3SOAP" type="tns:LocalisationMagasins3"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <wsdl:operation name="ListerMagasins"> <soap:operation soapAction="http://127.0.0.1:8080/LocalisationMagasins3/ListerMagasins"/> <wsdl:input> <soap:body use="literal"/> </wsdl:input> <wsdl:output> <soap:body use="literal"/> </wsdl:output> </wsdl:operation> </wsdl:binding> <wsdl:service name="LocalisationMagasins3"> <wsdl:port binding="tns:LocalisationMagasins3SOAP" name="LocalisationMagasins3SOAP"> <soap:address location="http://127.0.0.1:8080/axis/services/LocalisationMagasins3SOAP"/> </wsdl:port> </wsdl:service> </wsdl:definitions>
et mon Stubclient
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 package com.tartempion.magasins; public class LocalisationMagasins3SOAPImpl implements com.tartempion.magasins.LocalisationMagasins3_PortType{ public java.lang.String listerMagasins() throws java.rmi.RemoteException { return "hello"; } }
Je ne pense pas que ce soit bien compliqué mais pour un novice comme moi en matière de service web, ça l'est!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.tartempion.magasins.client; import java.rmi.RemoteException; import javax.xml.rpc.ServiceException; public class stubClient { public static void main(String[] args) throws ServiceException, RemoteException{ LocalisationMagasins3_PortType service = new LocalisationMagasins3_ServiceLocator().getLocalisationMagasins3SOAP(); //System.out.println(service.listerMagasins()); System.out.println(service.listerMagasins()); } }
Merci d'avance
Partager