Question 1
J'ai une Form qui appelle le WebService présent dans la solution. J'ai utilisé une service reference. Le "problème" c'est que ça ne ressemble pas aux tuto présent sur ce site. Pourquoi j'ai un Service1SoapClient et comment fair epour avoir une écriture plus agréable?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
private void button1_Click(object sender, EventArgs e)
        {
            Hotline.Serveur.Service1SoapClient serv = new Hotline.Serveur.Service1SoapClient();
            Utilisateur u = serv.Authentification("sTest", "ab4f63f9ac65152575886860dde480a1");
        }
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
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Service1Soap" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                    bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                    maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                    useDefaultWebProxy="true">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None"
                            realm="">
                            <extendedProtectionPolicy policyEnforcement="Never" />
                        </transport>
                        <message clientCredentialType="UserName" algorithmSuite="Default" />
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://localhost:52485/Serveur.asmx" binding="basicHttpBinding"
                bindingConfiguration="Service1Soap" contract="Serveur.Service1Soap"
                name="Service1Soap" />
        </client>
    </system.serviceModel>
</configuration>
Question 2 :

Cet appel renvoie un Utilisateur mais c'est un Hotline.Seveur.Utilisateur (celui du webservice) et pas un Utilisateur comme celui dans la dll que le serveur utilise. Par exemple, je n'ai pas accès aux méthodes publiques.

J'aimerais que le client ne puisse pas modifier l'objet. Si je passe les attributs en privé le xml générés est Comment faire pour que ça marche?

Merci d'avance et bonnes fêtes