Ligne de commande Curl pour la consommation de services Web?
-
01-07-2019 - |
Question
Savez-vous comment utiliser la ligne de commande Curl pour POST SOAP afin de tester un service Web?
J'ai un fichier (soap.xml) qui contient tout le message soap, mais il me semble que je n'arrive pas à le poster correctement.
Merci!
La solution
Publication d'une chaîne:
curl -d "String to post" "http://www.example.com/target"
Publication du contenu d'un fichier:
curl -d @soap.xml "http://www.example.com/target"
Autres conseils
Pour un service Web SOAP 1.2, j'utilise normalement
curl --header "content-type: application/soap+xml" --data @filetopost.xml http://domain/path
Faux. Cela ne fonctionne pas pour moi.
Pour moi, celui-ci fonctionne:
curl
-H 'SOAPACTION: "urn:samsung.com:service:MainTVAgent2:1#CheckPIN"'
-X POST
-H 'Content-type: text/xml'
-d @/tmp/pinrequest.xml
192.168.1.5:52235/MainTVServer2/control/MainTVAgent2
curl -H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction:" \
-d @soap.txt -X POST http://someurl
Si vous souhaitez une interface plus moelleuse que le terminal, http://hurl.it/ , c'est génial.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow