Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 - Unexpected event, expected end-tag error when wsdl:portType appears between wsdl:message elements #15

Open
define-null opened this issue Nov 16, 2016 · 1 comment

Comments

@define-null
Copy link
Contributor

While trying to generate erlang modules from wsdl faced with the following scenario:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="example.com/contacts">
    <wsdl:types>
        <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="example.com/contacts" elementFormDefault="qualified" attributeFormDefault="unqualified">
            <xsd:element xmlns:tns="example.com/contacts" name="contacts_response" type="tns:contacts_response"/>
            <xsd:element xmlns:tns="example.com/contacts" name="person" type="tns:person"/>
            <xsd:complexType name="contacts_response">
                <xsd:sequence>
                    <xsd:element name="result" type="xsd:string"/>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="person">
                <xsd:sequence>
                    <xsd:element name="first_name" type="xsd:string" minOccurs="0"/>
                </xsd:sequence>
                <xsd:attribute name="id" type="xsd:integer"/>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>

    <wsdl:message name="contacts_responseOut">
        <wsdl:part xmlns:tns="example.com/contacts" name="parameters" element="tns:contacts_response"/>
    </wsdl:message>

   <wsdl:portType name="contactsPortType">
        <wsdl:operation name="store">
            <wsdl:input xmlns:tns="example.com/contacts" message="tns:personIn"/>
            <wsdl:output xmlns:tns="example.com/contacts" message="tns:contacts_responseOut"/>
        </wsdl:operation>
    </wsdl:portType>

    <wsdl:message name="personIn">
        <wsdl:part xmlns:tns="example.com/contacts" name="parameters" element="tns:person"/>
    </wsdl:message>

    <wsdl:binding xmlns:tns="example.com/contacts" name="contactsBinding" type="tns:contactsPortType">
        <soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="store">
            <soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="store" style="document"/>
            <wsdl:input>
                <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="contacts">
        <wsdl:port xmlns:tns="example.com/contacts" name="contactsSoap" binding="tns:contactsBinding">
            <soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="http://localhost:8080"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
2> soap:wsdl2erlang("false.wsdl").
What must be generated?
1: client
2: server
3: both
Select a number: 1

Do you want to generate test stubs/skeletons?
1: no
2: yes, client only
3: yes, server only
4: yes, client and server
Select a number: 1

Which http client must be used?
1: ibrowse
2: inets
Select a number: 1
** exception error: no match of right hand side value {error,[{exception,{error,{"2 - Unexpected event, expected end-tag"}}},
                                                              {stack,['wsdl:definitions']},
                                                              {received,{startElement,"http://schemas.xmlsoap.org/wsdl/",
                                                                                      "message","wsdl",
                                                                                      [{attribute,"name",[],[],"personIn"}]}}]}
     in function  soap_parse_wsdl:get_services/3 (src/soap_parse_wsdl.erl, line 104)
     in call from soap:wsdl2erlang/2 (src/soap.erl, line 305)

Moving wsdl:portType below all wsdl:message elements solve the issue.
But I don't see any order specification in the wsdl schema, so guess it's potentially a bug in soap model.

@cmullaparthi
Copy link
Contributor

@willemdj any thoughts on this?

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

No branches or pull requests

2 participants