Bonjour,
Je cherche à implémenter un web service tout simple basé sur jax-ws.
La compilation fonctionne mais au déploiement j'ai l'erreur suivante :
Voici mon fichier wsdl :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 port component:"AlarmBean" - wsdl port:{http://tph.rmt.net/jws/alarm/}AlarmBeanPort is not found in wsdl.
Pour générer mon web service, je part de ce fichier wsdl et j'utilise les taches ant weblogic wsdlc et jwsc:
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 <definitions name="AlarmService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mcin="http://tph.rmt.net/jws/alarm/schema/create/in/" xmlns:mcout="http://tph.rmt.net/jws/alarm/schema/create/out/" xmlns:jws="http://tph.rmt.net/jws/alarm/" targetNamespace="http://tph.rmt.net/jws/alarm/"> <types> <xs:schema> <xs:import namespace="http://tph.rmt.net/jws/alarm/schema/create/in/" schemaLocation="alarm/in/AlarmCreateIn.xsd" /> <xs:import namespace="http://tph.rmt.net/jws/alarm/schema/create/out/" schemaLocation="alarm/out/AlarmCreateOut.xsd" /> </xs:schema> </types> <message name="MsgAlarmCreateIn"> <part name="parameters" element="mcin:AlarmCreateIn" /> </message> <message name="MsgAlarmCreateOut"> <part name="parameters" element="mcout:AlarmCreateOut" /> </message> <portType name="AlarmBeanPortType"> <operation name="persist"> <input message="jws:MsgAlarmCreateIn" /> <output message="jws:MsgAlarmCreateOut" /> </operation> </portType> <binding name="AlarmBinding" type="jws:AlarmBeanPortType" > <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="persist"> <soap:operation soapAction="urn:#persist" /> <input> <soap:body use="literal" namespace="http://tph.rmt.net/jws/alarm/"/> </input> <output> <soap:body use="literal" namespace="http://tph.rmt.net/jws/alarm/"/> </output> </operation> </binding> <service name="AlarmService" > <port name="AlarmBeanPortType" binding="jws:AlarmBinding" > <soap:address location="http://localhost:7001/tph/AlarmService"/> </port> </service> </definitions>
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 <wsdlc srcWsdl="${build.wsdl.dir}/AlarmWS.wsdl" destJwsDir="${build.artifacts.jar.dir}" destimpldir="${build.artifacts-impl.jar.dir}" packagename="net.rmt.tph.jws.alarm"/>Voici mon implémentation du service
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <jwsc srcdir="src" destdir="${ear.dir}"> <module name="webservices.jar" explode="true"> <jws type="JAXWS" file="${top.tph.path}/alarm/jwsendpoint/AlarmBean.java" compiledWsdl="${build.artifacts.jar.dir}/AlarmWS_wsdl.jar"> <WLHttpTransport contextPath="tph" serviceUri="AlarmService" portName="AlarmBeanPortType" /> </jws> </module> </jwsc>
L'interface générée par wsdlc :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 @Stateless @WebService(endpointInterface = "net.tph.rmt.jws.alarm.AlarmBeanPortType") public class AlarmBean implements AlarmBeanPortType { public AlarmCreateOut persist(AlarmCreateIn in) { return new AlarmCreateOut(); } }
Est ce correct? Ai je besoin du fichier de description webservice.xml sachant que j'utilise jax-ws?
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 @WebService( name="AlarmBeanPortType", targetNamespace="http://tph.rmt.net/jws/alarm/", wsdlLocation="/wsdls/AlarmWS.wsdl") @SOAPBinding(style=SOAPBinding.Style.RPC, use=SOAPBinding.Use.LITERAL) public interface AlarmBeanPortType { @WebMethod( action="urn:#persist", operationName="persist") @WebResult(name="parameters") public net.rmt.tph.jws.alarm.schema.create.out.AlarmCreateOut persist(@WebParam(name="parameters") net.rmt.tph.jws.alarm.schema.create.in.AlarmCreateIn parameters) ; }
Merci pour votre aide.
Partager