Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9010709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:32:07+00:00 2026-06-16T02:32:07+00:00

I need to send something like this: <soapenv:Header> <ser:userName>admin</ser:userName> <ser:userPassword>secret</ser:userPassword> </soapenv:Header> Delphi WSDL importer,

  • 0

I need to send something like this:

   <soapenv:Header>
      <ser:userName>admin</ser:userName>
      <ser:userPassword>secret</ser:userPassword>
   </soapenv:Header>

Delphi WSDL importer, generated this:

  userName2 = class(TSOAPHeader)
  private
    FValue: string;
  published
    property Value: string  read FValue write FValue;
  end;

  userName      =  type string;

  WsService = interface(IInvokable)
    function call(const userName: userName; const userPassword: userPassword);

and registered the type as:

  InvRegistry.RegisterHeaderClass(TypeInfo(WsService), userName2, 'userName', 'http://localhost/path/to/services');

The problem is that when I call it using the delphi generated code it puts the userName and password in the Body section of the SOAP message, not in the Header.

So I tried sending the Headers myself, like this:

Changed the type definition to inherit from the userName2 class because I can’t send a string using the ISOAPHeaders.Send() method.

userName = class(userName2);        

Then sent the headers:

user := userName.Create;
user.Value := 'admin';

WS := GetWsService;
(WS as ISOAPHeaders).Send(user);

Now the headers are in the correct place, but they are being sent like this:

<SOAP-ENV:Header>
    <NS1:userName xmlns:NS1="http://localhost/path/to/services">
        <Value xmlns="http://localhost/path/to/services">admin</Value>
    </NS1:userName>
</SOAP-ENV:Header>

Almost there, but I don’t want the “Value” property, I just want a plain simple tag in the header.

How can I do it?

Thanks.

== EDIT ==

As requested, the WSDL is here: http://desenvolvimento.lemontech.com.br:8081/wsselfbooking/WsSelfBookingService?wsdl

SOAP UI imported it and generated this sample request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://lemontech.com.br/selfbooking/wsselfbooking/services">
   <soapenv:Header>
      <ser:userPassword></ser:userPassword>
      <ser:userName></ser:userName>
      <ser:keyClient></ser:keyClient>
   </soapenv:Header>
   <soapenv:Body>
      <ser:pesquisarSolicitacao>
         <!--You have a CHOICE of the next 2 items at this level-->
         <idSolicitacaoRef></idSolicitacaoRef>
         <dataInicial></dataInicial>
         <dataFinal></dataFinal>
         <registroInicial>1</registroInicial>
         <!--Optional:-->
         <quantidadeRegistros>50</quantidadeRegistros>
      </ser:pesquisarSolicitacao>
   </soapenv:Body>
</soapenv:Envelope>

This sample request works just fine, but I can’t figure out how to make this call in Delphi.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:32:08+00:00Added an answer on June 16, 2026 at 2:32 am

    Solution:

    It wasn’t much obvious, but I just had to add the IS_TEXT value to the Index and declare a new TSOAPHeader descendant, the solution was like this:

    const
      IS_TEXT = $0020;
    
    type
      TSimpleHeader = class(TSOAPHeader)
      private
        FValue: string;
      published
        property Value: string Index (IS_TEXT) read FValue write FValue;
      end;
    
      userName = class(TSimpleHeader);
    

    Then register this header:

    InvRegistry.RegisterHeaderClass(TypeInfo(WsService), userName, 'userName', 'http://localhost/path/to/services');
    

    And send the Header manually:

        User := userName.Create;
        User.Value := 'username';
    
        (WS as ISOAPHeaders).Send(User);
    

    Basically, the IS_TEXT value in the Index prevents Delphi from creating a userName tag and a Value tag inside it. It just places the string of the Value property inside the userName tag.

    It’s sad that the Index keywork is used for something so not obvious, also the documentation about it is difficult to find and hard to understand:

    The AS_ATTRIBUTE feature has been deprecated. It still works for legacy code, but the preferred approach is to use the index value of a property. The index property allows you to specify whether a property is an attribute, an unbounded element, an optional element, a text value, or can have a value of NULL.

    Source: http://docwiki.embarcadero.com/RADStudio/XE3/en/Using_Remotable_Objects

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This may sound ridiculous but I need to send something like <policy-file-request/> followed by
Okay, so I need something like this: time_span = 1.month date = DateTime.now date
I need that controller return JSONP response. Something like this: jsonp123({name : Remy, id
I have something like this: $('#find').click(function() {... I need to also add to that
A dojo JsonRest will likely send something like this to the server: /FooObject/?foo=value1&sortBy=+foo,-bar I
I need to send instant messages (like forum PMs) between users with my asp.net
I have a form which upload a big file to server. Something like this:
How can I do something like this? public class person { public ICommand Add_as_Friend
I'm reviewing some team code and I found something like this : MyObj obj
I have few functions, which calls another (integrated functions in browser), something like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.