Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

WSDL file produces error #37

Open
ladvoc opened this issue Nov 10, 2017 · 1 comment
Open

WSDL file produces error #37

ladvoc opened this issue Nov 10, 2017 · 1 comment

Comments

@ladvoc
Copy link

ladvoc commented Nov 10, 2017

Hello,

I am trying to use Lark to implement an ONVIF client in Swift. For those unfamiliar with the ONVIF specification, its goal is the "standardization of communication between IP-based physical security products."

ONVIF provides a number of documents which outline the networking specifications along with corresponding WSDL files.

I took the file titled device.wsdl from the networking specifications page and fed it into lark-generate-client:

.build/debug/lark-generate-client "https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl" > Sources/Client.swift

After running the command, the following error was produced:

error when parsing WSDL: schema element must have a name.

However, Client.swift was still created. But instead of containing Swift code, it instead contained a plain text list of names from the WSDL file:

GetServices
IncludeCapability
GetServicesResponse
Service
Namespace
XAddr
Capabilities
Version
GetServiceCapabilities
...

Any suggestions? Thanks in advance.

@Bouke
Copy link
Owner

Bouke commented Nov 12, 2017

There are a few types defined within a XSD https://www.onvif.org/ver10/schema/onvif.xsd which is included by the WSDL. The first two I ran into are these;

Currently Lark doesn't support the ref attribute on an element:

    <xs:complexType name="AttachmentData">
        <xs:sequence>
            <xs:element ref="xop:Include"/>
        </xs:sequence>
        <xs:attribute ref="xmime:contentType" use="optional"/>
    </xs:complexType>

Currently Lark doesn't support a complexType with simpleContent:

    <xs:complexType name="CertificateUsage">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="Critical" type="xs:boolean" use="required"></xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

Currently Lark doesn't support a complexType with a choice value type:

<xs:complexType name="ColorOptions">
    <xs:annotation>...</xs:annotation>
    <xs:choice>
        <xs:element name="ColorList" type="tt:Color" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>List the supported color.</xs:documentation>
            </xs:annotation>
        </xs:element>
        <xs:element name="ColorspaceRange" type="tt:ColorspaceRange" maxOccurs="unbounded">
            <xs:annotation>
                <xs:documentation>Define the rang of color supported.</xs:documentation>
            </xs:annotation>
        </xs:element>
    </xs:choice>
    <xs:anyAttribute processContents="lax"></xs:anyAttribute>
</xs:complexType>

Ideally Lark would support these message types. Or maybe skip the parts of the WSDL/XSD it cannot deal with. I've created a branch feature/more-complex and committed three failing tests for each of the types listed above. I don't know if/when I might have time to further look at this, but at least it's recorded somewhere now.

However at this moment you'd have to work around the limitations of Lark to get the client generated. It shouldn't be too hard by running lark-generate-client from Xcode and put in a small workaround at those spots it's throwing a error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants