Delphi Loginservice Sample and Soap Service


I’m using the LoginSerice in a Delphi application the same as in the for example Super TCP Channel chat example.

When I want to use the service as a plain soap service from .NET, this code dos not work since my service has no access to the session of the Login Service. How can I make hat happen?



private static void testSoap()
LoginService.LoginServiceClient lsc = new LoginServiceClient(); lsc = {LoginServiceClient}
bool LoggedIn = lsc.Login(‘mypass’,‘myuser’); loggedin = true
if (LoggedIn)
MyService.MyServiceClient msc = new MyServiceClient();
msc.DoSomething -> Now the call has no access to the session variables of the loginservice.


Server expects session Id to be passed via SOAP message headers.

F.e. for Document requests it would look like

<?xml version="1.0" encoding="utf-8"?>
        <ROClientIDHeader SOAP-ENV:mustUnderstand="0" xmlns="">
    <SOAP-ENV:Body xmlns:ro="#############">

You need to enable the xsoClientIdInWsdl option in your server app to let it expose required message headers in the WSDL.

After thant you need to generate some random Guid using the Guid.NewGuid() all and to use this guid in all server requests, including login service call

Hope that helps


Yest that helps we’re able to access the service now. One more question, is it possible to remove the IsRequired= True value for Objects since in some cases c# does not like an empty object? And is it possible to remove the Order=x?

Hi, Any update on this?

Could you elaborate a bit what exactly do you mean here?



I have a struct say TMyStruct.
In teh implementation I initialize the struct althout its emoty like:

MyStruct := TMyStruct.Create;

In VS / C# plain soap the output generated shows the following:

We’d like to remove the IsRequired and also remove the Order tag. Is that possible?


This code is auto-generated by VS web service import tool based on the WSDL exposed by the server.
AFAIK the Order part cannot be removed at all.
The IsRequired is based on WSDL attributes, so if possible cleate a simple testcase (literally a server with 2 structures and C# client) where this reproduces.

Also I need to mention that Remoting SDK servers provide a feature called HttpAPI. This feature turns them into REST servers that expose Swagger/OpenAPI compatible metadata (so client code can be generated for pretty much any language, from C# or Java to Python or JS). In come cases this might be a better communication option than SOAP.

Here is a sample project in Delphi: (117.6 KB)

Which generates this:


From our VS developer:
The selected type member doesn’t have minOccurs and maxOccurs elements. It means that this element is required and it’s position is fixed. We want to make an element optional. It should be minOccurs=0 maxOccurs=1.

So in this case when we assign blank values for Name and Contact, VS will raise an error.

Second question for Enum values they are shown as text and not numerical values. Can we adjust this?



for generation of minOccurs=0 maxOccurs=1, you should declare a new struct in Service Builder like

<Struct Name="AnsiString_Anonymous" UID="{...}" AutoCreateParams="1">
      <anonymous Value="1" /> 
    <Element Name="Value" DataType="AnsiString" /> 

and use it for Name parameter:

after this, wsdl will contain

the same for Person parameter

try to declare that parameter as integer instead of enum. all enums are written as string, like

<Sex xsi:type="ro:TSex">sxMale</Sex


Thanks. I have added the anonimous=1 in the Custom Attibutes Editor of my servcie library but that did not change anything in the output.

Or should I just add the MinOccurs and MaxOccurs in the custom attributes?


generation of MinOccurs and MaxOccurs is possible only on struct and arrays, so you should create wrapper struct for your field.

check RODL: NewLibrary.RODL (1.9 KB)


In the attached I have marked the Contact of the company with custom attribute anonymous=1 but ti does not geenrate the minoccurs and maxoccurs.

NewLibrary.RODL (2.0 KB)

it should be declared in the same way as AnsiStruct_Anonymous struct: NewLibrary.RODL (2.2 KB)

Thanks but this means I have to re work the enbire library to make it compatible with Soap. There is no other way?


we have only one way for autogenerating such things.
ofc, you can manually adjust generated WSDL and modify it as you want …


Is there an example on how to modify the WSDL for this scenario?