views:

293

answers:

1

I use this line to register a class with the Delphi registry for Soap elements:

RemClassRegistry.RegisterXSClass(ToHeader, ADD_URI);

In the Soap request message, I see this:

 <NS1:ToHeader> ... </NS1:ToHeader>

Is it possible to change the class registration so that it renders the element with a different name, like:

 <NS1:To> ... </NS1:To>

or is the only way to tweak the request stream?

To is a reserved word in Delphi, I can not rename the class to the element name 'To'.

+4  A: 

Looks like that's what the third parameter is for. Try this:

RemClassRegistry.RegisterXSClass(ToHeader, ADD_URI, 'To');

As of Delphi 8, you can use reserved words for identifiers. Use & as an escape character, or use a fully qualified name:

type
  &To = class;

RemClassRegistry.RegisterXSClass(UnitName.To, Add_URI);
Rob Kennedy
mjustin