IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Appel de web service "minimaliste" sur base d'un exemple de message SOAP


Sujet :

C#

  1. #1
    Futur Membre du Club
    Inscrit en
    Juin 2005
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 10
    Points : 6
    Points
    6
    Par défaut Appel de web service "minimaliste" sur base d'un exemple de message SOAP
    Bonjour!

    Un petit casse-tête d'appel de web service pour bien commencer la journée.

    Je dois appeler le service suivant : https://ec.europa.eu/ws/sanco/xmlgatev2/acceptance?WSDL

    En créant le proxy, (ou en examinant le WSDL) on se rend compte que la description est minimaliste. On a quatres methodes qui acceptent toutes un type "system.object" difficile de faire plus vague.

    J'ai également recu avec la doc un exemple d'enveloppe soap :

    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
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
      <soapenv:Header>
        <sanco-xmlgate:Security xmlns:sanco-xmlgate="http://sasbos.ws.in.xmlgatev2.sanco.cec.eu">
          <UsernameToken>
            <Username></Username>
            <Password></Password>
          </UsernameToken>
        </sanco-xmlgate:Security>
      </soapenv:Header>
      <soapenv:Body>
        <sanco-xmlgate:callServices xmlns:sanco-xmlgate="http://sasbos.ws.in.xmlgatev2.sanco.cec.eu">
          <sanco-xmlgate:report document_key="05-part-671064" PDF_version="1" document_version="1" country="EU" xmlns:sanco-xmlgate="http://sawes.ws.in.xmlgatev2.sanco.cec.eu">
            <sanco-xmlgate:xmlgate>
              <sanco-xmlgate:project id="172"/>
              <sanco-xmlgate:service name="CreateEntryService" method="createXMLEntry"/>
              <sanco-xmlgate:complex_validation method="createXMLEntry" name="CreateEntryService"/>
            </sanco-xmlgate:xmlgate>
            <sanco-xmlgate:consumerComplaints user_id="sam" month="05" part_id="part-671064" organisation_id="EU-0-txQ">
              <sanco-xmlgate:complaint date="2011-05-11" id="A68321A0-945E-44C8-8323-74669871769F-0" reference="1727691-0">
                <sanco-xmlgate:consumer_country>AT</sanco-xmlgate:consumer_country>
                <sanco-xmlgate:organisation_id>EU-0-txQ</sanco-xmlgate:organisation_id>
                <sanco-xmlgate:distinction>Complaint</sanco-xmlgate:distinction>
                <sanco-xmlgate:trader_country>BE</sanco-xmlgate:trader_country>
                <sanco-xmlgate:selling_method>Face-to-face</sanco-xmlgate:selling_method>
                <sanco-xmlgate:advertising_method>Phone call</sanco-xmlgate:advertising_method>
                <sanco-xmlgate:sector>Consumer Goods</sanco-xmlgate:sector>
                <sanco-xmlgate:market>Food - Meat</sanco-xmlgate:market>
                <sanco-xmlgate:classification_level_1>Redress</sanco-xmlgate:classification_level_1>
              </sanco-xmlgate:complaint>
              <sanco-xmlgate:complaint date="2011-05-11" id="EEC9EC3E-0A65-4946-8232-0128107DD74E-0" reference="2294140-0">
                <sanco-xmlgate:consumer_country>BG</sanco-xmlgate:consumer_country>
                <sanco-xmlgate:organisation_id>EU-0-txQ</sanco-xmlgate:organisation_id>
                <sanco-xmlgate:distinction>Enquiry</sanco-xmlgate:distinction>
                <sanco-xmlgate:trader_country>BG</sanco-xmlgate:trader_country>
                <sanco-xmlgate:selling_method>Face-to-face: Discount store</sanco-xmlgate:selling_method>
                <sanco-xmlgate:advertising_method>Audiovisual (TV, etc.)</sanco-xmlgate:advertising_method>
                <sanco-xmlgate:sector>Financial Services</sanco-xmlgate:sector>
                <sanco-xmlgate:market>Financial Services - Credit (excluding mortgage/home loans)</sanco-xmlgate:market>
                <sanco-xmlgate:classification_level_1>Delivery of goods/ Provision of services</sanco-xmlgate:classification_level_1>
              </sanco-xmlgate:complaint>
            </sanco-xmlgate:consumerComplaints>
          </sanco-xmlgate:report>
        </sanco-xmlgate:callServices>
      </soapenv:Body>
    </soapenv:Envelope>
    Si on appelle le service avec soapui, ca marche, on a une réponse.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
       <soapenv:Body>
          <ns:callServicesResponse xmlns:ns="http://sasbos.ws.in.xmlgatev2.sanco.cec.eu">
             <ns:return>
                <sanco-xmlgate:response xmlns:sanco-xmlgate="http://sasbos.ws.in.xmlgatev2.sanco.cec.eu">
                   <sanco-xmlgate:message code="[SXG-005]">Your are not authenticated. Please send an email to <a href="mailto:sanco-xmlgate@ec.europa.eu">sanco-xmlgate@ec.europa.eu</a> with this error code.</sanco-xmlgate:message>
                   <sanco-xmlgate:AuthenticationResponseValue>false</sanco-xmlgate:AuthenticationResponseValue>
                </sanco-xmlgate:response>
             </ns:return>
          </ns:callServicesResponse>
       </soapenv:Body>
    </soapenv:Envelope>
    ce qui est normal car j'ai pas encore recu mes identifiants.

    En C#, j'ai essayé ca :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     SASBOServiceSoap11Binding tmp = new SASBOServiceSoap11Binding();
                tmp.Url = "https://ec.europa.eu/ws/sanco/xmlgatev2/acceptance?WSDL";
                string test = File.ReadAllText("test.xml");
                tmp.callServices(test);
    où test.xml contient l'exemple ci-dessous. Ca donne rien du tout. J'ai une erreur comme quoi ce n'est pas une enveloppe valable.

    Est-ce que quelqu'un saurait me dire comment on est sensé invoquer un tel service en .NET ?

    Merci d'avance.

  2. #2
    Membre expert
    Avatar de GuruuMeditation
    Homme Profil pro
    .Net Architect
    Inscrit en
    Octobre 2010
    Messages
    1 705
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : Belgique

    Informations professionnelles :
    Activité : .Net Architect
    Secteur : Conseil

    Informations forums :
    Inscription : Octobre 2010
    Messages : 1 705
    Points : 3 568
    Points
    3 568
    Par défaut
    Essaye sans le ?WSDL dans ton URL. WSDL c'est pour avoir des infos sur le webservice.

  3. #3
    Futur Membre du Club
    Inscrit en
    Juin 2005
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Juin 2005
    Messages : 10
    Points : 6
    Points
    6
    Par défaut
    Bonjour !

    Finalement vu l'inutilité du WSDL et la documentation se concentrant sur l'enveloppe SOAP, j'ai fait l'appel du web service à la main, en utilisant une webRequest et en créant un model objet qui, une fois sérialisé, me génère l'enveloppe soap correct.

    La même chose dans l'autre sens pour la réponse.

  4. #4
    Nouveau Candidat au Club
    Homme Profil pro
    Inscrit en
    Juillet 2012
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Malte

    Informations forums :
    Inscription : Juillet 2012
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    Hi! I am trying to connect with the same web service to ECCRS. Can you please explain the final code how you achieved this?

    I also use webRequest but get error: The remote server returned an error: (504) Gateway Timeout.

    Salut! Je suis en train de se connecter avec le service Web même ECCRS. Pouvez-vous s'il vous plaît expliquer le code final comment vous parvenus?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 12/06/2014, 08h34
  2. Réponses: 1
    Dernier message: 11/07/2013, 20h07
  3. Précision sur les appels de web service
    Par shinchan dans le forum Général Conception Web
    Réponses: 4
    Dernier message: 14/11/2012, 16h42

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo