Communication avec webservice
Bonjour,
Je dois développer une petite application (windows form) de test pour savoir si j'arrive à communiquer avec un webservice.
J'arrive à rajouter le webservice dans mon projet sans problème, c'est après que ça se corse.
Un dev m'a déposé un webservice, et m'a donné le wsdl :
Code:
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
| - <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:
1 2 3 4 5 6 7
| - <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 (qui ne veut rien dire pour le moment car j'essaye de comprendre comment cela fonctionne) :
Code:
1 2 3 4 5 6 7 8 9 10
| 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.