Pages

[Débutant] Communication avec webservice sujet

vendredi 31 janvier 2014




Bonjour,

Je doit développer une petite application (windows form) de test pour savoir si j'arrive à communiquer avec un webservice.

J'arrive à rajouter le webservice dans mons projet sans problème, c'est après que ca se corse.

Un dev m'a déposé un webservice, et m'a donné le wsdl :

Code:


- <wsdl:types xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <xsd:schema>
  <xsd:import schemaLocation="V1.xsd1.xsd" namespace="http://WSSTestServiceLib/WSSTestOutboundService/V1" />
  </xsd:schema>
  </wsdl:types>
- <wsdl:message name="getGreetingRequestMsg">
  <wsdl:part name="getGreetingParameters" element="xsns:getGreeting" xmlns:xsns="http://WSSTestServiceLib/WSSTestOutboundService/V1" />
  </wsdl:message>
- <wsdl:message name="getGreetingResponseMsg">
  <wsdl:part name="getGreetingResult" element="xsns:getGreetingResponse" xmlns:xsns="http://WSSTestServiceLib/WSSTestOutboundService/V1" />
  </wsdl:message>
- <wsdl:portType name="WSSTestOutboundService">
- <wsdl:operation name="getGreeting">
  <wsdl:input name="getGreetingRequest" message="ns0:getGreetingRequestMsg" />
  <wsdl:output name="getGreetingResponse" message="ns0:getGreetingResponseMsg" />
  <wsdl:fault name="serviceErrors" message="ns1:serviceErrorsMsg" />
  </wsdl:operation>
  </wsdl:portType>
+ <wsdl:binding name="WSSTestOutboundServiceHttpBinding" type="ns0:WSSTestOutboundService">
  <soap11:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
- <wsdl:operation name="getGreeting">
  <soap11:operation soapAction="http://WSSTestServiceLib/WSSTestOutboundService/V1/getGreeting" style="document" />
- <wsdl:input name="getGreetingRequest">
  <soap11:body use="literal" />
  </wsdl:input>
- <wsdl:output name="getGreetingResponse">
  <soap11:body use="literal" />
  </wsdl:output>
- <wsdl:fault name="serviceErrors">
  <soap11:fault name="serviceErrors" use="literal" />
  </wsdl:fault>
  </wsdl:operation>
  </wsdl:binding>
- <wsdl:service name="WSSTestOutboundServiceHttpService">
- <wsdl:port name="WSSTestOutboundServiceHttpPort" binding="ns0:WSSTestOutboundServiceHttpBinding">
  <soap11:address location="http://XXXXX/TestSecurity/V1" />
  </wsdl:port>
- <wsdl:port name="WSSTestOutboundServiceHttpPort.0" binding="ns0:WSSTestOutboundServiceHttpBinding">
  <soap11:address location="https://XXXXX/TestSecurity/V1" />
  </wsdl:port>
  </wsdl:service>
  </wsdl:definitions>


Je n'arrive pas à comprendre comment je peux envoyer une demande et en recevoir, je suppose que tout se joue ici :

Code:


- <wsdl:portType name="WSSTestOutboundService">
- <wsdl:operation name="getGreeting">
  <wsdl:input name="getGreetingRequest" message="ns0:getGreetingRequestMsg" />
  <wsdl:output name="getGreetingResponse" message="ns0:getGreetingResponseMsg" />
  <wsdl:fault name="serviceErrors" message="ns1:serviceErrorsMsg" />
  </wsdl:operation>
  </wsdl:portType>


Je ne comprends pas comment je fais pour lui envoyé le ns0:getGreetingRequestMsg et ensuite le recevoir.

Voici mon code pour le moment (qui ne veut rien dire pour le moment car j'essaye de comprendre comment cela fonctionne) :

Code:


local.WSSTestOutboundServiceHttpService CallWebService =
                new local.WSSTestOutboundServiceHttpService();

            local.getGreeting test1 = new local.getGreeting();

            CallWebService.getGreetingAsync(test1);
            MessageBox.Show(test1.ToString());
            local.getGreetingResponse test2 = new local.getGreetingResponse();

            MessageBox.Show(test2.greeting);


Je pense qu'il faut que je crée un xml et lui envoyer le getGreetingRequestMsg mais je ne vois pas comment.

Help please!

Merci.




Aucun commentaire:

Enregistrer un commentaire