Bonjour,

J'ai besoin d'aide pour la création et la consommation d'un webservice en c#.

j'ai un log d'un programme dont je n'ai pas accès et qui consomme une méthode d'un service web :

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
 
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.esri.com/schemas/ArcGIS/9.3">
    <soap:Body>
        <tns:GetDefaultInputFieldMappingResponse>
            <DefaultMapping xsi:type="tns:PropertySet">
                <PropertyArray xsi:type="tns:ArrayOfPropertySetProperty">
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Zone</Key>
                        <Value xsi:type="xsd:string">Zip, Zipcode, City, Zone</Value>
                    </PropertySetProperty>
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Street</Key>
                        <Value xsi:type="xsd:string">Address, Addr, Street</Value>
                    </PropertySetProperty>
                </PropertyArray>
            </DefaultMapping>
        </tns:GetDefaultInputFieldMappingResponse>
    </soap:Body>
</soap:Envelope>
Et je dois recréé de façon identique la même réponse mais dans un webservice différent.

J'ai pensé à deux solutions différentes :
- retourner directement un XML comme suit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
<DefaultMapping xsi:type="tns:PropertySet">
                <PropertyArray xsi:type="tns:ArrayOfPropertySetProperty">
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Zone</Key>
                        <Value xsi:type="xsd:string">Zip, Zipcode, City, Zone</Value>
                    </PropertySetProperty>
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Street</Key>
                        <Value xsi:type="xsd:string">Address, Addr, Street</Value>
                    </PropertySetProperty>
                </PropertyArray>
            </DefaultMapping>
- ou recréer tout le propertySet et le propertySetArray


La version XML me semble la plus rapide (sachant que je n'aurais jamais à modifier le contenu) mais je ne sais pas si c'est possible.


Mais surtout je voudrais savoir comment tester ce webservice en affichant la réponse comme celà :

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
 
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.esri.com/schemas/ArcGIS/9.3">
    <soap:Body>
        <tns:GetDefaultInputFieldMappingResponse>
            <DefaultMapping xsi:type="tns:PropertySet">
                <PropertyArray xsi:type="tns:ArrayOfPropertySetProperty">
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Zone</Key>
                        <Value xsi:type="xsd:string">Zip, Zipcode, City, Zone</Value>
                    </PropertySetProperty>
                    <PropertySetProperty xsi:type="tns:PropertySetProperty">
                        <Key>Street</Key>
                        <Value xsi:type="xsd:string">Address, Addr, Street</Value>
                    </PropertySetProperty>
                </PropertyArray>
            </DefaultMapping>
        </tns:GetDefaultInputFieldMappingResponse>
    </soap:Body>
</soap:Envelope>
Pour l'instant la seule chose que j'arrive à faire c'est de créer un petit site web qui consomme la méthode du webservice quand on clique sur un bouton.
J'obtiens bien un objet en réponse mais comment l'afficher comme ce que j'ai mis entre les balises codes ?