SOAP and nillable types

I have a WSDL which looks like this:

<s:element minOccurs="1" maxOccurs="1" name="MyElement" nillable="true" type="s:string"/>

I’m struggling to use this correctly from Delphi.

If I enable the “create wrapper class for nillable types” options when importing the WSDL, it correctly outputs a nil value, however when I do have an actual value it’s wrapped in an inner “value” element:

<v1:MyElement><v1:Value>xyz</v1:Value></v1:MyElement>

The receiving party does not accept this.

If I do not enable the wrapper class, the receiving party has no issues when there’s an actual value, but I can’t set it to nil.

I’m a bit of a noob so perhaps I’ve missed something obvious.

For reference here are the rodl parts:

<Struct Name="WideString_Anonymous" UID="{0725D919-F836-4FCE-83B2-D29A1C75EF31}" AutoCreateParams="1">
  <CustomAttributes>
    <nillable Value="1" />
    <anonymous Value="1" />
  </CustomAttributes>
  <Elements>
    <Element Name="Value" DataType="WideString">
    </Element>
  </Elements>
</Struct>

and

    <Element Name="MyElement" DataType="WideString_Anonymous">
      <CustomAttributes>
        <nillable Value="1" />
        <soapname Value="MyElement" />
      </CustomAttributes>
    </Element>

We’re using ROSDK version 8.1.85.1143

You can play with TROSOAPMessage.SerializationOptions.
All possible values are decribed here.
I can suggest to set SOAPMode that is required by server at the beginning.

The WSDL specifies document/literal, so I don’t think I can mess with SOAPMode.

As for the SerializationOptions, I don’t see any relevant ones, but just for kicks I tried xsoSendUntyped, xsoIgnoreStructureType and xsoDocumentLiteralWrappedNaming without any luck.

I’ve used Variant type instead of WideString_Anonymous as parameter and these values were sent as

	<v1:NewParam2 xsi:null="1"/>
	<v1:NewParam3>xyz</v1:NewParam3>

can you also test Variant type?

Here is the setup I currently use to create an RO SOAP server. Although I have not tried this with RO 8, it works with previous versions. Maybe it will work with your client use.

<Struct Name="StringAnon0" UID="{44CD539F-CA3A-4CEF-B473-E49F4FC26E67}" AutoCreateParams="1">
   <Documentation><![CDATA[Nillable Unicode String Type]]></Documentation>
   <CustomAttributes>
     <IsSimpleTypeExtension Value="1" />
     <Nillable Value="1" />
   </CustomAttributes>
   <Elements>
     <Element Name="Value" DataType="WideString">
     </Element>
   </Elements>
</Struct>

Regards,
Will.

Thank you both for your suggestions, I will try them and report back.

I tried the solution from Will first, and it works perfectly.

Thanks!

we have updated soap importer. soap.zip (161.6 KB)
Can you retest it, pls?

steps:

  • backup RemObjects.SDK.dll and ROSoapImporter.ServiceBuilder.dll from …\RemObjects SDK (Common)\Bin folder.
  • extract archive into this folder.
  • test
  • revert files from backup

Thank you for the prompt fix, I’ll test it this weekend and report back.

@aheid: any feedback ?

bugs://71451 got closed with status fixed.