Einzelnen Beitrag anzeigen

ThomasMü

Registriert seit: 31. Aug 2017
2 Beiträge
 
#1

SOAP web service | WS-Security authentication

  Alt 31. Aug 2017, 07:35
Hallo,

ich versuche einen Client zu erstellen, der einen SOAP Webservice verwendet.
Dazu verwende ich den Embarcadero C++Builder 10 Seattle.
Wenn ich eine Anfrage an den Webservice sende, erhälte ich folgende Fehlermeldung:
Zitat:
An error occurred when verifying security for the message
Die Anfrage sieht folgendermaßen aus:
Delphi-Quellcode:
POST https://**** HTTP/1.1
SOAPAction: "****"
Content-Type: text/xml; charset=utf-8
User-Agent: CodeGear SOAP 1.3
Host: ****
Content-Length: 349
Connection: Keep-Alive
Cache-Control: no-cache

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><SOAP-ENV:Body><****><****>****</****></****></SOAP-ENV:Body></SOAP-ENV:Envelope>
In SoapUI konnte ich eine erfolgreiche Anfrage senden indem ich bei "username" und "password" den Benutzernamen und das Password, sowie bei "WSS-Password Type" "PasswordText" ausgewählt habe.

Die Anfrage von SoapUI sah folgendermaßen aus:
Delphi-Quellcode:
POST https://**** HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "http://****"
Content-Length: 1069
Host: ****
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
   <soapenv:Header><wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-****"><wsse:Username>****</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">****</wsse:Password><wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">****</wsse:Nonce><wsu:Created>2017-08-30T12:48:09.048Z</wsu:Created></wsse:UsernameToken></wsse:Security></soapenv:Header>
   <soapenv:Body>
      <tem:****>
         <!--Optional:-->
         <tem:****>****</tem:****>
      </tem:****>
   </soapenv:Body>
</soapenv:Envelope>
Wie kann ich den header der Anfrage in meiner Anwendung hinzufügen?
Ich habe bisher nur Beispiele gefunden, wie die basic authentification im http header hinzugefügt wird.

Viele Grüße
Thomas

Geändert von ThomasMü (31. Aug 2017 um 11:06 Uhr) Grund: Frage wurde beantwortet
  Mit Zitat antworten Zitat