What if Delphi does not import WSDL correctly due to a hyphen in the enumeration name?

I am using Delphi, and I am using a wsdl file from another company to configure my proxy class to use my data from their web service. The wsdl file contains the following:

<xsd:simpleType name="departStatus"> <xsd:annotation> <xsd:documentation>Enumerates allowable departure statuses (DEPARTED, NOT-DEPARTED)</xsd:documentation> </xsd:annotation> <xsd:restriction base="xsd:string"> <xsd:enumeration value="DEPARTED"/> <xsd:enumeration value="NOT-DEPARTED"/> </xsd:restriction> </xsd:simpleType> 

When I create a proxy class, I get the following:

  departStatus = ( DEPARTED, [System.Xml.Serialization.XmlEnumAttribute('NOT-DEPARTED')] NOTDEPARTED); 

Which does not compile unless I delete the line starting with [System.xml ... and it will not recognize "NOT-DEPARTED" as a valid value for offStatus. If I change NOT-DEPARTED to NOT_DEPARTED in the wsdl file and any input XML file, it works fine, but the company that installed it insists that NOT-DEPARTED is valid and will not change it. Why not enumerate the offStatus enum correctly? Any ideas how to get around this? Thanks in advance for any help.

+7
source share
3 answers

I have a possible workaround:

Since departStatus has the base type xsd:string , you should be able to change all occurrences of type departStatus to xsd:string in the WSDL file.

This way you can pass / interpret the string 'DEPARTED' or 'NON-DEPARTED' instead of using an enum.

+1
source

Delphi SOAP Runtime and Importer Update

http://cc.embarcadero.com/Item/24535

+1
source

If the Delphi runtime (.Net) does not support hyphens in enum names, I would create a basic test application using Visual Studio and C # to find out if it works there. Depending on the result, I would think to write a “proxy” service that can be used from Delphi (.Net). If support for the C # web service fails with the same error, then a Java proxy option might be a last resort.

Another idea is to filter the web request / response data from HTTP and convert spelling on the fly.

0
source

All Articles