Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First of all I would start with adding Fiddler2 and SoapUI to your arsenal of tools when dealing with soap and web services.</p> <p>Sounds like the envelope header is incomplete. In my experience with D2007 and a WCF web service, Delphi would not build the envelope header correctly, so I had to intercept the call and add the items like this:</p> <pre><code>procedure TMainForm.MyMessageEnvelopeComplete(Sender: TROSOAPMessage); begin Sender.EnvelopeNode.AddAttribute('xmlns:a', 'http://www.w3.org/2005/08/addressing', False); Sender.HeaderNode.Add('a:Action').Value := 'http://Testservice.Connect/IConnect/Ping'; Sender.HeaderNode.Add('a:To').Value := 'http://testservice-pc:2021/WSConnect'; end; </code></pre> <p>EDIT:</p> <p>If you want to build the soap envelope and the post command by hand, I have done it using the following code... </p> <pre><code>procedure TMainForm.Button5Click(Sender: TObject); procedure HandleError(const errorCode: integer); var errorMessage: AnsiString; begin SetLength(errorMessage, 256); FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM or FORMAT_MESSAGE_FROM_HMODULE, Pointer(GetModuleHandle('wininet.dll')), errorCode, 0, PChar(errorMessage), Length(errorMessage), nil); SetLength(errorMessage, StrLen(PChar(errorMessage))); raise Exception.Create(errorMessage); end; function BuildHeader: TStringStream; begin result := TStringStream.Create(''); try result.WriteString('Content-Type: application/soap+xml;charset=UTF-8;action="http://Thermo.Connect/IHCSConnect/Ping"' + sLineBreak); except result.Free; raise; end; end; function BuildBody: TStringStream; begin result := TStringStream.Create(''); with result do try WriteString('&lt;s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"&gt;' + sLineBreak); WriteString('&lt;s:Header&gt;' + sLineBreak); WriteString('&lt;a:Action&gt;http://Thermo.Connect/IHCSConnect/Ping&lt;/a:Action&gt;' + sLineBreak); WriteString('&lt;a:To&gt;http://thermo-pc:2021/WSHCSConnect&lt;/a:To&gt;' + sLineBreak); WriteString('&lt;/s:Header&gt;' + sLineBreak); WriteString('&lt;s:Body&gt;' + sLineBreak); WriteString('&lt;Ping xmlns="http://Thermo.Connect"&gt;' + sLineBreak); WriteString('&lt;/Ping&gt;' + sLineBreak); WriteString('&lt;/s:Body&gt;' + sLineBreak); WriteString('&lt;/s:Envelope&gt;' + sLineBreak); except; result.Free; raise; end; end; var InetRoot: HINTERNET; InetConnect: HINTERNET; Request: HINTERNET; begin InetRoot := InternetOpen('GabeCode', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); try InetConnect := InternetConnect( InetRoot, 'thermo-pc:2021', 0, '', '', INTERNET_SERVICE_HTTP, 0, Cardinal(Self)); try Request := HttpOpenRequest( InetConnect, 'POST', 'WSHCSConnect', 'HTTP/1.1', nil, nil, INTERNET_FLAG_KEEP_CONNECTION or INTERNET_FLAG_NO_CACHE_WRITE, 0); try // build add header items to the post request with BuildHeader do try HttpAddRequestHeaders(Request, PChar(DataString), Length(DataString), HTTP_ADDREQ_FLAG_ADD); finally Free; end; // build the body of data being posted and send the post with BuildBody do try if not HttpSendRequest(Request, nil, 0, PChar(DataString), Length(DataString)) then HandleError(GetLastError); finally Free; end; finally InternetCloseHandle(Request); end; finally InternetCloseHandle(InetConnect); end; finally InternetCloseHandle(InetRoot); end; end; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload