Adding some attributes to the Rodl

Hi,

I have a Struct called ReferentialData
and 2 others (pReferentialData and externalReferentialData) that have ReferentialData as ancestor.
The problem is that in the enveloppe then both appear like this
<referentialData>
so the server doesn’t know if it is a pReferentialData or a externalReferentialData

I should get something like this
<referentialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="v1:pReferentialData">
for pReferentialData and
<referentialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="v1:externalReferentialData"> for externalReferentialData

I thought I could simply replace in the sent Stream by the matching string. but the problem is that at this time I don’t know myseld if the data is a pReferentialData or externalReferentialData.

Is there a way to force the value directly in the attributes of these 2 objects ? And how ?

Regards

if you add SOAPName attribute, you can write something like

<pReferentialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<externalReferentialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

so later you can easily detect datatype of struct

Hi Evgeny,

I ave trye dto do this but I still get <referentialData>
Note that many chars are not accepted if I try to use
<referentialData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="v1:externalReferentialData">

So I have just used externalReferentialData instead same problem with pReferentialData

Regards

This function is never called that’s maybe why:
class function externalReferentialData.GetAttributeValue(aIndex: Integer): String;

have you added SOAPName attribute?

procedure TROXMLSerializer.WriteStruct(const aName: string; const Ref; aClass: TClass;
  ArrayElementId: integer);
...
      if SameText(TROComplexTypeClass(aClass).GetAttributeName(i), 'SOAPName') then //<<<<
        lName := TROComplexTypeClass(aClass).GetAttributeValue(i);

set breakpoint at selected line and launch your application under debugger

Evgeny,
I have added SOAPName attribute

but in TROXMLSerializer.WriteStruct aClass.ClassName is always a referentialData and it has only importedfromnamespace attribute like the attrbutes of referentialData in the Rodl file.

here the ancestor is always called not the externalReferentialData

can you attach your RODL, pls?
by other hand, you can send it to support@

ok I send an email with Rodl and int files.

you have this behavior because _referentialData field inside coreData struct has soapname=referentialData so it will be always written with referentialData name

If I remove this atribute in _referentialData field, will it solve the problem ?

If I remove it I still Get ReferentialData

if xsoSendUntyped is unchecked, it adds datatypes, like

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope 
		xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
		xmlns:HNS="http://tempuri.org/" 
		xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" 
		xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Body xmlns:ro="http://tempuri.org/">
		<NS1:NewService___oper xmlns:NS1="http://tempuri.org/">
			<A xsi:type="ro:Sum2Struct">
				<NewField xsi:type="xsd:int">2</NewField>
				<NewField1 xsi:type="xsd:int">20</NewField1>
			</A>
		</NS1:NewService___oper>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>