Bonjour à tous,

Je sèche complètement sur un problème de connexion à un webservice. Je développe en vb.net et C#. J'ai un exemple en java qui fonctionne mais je n'arrive pas à le transcrire dans visual studio.

J'ai un certificat .pfx, un mot de passe et j'ai ajouté la référence aux webservices dans mon projet.

En java on a ceci :

Code Java : 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
            PersonServiceImplService connection = new PersonServiceImplService();
            PersonService services = connection.getPersonServiceImplPort();
 
            Client client = ClientProxy.getClient(services);
            Endpoint endpoint = client.getEndpoint();
 
            Map<String, Object> props = new HashMap<String, Object>();
 
            props.put("action", "Signature");
            props.put("user", "pheniks-test.lockataire");
            props.put("signaturePropFile","crypto.properties");
            props.put("passwordCallbackRef", new ServiceKeystorePasswordCallback());
            props.put("mustUnderstand", "false");
            props.put("timeToLive", "300");
            props.put("signatureKeyIdentifier", "DirectReference");
            props.put("allowMTOM", "true"); 
 
            WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(props);
            endpoint.getOutInterceptors().add(wssOut);
 
            GetPerson dataParams = new GetPerson();
 
            AbstractPrivacyIdentifier.CustomerInformations customer_information = new AbstractPrivacyIdentifier.CustomerInformations();
            String getPersonTicket = UUID.randomUUID().toString();
            …………
 
 
 
public class ServiceKeystorePasswordCallback implements CallbackHandler{
 
    private Map<String, String> passwords = new HashMap<String, String>();
 
    public ServiceKeystorePasswordCallback() {
        passwords.put("nom_d_utilisdateur", "mon_mot_de_passe");
    }
 
    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
 
	for (int i = 0; i < callbacks.length; i++) {
            WSPasswordCallback pc = (WSPasswordCallback) callbacks[i];
            String pass = passwords.get(pc.getIdentifier());
            if (pass != null) {
		pc.setPassword(pass);
		return;
            }
	}
    }
 
}

D'avance, je vous remercie pour votre aide ou vos pistes.

Olivier.