Comment faire un appel SOAP WSDL web services depuis la ligne de commande

je dois faire un appel webservice SOAP à https://sandbox.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc?wsdl et d'utiliser L'opération ClientLogin en passant par les paramètres: ApplicationKey, Password, et UserName. La réponse est la sécurité des utilisateurs. Elles sont toutes les chaînes.

voici le lien expliquant pleinement ce que j'essaie de faire: https://sandbox.mediamind.com/Eyeblaster.MediaMind.API.Doc/?v=3

Comment puis-je faire cela en ligne de commande? (Windows et/ou Linux seraient utiles)

51
demandé sur Brian 2012-09-01 01:19:51

6 réponses

c'est un service SOAP Web standard, ordinaire. SSH n'a rien à faire ici. Je viens de l'appeler avec (un-liner):

$ curl -X POST -H "Content-Type: text/xml" \
    -H "SOAPAction: \"http://api.eyeblaster.com/IAuthenticationService/ClientLogin\"" \
    --data-binary @request.xml \
    https://sandbox.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc

request.xml fichier a le contenu suivant:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:api="http://api.eyeblaster.com/">
           <soapenv:Header/>
           <soapenv:Body>
              <api:ClientLogin>
                 <api:username>user</api:username>
                 <api:password>password</api:password>
                 <api:applicationKey>key</api:applicationKey>
              </api:ClientLogin>
          </soapenv:Body>
</soapenv:Envelope>

je reçois cette belle 500:

<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Body>
    <s:Fault>
      <faultcode>s:Security.Authentication.UserPassIncorrect</faultcode>
      <faultstring xml:lang="en-US">The username, password or application key is incorrect.</faultstring>
    </s:Fault>
  </s:Body>
</s:Envelope>

avez-vous essayé ?

Lire la suite

96
répondu Tomasz Nurkiewicz 2017-07-28 05:19:45

sur la ligne de commande linux, vous pouvez simplement exécuter:

curl -H "Content-Type: text/xml; charset=utf-8" -H "SOAPAction:"  -d @your_soap_request.xml -X POST https://ws.paymentech.net/PaymentechGateway
10
répondu linuxeasy 2013-11-22 07:44:46

utilisant CURL:

USER='myusername'
PASSWORD='mypassword'
AUTHENTICATION="$USER:$PASSWORD"
URL='http://mysoapserver:8080/meeting/aws'
SOAPFILE=getCurrentMeetingStatus.txt
TIMEOUT=5

CURL request:

curl --user "${AUTHENTICATION}" --header 'Content-Type: text/xml;charset=UTF-8' --data @"${SOAPFILE}" "${URL}" --connect-timeout $TIMEOUT

je l'utilise pour vérifier la réponse:

http_code=$(curl --write-out "%{http_code}\n" --silent --user "${AUTHENTICATION}" --header 'Content-Type: text/xml;charset=UTF-8' --data @"${SOAPFILE}" "${URL}" --connect-timeout $TIMEOUT --output /dev/null)
if [[ $http_code -gt 400 ]];  # 400 and 500 Client and Server Error codes http://en.wikipedia.org/wiki/List_of_HTTP_status_codes
then
echo "Error: HTTP response ($http_code) getting URL: $URL"
echo "Please verify parameters/backend. Username: $USER Password: $PASSWORD Press any key to continue..."
read entervalue || continue
fi
5
répondu spicyramen 2018-09-18 20:30:09

Pour Windows:

enregistrer ce qui suit comme MSFT.vbs:

set SOAPClient = createobject("MSSOAP.SOAPClient")
SOAPClient.mssoapinit "https://sandbox.mediamind.com/Eyeblaster.MediaMind.API/V2/AuthenticationService.svc?wsdl"
WScript.Echo "MSFT = " & SOAPClient.GetQuote("MSFT")

puis, à partir d'une invite de commande, Exécuter:

C:\>MSFT.vbs

référence: http://blogs.msdn.com/b/bgroth/archive/2004/10/21/246155.aspx

2
répondu Fuzzy Analysis 2012-08-31 21:35:46

Pour Windows, j'ai trouvé ce travail:

Set http = CreateObject("Microsoft.XmlHttp")
http.open "GET", "http://www.mywebservice.com/webmethod.asmx?WSDL", FALSE
http.send ""
WScript.Echo http.responseText

Référence: Projet COD

1
répondu Aram Paronikyan 2015-03-05 13:11:52
curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:ACTION_YOU_WANT_TO_CALL" --data @FILE_NAME URL_OF_THE_SERVICE 

au-dessus du commandement m'a été utile

exemple

curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:urn:GetVehicleLimitedInfo" --data @request.xml http://11.22.33.231:9080/VehicleInfoQueryService.asmx 

plus d'information

1
répondu Techie 2015-03-05 17:47:58