bet365 / soap

Make it easy to use SOAP from Erlang
Apache License 2.0
200 stars 74 forks source link

undefined function generating using example code #38

Closed hez closed 6 years ago

hez commented 6 years ago
$ erl -pa ebin
Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.2  (abort with ^G)
1> soap:erlang2wsdl("contacts.hrl", "contacts", "http://localhost:8080").
** exception error: undefined function erlsom_type2xsd:translate_forms/2
     in function  soap_hrl2wsdl:file/4 (src/soap_hrl2wsdl.erl, line 63)

Using the example hrl file from documentation


-spec store(Parsed_body::#person{},
    Soap_req::soap:soap_req(), State::soap:soap_handler_state())
    -> soap:soap_handler_response(contacts_response()).

-record(person, {
        '@id' :: integer(),          %% will be an attribute "id" in the XML
        first_name :: string(),
        last_name = "" :: string(),  %% will mandatory in the XSD
        children :: [#child{}],
        married :: boolean(),
        age :: non_neg_integer(),
        height :: float(),
        hobbies :: [string()],
        address :: #po_box{} | #home_address{}}).

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

-record(child, {
        name :: string(),
        age :: non_neg_integer()}).

-record(po_box, {
        number :: integer(),
        city :: string(),
        zip :: string()}).

-record(home_address, {
        street :: string(),
    number :: integer(),
        city :: string(),
        zip :: string()}).

-record(contacts_response, {
        result = "ok" :: string()}).

-type contacts_response() :: #contacts_response{}.```
hez commented 6 years ago
1> soap:module_info().
[{module,soap},
 {exports,[{start_server,1},
           {start_server,2},
           {stop_server,1},
           {stop_server,2},
           {wsdl2erlang,1},
           {wsdl2erlang,2},
           {make_test_client,1},
           {make_test_client,2},
           {erlang2wsdl,3},
           {erlang2wsdl,4},
           {module_info,0},
           {module_info,1}]},
 {attributes,[{vsn,[11962026284594305536759180121327666657]}]},
 {compile,[{options,[debug_info,{i,"include"}]},
           {version,"7.1.4"},
           {source,"/Users/.../soap/src/soap.erl"}]},
 {native,false},
 {md5,<<8,255,205,110,33,90,34,170,34,45,149,48,116,70,5,
        225>>}]
hez commented 6 years ago

I think I eventually figured it out, needed to add erlsom to the load path

worked when run with: erl -pa ebin deps/erlsom/ebin/