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

I get this issue when trying to generate a server module from WSDL #41

Open
SserwangaV opened this issue Jun 19, 2018 · 9 comments
Open

Comments

@SserwangaV
Copy link

Select a prefix for URI https://example.com./service.wsdl
1: No prefix
2: P0
3: Specify a custom prefix
Select a number: 2
** exception error: no case clause matching false
in function erlsom_lib:getTypeFromElement/2 (src/erlsom_lib.erl, line 1046)
in call from soap_parse_wsdl:type_for_part/2 (src/soap_parse_wsdl.erl, line 422)
in call from soap_parse_wsdl:'-type_for_message/3-lc$^0/1-0-'/2 (src/soap_parse_wsdl.erl, line 408)
in call from soap_parse_wsdl:process_op/3 (src/soap_parse_wsdl.erl, line 385)
in call from soap_parse_wsdl:'-process_ops/3-lc$^0/1-0-'/4 (src/soap_parse_wsdl.erl, line 377)
in call from soap_parse_wsdl:get_ops_from_port_type/2 (src/soap_parse_wsdl.erl, line 359)
in call from soap_parse_wsdl:get_ops_from_binding/2 (src/soap_parse_wsdl.erl, line 287)
in call from soap_parse_wsdl:get_operations/2 (src/soap_parse_wsdl.erl, line 254)

@willemdj
Copy link
Contributor

If you can share the WSDL, I can have a look.

@SserwangaV
Copy link
Author

@willemdj This is the WSDL

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="https://example.com/bankservice?wsdl">
wsdl:types
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="https://example.com/bankservice?wsdl" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="commitResponseSchool" type="tns:commitResponseSchool"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="bankingDetail" type="tns:bankingDetail"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="serviceFee" type="tns:serviceFee"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="enquireResponseSchool" type="tns:enquireResponseSchool"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="enquireRequestSchool" type="tns:enquireRequestSchool"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="enquireResponseScholar" type="tns:enquireResponseScholar"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="enquireRequestScholar" type="tns:enquireRequestScholar"/>
<xsd:complexType name="commitResponseSchool">
xsd:sequence
<xsd:element name="responseStatus" type="xsd:string"/>
<xsd:element name="responseStatusMeaning" type="xsd:string"/>
<xsd:element name="schoolId" type="xsd:string"/>
<xsd:element name="receiptNo" type="xsd:string"/>
<xsd:element name="transactionId" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="bankingDetail">
xsd:sequence
<xsd:element name="bankCode" type="xsd:string"/>
<xsd:element name="bankAcCode" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="serviceFee">
xsd:sequence
<xsd:element name="serviceFeeID" type="xsd:string"/>
<xsd:element name="description" type="xsd:string"/>
<xsd:element name="feeBalance" type="xsd:integer"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="bankingDetails" type="tns:bankingDetail" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="enquireResponseSchool">
xsd:sequence
<xsd:element name="responseStatus" type="xsd:string"/>
<xsd:element name="responseStatusMeaning" type="xsd:string"/>
<xsd:element name="authCode" type="xsd:string"/>
<xsd:element name="schoolId" type="xsd:string"/>
<xsd:element name="schoolName" type="xsd:string"/>
<xsd:element name="studySession" type="xsd:string" minOccurs="0"/>
<xsd:element xmlns:tns="https://example.com/bankservice?wsdl" name="schoolPays" type="tns:serviceFee" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="enquireRequestSchool">
xsd:sequence
<xsd:element name="schoolId" type="xsd:string"/>
<xsd:element name="agentCode" type="xsd:string"/>
<xsd:element name="requestSignature" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="enquireResponseScholar">
xsd:sequence
<xsd:element name="responseStatus" type="xsd:string"/>
<xsd:element name="responseStatusMeaning" type="xsd:string"/>
<xsd:element name="authCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="scholarId" type="xsd:string" minOccurs="0"/>
<xsd:element name="schoolId" type="xsd:string" minOccurs="0"/>
<xsd:element name="schoolName" type="xsd:string" minOccurs="0"/>
<xsd:element name="scholarName" type="xsd:string" minOccurs="0"/>
<xsd:element name="feesBalance" type="xsd:integer" minOccurs="0"/>
<xsd:element name="agentCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="bankCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="bankAcCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="studySession" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="enquireRequestScholar">
xsd:sequence
<xsd:element name="scholarId" type="xsd:string" minOccurs="0"/>
<xsd:element name="schoolId" type="xsd:string" minOccurs="0"/>
<xsd:element name="bankCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="agentCode" type="xsd:string" minOccurs="0"/>
<xsd:element name="requestSignature" type="xsd:string" minOccurs="0"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="commitRequestScholarIn">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:commitRequestScholar"/>
</wsdl:message>
<wsdl:message name="commitRequestSchoolIn">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:commitRequestSchool"/>
</wsdl:message>
<wsdl:message name="commitResponseScholarOut">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:commitResponseScholar"/>
</wsdl:message>
<wsdl:message name="commitResponseSchoolOut">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:commitResponseSchool"/>
</wsdl:message>
<wsdl:message name="enquireRequestScholarIn">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:enquireRequestScholar"/>
</wsdl:message>
<wsdl:message name="enquireRequestSchoolIn">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:enquireRequestSchool"/>
</wsdl:message>
<wsdl:message name="enquireResponseScholarOut">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:enquireResponseScholar"/>
</wsdl:message>
<wsdl:message name="enquireResponseSchoolOut">
<wsdl:part xmlns:tns="https://example.com/bankservice?wsdl" name="parameters" element="tns:enquireResponseSchool"/>
</wsdl:message>
<wsdl:portType name="bankservicePortType">
<wsdl:operation name="commitRequestSchool">
<wsdl:input xmlns:tns="https://example.com/bankservice?wsdl" message="tns:commitRequestSchoolIn"/>
<wsdl:output xmlns:tns="https://example.com/bankservice?wsdl" message="tns:commitResponseSchoolOut"/>
</wsdl:operation>
<wsdl:operation name="enquireRequestSchool">
<wsdl:input xmlns:tns="https://example.com/bankservice?wsdl" message="tns:enquireRequestSchoolIn"/>
<wsdl:output xmlns:tns="https://example.com/bankservice?wsdl" message="tns:enquireResponseSchoolOut"/>
</wsdl:operation>
<wsdl:operation name="commitRequestScholar">
<wsdl:input xmlns:tns="https://example.com/bankservice?wsdl" message="tns:commitRequestScholarIn"/>
<wsdl:output xmlns:tns="https://example.com/bankservice?wsdl" message="tns:commitResponseScholarOut"/>
</wsdl:operation>
<wsdl:operation name="enquireRequestScholar">
<wsdl:input xmlns:tns="https://example.com/bankservice?wsdl" message="tns:enquireRequestScholarIn"/>
<wsdl:output xmlns:tns="https://example.com/bankservice?wsdl" message="tns:enquireResponseScholarOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding xmlns:tns="https://example.com/bankservice?wsdl" name="bankserviceBinding" type="tns:bankservicePortType">
<soap:binding xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="commitRequestSchool">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="commitRequestSchool" 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:operation name="enquireRequestSchool">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="enquireRequestSchool" 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:operation name="commitRequestScholar">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="commitRequestScholar" 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:operation name="enquireRequestScholar">
<soap:operation xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="enquireRequestScholar" 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="bankservice">
<wsdl:port xmlns:tns="https://example.com/bankservice?wsdl" name="bankserviceSoap" binding="tns:bankserviceBinding">
<soap:address xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" location="https://example.com"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

@willemdj
Copy link
Contributor

willemdj commented Jun 20, 2018 via email

@SserwangaV
Copy link
Author

@willemdj I generated that WSDL from the Erlang header file "bankservice.hrl" below using soap:erlang2wsdl("bankservice.hrl", "bankservice", "https://example.com", [{target_namespace, "https://example.com/bankservice?wsdl"}]). Please if there is anything I'm not doing properly from the .hrl file let me know. Thank you.

-spec enquireRequestScholar(Parsed_body::#enquireRequestScholar{},
Soap_req::soap:soap_req(), State::soap:soap_handler_state())
-> soap:soap_handler_response(enquireResponseScholar()).

-spec commitRequestScholar(Parsed_body::#commitRequestScholar{},
Soap_req::soap:soap_req(), State::soap:soap_handler_state())
-> soap:soap_handler_response(commitResponseScholar()).

-spec enquireRequestSchool(Parsed_body::#enquireRequestSchool{},
Soap_req::soap:soap_req(), State::soap:soap_handler_state())
-> soap:soap_handler_response(enquireResponseSchool()).

-spec commitRequestSchool(Parsed_body::#commitRequestSchool{},
Soap_req::soap:soap_req(), State::soap:soap_handler_state())
-> soap:soap_handler_response(commitResponseSchool()).

-record(enquireRequestScholar, {
scholarId :: string(),
schoolId :: string(),
bankCode :: string(),
agentCode :: string(),
requestSignature :: string()}).

-type enquireRequestScholar() :: #enquireRequestScholar{}.

-record(enquireResponseScholar, {
responseStatus = "" :: string(),
responseStatusMeaning = "" :: string(),
authCode :: string(),
scholarId :: string(),
schoolId :: string(),
schoolName :: string(),
scholarName :: string(),
feesBalance :: integer(),
agentCode :: string(),
bankCode :: string(),
bankAcCode :: string(),
studySession :: string()
}).

-type enquireResponseScholar() :: #enquireResponseScholar{}.

-record(enquireRequestSchool, {
schoolId = "" :: string(),
agentCode = "" :: string(),
requestSignature = "" :: string()
}).

-type enquireRequestSchool() :: #enquireRequestSchool{}.

-record(enquireResponseSchool, {
responseStatus = "" :: string(),
responseStatusMeaning = "" :: string(),
authCode = "" :: string(),
schoolId = "" :: string(),
schoolName = "" :: string(),
studySession :: string(),
schoolPays :: [#serviceFee{}]
}).

-type enquireResponseSchool() :: #enquireResponseSchool{}.

-record(serviceFee, {
serviceFeeID = "" :: string(),
description = "" :: string(),
feeBalance = 0 :: integer(),
bankingDetails :: [#bankingDetail{}]
}).

-type serviceFee() :: #serviceFee{}.

-record(bankingDetail,{
bankCode = "" :: string(),
bankAcCode = "" :: string()
}).

-type bankingDetail() :: #bankingDetail{}.

-record(commitRequestSchool, {
authCode = "" :: string(),
schoolId = "" :: string(),
transactionId = "" :: string(),
serviceFeeID = "" :: string(),
amountPaid = 0 :: integer(),
formOfPayment :: string(),
paidBy :: string(),
financialAgent :: string(),
agentCode :: string(),
}).

-type commitRequestSchool() :: #commitRequestSchool{}.

-record(commitResponseSchool, {
responseStatus = "" :: string(),
responseStatusMeaning = "" :: string(),
schoolId = "" :: string(),
receiptNo = "" :: string(),
transactionId = "" :: string()
}).

-type commitResponseSchool() :: #commitResponseSchool{}.

@willemdj
Copy link
Contributor

It looks like something is broken. But when I tried your command I got another error:

soap:erlang2wsdl("bankservice.hrl", "bankservice", "https://example.com", [{target_namespace, "https://example.com/bankservice?wsdl"}]).
** exception throw: {error,"Wrong Type in attribute type, expected qname, got {{qname,"https://example.com/bankservice?wsdl\",\"bankingDetail\",\"tns\",\"tns\"},\n undefined,undefined}"}
in function erlsom_write:processAttributes/5 (src/erlsom_write.erl, line 435)
in call from erlsom_write:processAlternativeValue/8 (src/erlsom_write.erl, line 306)
in call from erlsom_write:processElementValues/7 (src/erlsom_write.erl, line 239)
in call from erlsom_write:struct2xml/6 (src/erlsom_write.erl, line 130)
in call from erlsom_write:processAlternativeValue/8 (src/erlsom_write.erl, line 326)
in call from erlsom_write:processElementValues/7 (src/erlsom_write.erl, line 239)
in call from erlsom_write:struct2xml/6 (src/erlsom_write.erl, line 114)
in call from erlsom_write:processAlternativeValue/8 (src/erlsom_write.erl, line 326)

Did you do something to work around this problem?

@willemdj
Copy link
Contributor

Also, there are some problems with your .hrl file. commitRequestScholar and commitResponseScholar are missing. And there is a comma after the last element of #commitRequestSchool{} that should not be there.

I think that this is causing the problems that you are seeing.

@SserwangaV
Copy link
Author

@willemdj I have named the .hrl to .txt such that i avoid copying the contents here
bankservice.txt

When I run the function below I get the WSDL also attached here
soap:erlang2wsdl("bankservice.hrl", "bankservice", "https://example.com", [{target_namespace, "https://example.com/bankservice?wsdl"}]).

WSDL (renamed bankservice_wsdl.txt from bankservice.wsdl for purposes of uploading)
bankservice_wsdl.txt

But when is try generating the server, soap:wsdl2erlang("bankservice.wsdl"), I get the error above.

I have tried to provide the exact files I used that is why I have used attachments.

I'm surely stuck! Sorry for improperly copying those files before.

@willemdj
Copy link
Contributor

There is a comma on line 123 of bankservice.txt, that is incorrect. Can you try what happens if you remove it?

@SserwangaV
Copy link
Author

@willemdj Thank you guys very much! It has finally worked.

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