Les services › Webservices › Calculatrice (SOAP, façon ASMX)
Calculatrice (SOAP, façon ASMX) :
SOAP 1.1 Site (démonstration) Définition WSDL lue le 18/11/2026 à 23:26
Démonstration d’un service SOAP comme ceux d’ASP.NET (.asmx) : quatre opérations simples. Diviser par zéro renvoie une erreur SOAP (Fault).
http://www.koakdesign.info/ws_demo/calculatrice.phpCalculatrice de démonstration KoakDesign (façon ASP.NET .asmx).
POSTAdditionnerAdditionne deux nombres.
SOAPAction : http://koakdesign.info/ws/calculatrice/Additionner
Entrée (Additionner)
| Champ | Type | |
|---|---|---|
a | double | obligatoire |
b | double | obligatoire |
Sortie (AdditionnerResponse)
| Champ | Type | |
|---|---|---|
AdditionnerResult | double | obligatoire |
Modifiez les valeurs ? de l’enveloppe puis envoyez-la : la requête part du site vers http://www.koakdesign.info/ws_demo/calculatrice.php.
; Appel de l'opération Additionner (SOAP 1.1)
NewMap Entetes.s()
Entetes("Content-Type") = "text/xml; charset=utf-8"
Entetes("SOAPAction") = ~"\"http://koakdesign.info/ws/calculatrice/Additionner\""
Define Enveloppe.s = ~"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns0=\"http://koakdesign.info/ws/calculatrice\">\n <soap:Body>\n <ns0:Additionner>\n <ns0:a>0.0</ns0:a>\n <ns0:b>0.0</ns0:b>\n </ns0:Additionner>\n </soap:Body>\n</soap:Envelope>"
Define Requete = HTTPRequest(#PB_HTTP_Post, "http://www.koakdesign.info/ws_demo/calculatrice.php", Enveloppe, 0, Entetes())
If Requete
Debug "HTTP " + HTTPInfo(Requete, #PB_HTTP_StatusCode)
Debug HTTPInfo(Requete, #PB_HTTP_Response) ; réponse XML (à lire avec CatchXML)
FinishHTTP(Requete)
EndIf
POSTSoustraireSoustrait b de a.
SOAPAction : http://koakdesign.info/ws/calculatrice/Soustraire
Entrée (Soustraire)
| Champ | Type | |
|---|---|---|
a | double | obligatoire |
b | double | obligatoire |
Sortie (SoustraireResponse)
| Champ | Type | |
|---|---|---|
SoustraireResult | double | obligatoire |
Modifiez les valeurs ? de l’enveloppe puis envoyez-la : la requête part du site vers http://www.koakdesign.info/ws_demo/calculatrice.php.
; Appel de l'opération Soustraire (SOAP 1.1)
NewMap Entetes.s()
Entetes("Content-Type") = "text/xml; charset=utf-8"
Entetes("SOAPAction") = ~"\"http://koakdesign.info/ws/calculatrice/Soustraire\""
Define Enveloppe.s = ~"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns0=\"http://koakdesign.info/ws/calculatrice\">\n <soap:Body>\n <ns0:Soustraire>\n <ns0:a>0.0</ns0:a>\n <ns0:b>0.0</ns0:b>\n </ns0:Soustraire>\n </soap:Body>\n</soap:Envelope>"
Define Requete = HTTPRequest(#PB_HTTP_Post, "http://www.koakdesign.info/ws_demo/calculatrice.php", Enveloppe, 0, Entetes())
If Requete
Debug "HTTP " + HTTPInfo(Requete, #PB_HTTP_StatusCode)
Debug HTTPInfo(Requete, #PB_HTTP_Response) ; réponse XML (à lire avec CatchXML)
FinishHTTP(Requete)
EndIf
POSTMultiplierMultiplie deux nombres.
SOAPAction : http://koakdesign.info/ws/calculatrice/Multiplier
Entrée (Multiplier)
| Champ | Type | |
|---|---|---|
a | double | obligatoire |
b | double | obligatoire |
Sortie (MultiplierResponse)
| Champ | Type | |
|---|---|---|
MultiplierResult | double | obligatoire |
Modifiez les valeurs ? de l’enveloppe puis envoyez-la : la requête part du site vers http://www.koakdesign.info/ws_demo/calculatrice.php.
; Appel de l'opération Multiplier (SOAP 1.1)
NewMap Entetes.s()
Entetes("Content-Type") = "text/xml; charset=utf-8"
Entetes("SOAPAction") = ~"\"http://koakdesign.info/ws/calculatrice/Multiplier\""
Define Enveloppe.s = ~"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns0=\"http://koakdesign.info/ws/calculatrice\">\n <soap:Body>\n <ns0:Multiplier>\n <ns0:a>0.0</ns0:a>\n <ns0:b>0.0</ns0:b>\n </ns0:Multiplier>\n </soap:Body>\n</soap:Envelope>"
Define Requete = HTTPRequest(#PB_HTTP_Post, "http://www.koakdesign.info/ws_demo/calculatrice.php", Enveloppe, 0, Entetes())
If Requete
Debug "HTTP " + HTTPInfo(Requete, #PB_HTTP_StatusCode)
Debug HTTPInfo(Requete, #PB_HTTP_Response) ; réponse XML (à lire avec CatchXML)
FinishHTTP(Requete)
EndIf
POSTDiviserDivise a par b (b différent de zéro, sinon erreur SOAP).
SOAPAction : http://koakdesign.info/ws/calculatrice/Diviser
Entrée (Diviser)
| Champ | Type | |
|---|---|---|
a | double | obligatoire |
b | double | obligatoire |
Sortie (DiviserResponse)
| Champ | Type | |
|---|---|---|
DiviserResult | double | obligatoire |
Modifiez les valeurs ? de l’enveloppe puis envoyez-la : la requête part du site vers http://www.koakdesign.info/ws_demo/calculatrice.php.
; Appel de l'opération Diviser (SOAP 1.1)
NewMap Entetes.s()
Entetes("Content-Type") = "text/xml; charset=utf-8"
Entetes("SOAPAction") = ~"\"http://koakdesign.info/ws/calculatrice/Diviser\""
Define Enveloppe.s = ~"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns0=\"http://koakdesign.info/ws/calculatrice\">\n <soap:Body>\n <ns0:Diviser>\n <ns0:a>0.0</ns0:a>\n <ns0:b>0.0</ns0:b>\n </ns0:Diviser>\n </soap:Body>\n</soap:Envelope>"
Define Requete = HTTPRequest(#PB_HTTP_Post, "http://www.koakdesign.info/ws_demo/calculatrice.php", Enveloppe, 0, Entetes())
If Requete
Debug "HTTP " + HTTPInfo(Requete, #PB_HTTP_StatusCode)
Debug HTTPInfo(Requete, #PB_HTTP_Response) ; réponse XML (à lire avec CatchXML)
FinishHTTP(Requete)
EndIf
