0

I need to add this header to a webservices client written in delphi because the server reject the request:

 <!--<soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
  <To soap:mustUnderstand="1" xmlns="http://www.w3.org/2005/08/addressing">http://srvweh01:8081/ISPWebService/IspOrderWs.svc</To>
 </soap:Header>-->

The WSDL importer have created the standard code:

function GetIspOrderWs(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): IspOrderWs;
const
  defWSDL = 'C:\Sources\SoapClientXWEH\IspOrderWs.xml';
  defURL  = 'http://srvweh01:8081/ISPWebService/IspOrderWs.svc';
  defSvc  = 'IspOrderWs';
  defPrt  = 'WSHttpBinding_IspOrderWs';
var
  RIO: THTTPRIO;
begin

  Result := nil;
  if (Addr = '') then
  begin
    if UseWSDL then
      Addr := defWSDL
    else
      Addr := defURL;
  end;
  if HTTPRIO = nil then
    RIO := THTTPRIO.Create(nil)
  else
    RIO := HTTPRIO;
  try
    Result := (RIO as IspOrderWs);
    if UseWSDL then
    begin
      RIO.WSDLLocation := Addr;
      RIO.Service := defSvc;
      RIO.Port := defPrt;
    end else
      RIO.URL := Addr;
  finally
    if (Result = nil) and (HTTPRIO = nil) then
      RIO.Free;
  end;
end;

and this is my call to the server:

getIspOrderWs().addOrder(pippoPRT);

So my question is: how can I insert the missing header (and the proper way to do it) before I call so the SOAP message can be compiled well?

All suggest are welcome, Thanks!

Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
Gianluca
  • 3
  • 3
  • you can look [here](https://stackoverflow.com/a/13821813/800214) for some suggestions.... :) – whosrdaddy Jul 20 '18 at 19:04
  • I've had success in using the HTTPRIOBeforeExecute event, and modify the SOAPRequest parameter there. – John Easley Jul 21 '18 at 22:06
  • And how have you accomplish?? I have found some serious difficulty to use the TStream object.... – Gianluca Jul 23 '18 at 10:03
  • @ whosrdaddy: Thanks! Anyway in my case I got no luck with the fist suggest... I have check with wireshark to get the xml but I ca't see the header section... – Gianluca Jul 23 '18 at 10:08
  • Both of solution involved class TSOAPHeader, return to me an error: ESOAPDomConvertError: Conversion from class TValueDataImpl to SOAP is not supported - SOAP classes must derive from TRemotable. Any other suggest?? – Gianluca Jul 23 '18 at 15:14

0 Answers0