title: Delphi 2007 WSDL Import, setting SOAP header information
body: <p>Importing WDSL in Delphi 2007 works fine, but generates a Cannot Unwrap warning (code snippet 1, below [like another question already logged on StackOverFlow]). </p>
  
  <p>However, it is how we set the headers <code>(REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn)</code> that is unclear from the generated code. Looking elsewhere on the Net, we also tried the command line utilitiy <code>WDSLImp</code>, which allowed us to use switches to, for example, unwrap literals. No good.</p>
  
  <p>Snippet 2 shows the initialization stuff, which we have variously tried substituting real values for the three header parameters. The end result should appear over the interface like this snippet 3.</p>
  
  <p>All help very much appreciated.</p>
  
  <p>Snippet 1:</p>
  
  <pre><code>// ************************************************************************ //
  // Namespace : http//www.sx3.com/GET_SERVICE_STATUS.wsdl
  // soapAction: https//xxx.org.uk:23105/communication/gateway
  // transport : http//schemas.xmlsoap.org/soap/http
  // style     : document
  // binding   : UpdGetServiceStatusBinding
  // service   : UpdGetServiceStatusService
  // port      : UpdGetServiceStatusPort
  // URL       : http//machine:port/communication/UpdGetServiceStatus
  // ************************************************************************ //
  UpdGetServiceStatusPort = interface(IInvokable)
  ['{CB3F81D1-5267-4897-C244-288E348AA34E}']
  
  // Cannot unwrap: 
  //     - Input element wrapper name does not match operation's name
  //     - More than one strictly out element was found
  // Headers: REQUESTOR:pIn, REQUEST_USER:pIn, REQUEST_PASSWORD:pIn
  function  UpdGetServiceStatus(const parameters: GetServiceStatusRequest): GET_SERVICE_STATUS; stdcall;
  end;
  
  function GetUpdGetServiceStatusPort(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): UpdGetServiceStatusPort;
  
  
  implementation
    uses SysUtils;
  
  function GetUpdGetServiceStatusPort(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): UpdGetServiceStatusPort;
  const
    defWSDL = 'get_service_status_net.wsdl';
    defURL  = 'http//machine:port/communication/UpdGetServiceStatus';
    defSvc  = 'UpdGetServiceStatusService';
    defPrt  = 'UpdGetServiceStatusPort';
  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 UpdGetServiceStatusPort);
      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;
  </code></pre>
  
  <p>Snippet 2:</p>
  
  <pre><code>initialization
    InvRegistry.RegisterInterface(TypeInfo(UpdGetServiceStatusPort), 'http//www.sx3.com/GET_SERVICE_STATUS.wsdl', 'utf-8');
    InvRegistry.RegisterDefaultSOAPAction(TypeInfo(UpdGetServiceStatusPort), 'https//xxx.org.uk:23105/communication/gateway');
    InvRegistry.RegisterInvokeOptions(TypeInfo(UpdGetServiceStatusPort), ioDocument);
    InvRegistry.RegisterInvokeOptions(TypeInfo(UpdGetServiceStatusPort), ioLiteral);
    InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUESTOR, 'REQUESTOR', 'http//www.yyy.com/IntegratorCoreTypes');
    InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUEST_USER, 'REQUEST_USER', 'http//www.yyy.com/IntegratorCoreTypes');
    InvRegistry.RegisterHeaderClass(TypeInfo(UpdGetServiceStatusPort), REQUEST_PASSWORD, 'REQUEST_PASSWORD', 'http//www.yyy.com/IntegratorCoreTypes');
    InvRegistry.RegisterExternalParamName(TypeInfo(UpdGetServiceStatusPort), 'UpdGetServiceStatus', 'parameters1', 'parameters');
    RemClassRegistry.RegisterXSInfo(TypeInfo(APIMessagesType), 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessagesType');
    RemClassRegistry.RegisterXSClass(GET_SERVICE_STATUS, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GET_SERVICE_STATUS');
    RemClassRegistry.RegisterSerializeOptions(GET_SERVICE_STATUS, [xoLiteralParam]);
    RemClassRegistry.RegisterXSClass(GetServiceStatusRequestType, 'http//www.sx3.com/GET_SERVICE_STATUS', 'GetServiceStatusRequestType');
    RemClassRegistry.RegisterSerializeOptions(GetServiceStatusRequestType, [xoLiteralParam]);
    RemClassRegistry.RegisterXSClass(GetServiceStatusRequest, 'http//www.sx3.com/GET_SERVICE_STATUS', 'GetServiceStatusRequest');
    RemClassRegistry.RegisterXSInfo(TypeInfo(char4000), 'http://www.sx3.com/houCommonTypes', 'char4000');
    RemClassRegistry.RegisterXSClass(GetServiceStatusType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GetServiceStatusType');
    RemClassRegistry.RegisterXSInfo(TypeInfo(char25), 'http//www.sx3.com/houCommonTypes', 'char25');
    RemClassRegistry.RegisterXSClass(APIMessageType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessageType');
    RemClassRegistry.RegisterXSInfo(TypeInfo(char30), 'http//www.sx3.com/houCommonTypes', 'char30');
    RemClassRegistry.RegisterXSInfo(TypeInfo(char7), 'http//www.sx3.com/houCommonTypes', 'char7');
    RemClassRegistry.RegisterXSClass(MESSAGEType, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGEType');
    RemClassRegistry.RegisterExternalPropName(TypeInfo(MESSAGEType), 'TYPE_', 'TYPE');
    RemClassRegistry.RegisterXSInfo(TypeInfo(int15), 'http//www.sx3.com/houCommonTypes', 'int15');
    RemClassRegistry.RegisterXSClass(GetServiceStatusResponseType, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'GetServiceStatusResponseType');
    RemClassRegistry.RegisterXSInfo(TypeInfo(RETURNED_MESSAGESType), 'http//www.sx3.com/sx3returnedmessages', 'RETURNED_MESSAGESType');
    RemClassRegistry.RegisterXSClass(MESSAGE_RETURN_INFO, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_RETURN_INFO');
    RemClassRegistry.RegisterXSClass(MESSAGE_RETURN_INFO2, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_RETURN_INFO2', 'MESSAGE_RETURN_INFO');
    RemClassRegistry.RegisterXSClass(REQUESTOR, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUESTOR');
    RemClassRegistry.RegisterSerializeOptions(REQUESTOR, [xoSimpleTypeWrapper]);
    RemClassRegistry.RegisterXSClass(REQUEST_USER, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUEST_USER');
    RemClassRegistry.RegisterSerializeOptions(REQUEST_USER, [xoSimpleTypeWrapper]);
    RemClassRegistry.RegisterXSClass(REQUEST_PASSWORD, 'http//www.yyy.com/IntegratorCoreTypes', 'REQUEST_PASSWORD');
    RemClassRegistry.RegisterSerializeOptions(REQUEST_PASSWORD, [xoSimpleTypeWrapper]);
    RemClassRegistry.RegisterXSClass(APIMessage, 'http//www.sx3.com/UpdGetServiceStatusResponse', 'APIMessage');
    RemClassRegistry.RegisterXSClass(MESSAGE_, 'http//www.sx3.com/sx3returnedmessages', 'MESSAGE_', 'MESSAGE');
  </code></pre>
  
  <p>Snippet 3:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:soap="http//schemas.xmlsoap.org/soap/envelope/" 
  xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance" 
  xmlns:xs="http//www.w3.org/2001/XMLSchema" 
  xmlns:ig="http//www.yyy.com/IntegratorCoreTypes" 
  xmlns:ng1="http//www.sx3.com/GET_WORKS_ORDERS_LIST"&gt;
    &lt;soap:Header&gt;
      &lt;ig:REQUESTOR&gt;REALREQUESTOR&lt;/ig:REQUESTOR&gt;
      &lt;ig:REQUEST_USER&gt;REALREQUEST_USER&lt;/ig:REQUEST_USER&gt;
      &lt;ig:REQUEST_PASSWORD&gt;realpassword&lt;/ig:REQUEST_PASSWORD&gt;
    &lt;/soap:Header&gt;
    &lt;soap:Body&gt;
      &lt;ng1:WorksOrdersListRequest/&gt;
    &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>