Bonjour,
je suis novice dans les wdsl.
Sous Eclipse je recupere un fichier wsdl d'une application.
Je genere tout ce qu'il faut avec le pluggin myspotter.wsdl2java.
J'arrive à ''utiliser'' le service mais je n'arrive pas à créer l'authentification qui me permet d'y acceder par les organizationHeader
securityHeader et sessionHeader.
Voici un bout de mon fichier wsdl.
et un bout de mon code
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 <?xml version="1.0" encoding="UTF-8"?> <wsdl:definitions targetNamespace="http://schemas.datastream.net/MP_functions" xmlns:tns="http://schemas.datastream.net/MP_functions" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:rqst0="http://schemas.datastream.net/MP_functions/MP0010_001" xmlns:resp0="http://schemas.datastream.net/MP_results/MP0010_001" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:hdr="http://schemas.datastream.net/MP_functions" xmlns:wssi="http://schemas.xmlsoap.org/ws/2002/04/secext" xmlns="http://schemas.xmlsoap.org/wsdl/"> <wsdl:types> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:import namespace="http://schemas.datastream.net/MP_functions" schemaLocation="../../schemas/headers.xsd"/><xsd:import namespace="http://schemas.xmlsoap.org/ws/2002/04/secext" schemaLocation="../../schemas/secext.xsd"/><xsd:import namespace="http://schemas.datastream.net/MP_functions/MP0010_001" schemaLocation="../../schemas/Work/MP0010_AddWorkRequest_001.xsd"/><xsd:import namespace="http://schemas.datastream.net/MP_results/MP0010_001" schemaLocation="../../schemas/Work/MP0010_AddWorkRequest_001_Result.xsd"/></xsd:schema> </wsdl:types> <wsdl:message name="AddWorkRequestRequestMsg"> <wsdl:part name="AddWorkRequestRequestMsg" element="rqst0:MP0010_AddWorkRequest_001"/> </wsdl:message> <wsdl:message name="AddWorkRequestResponseMsg"> <wsdl:part name="AddWorkRequestResponseMsg" element="resp0:MP0010_AddWorkRequest_001_Result"/> </wsdl:message> <wsdl:message name="organizationHeader"> <wsdl:part name="organizationHeader" element="tns:Organization"/> </wsdl:message> <wsdl:message name="securityHeader"> <wsdl:part name="securityHeader" element="wssi:Security"/> </wsdl:message> <wsdl:message name="sessionHeader"> <wsdl:part name="sessionHeader" element="tns:Session"/> </wsdl:message> <wsdl:message name="sessionScenarioHeader"> <wsdl:part name="sessionScenarioHeader" element="tns:SessionScenario"/> </wsdl:message>
Je ne sais pas si je suis très clair n'hésitez pas à me demander
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 AddWorkRequestServiceLocator loc = new AddWorkRequestServiceLocator(); //Creates the stub AddWorkRequestSoapBindingStub myStub = (AddWorkRequestSoapBindingStub) loc.getAddWorkRequestSoapBinding(); _MP0010_AddWorkRequest_001 request = new _MP0010_AddWorkRequest_001(); _WorkOrder wo = new _WorkOrder(); //WOID TYPE WOID_Type woid = new WOID_Type(); DESCRIPTION_Type desc = new DESCRIPTION_Type(); desc.setValue(description); woid.setDESCRIPTION(desc); woid.setAuto_generated(false); _JOBNUM num = new _JOBNUM (); num.setValue("10162"); woid.setJOBNUM(num); wo.setWORKORDERID(woid); wo.setEQUIPMENTID(equi); try { request.setWorkOrder(wo); } catch (RuntimeException e1) { // TODO Auto-generated catch block System.out.println("Response -->"); e1.printStackTrace(); System.out.println(myStub.addWorkRequestOp(request)); System.out.println(""); System.out.println("Response -->"); }
Merci pour votre aide
Partager