GithubHelp home page GithubHelp logo

soap's People

Contributors

cmullaparthi avatar define-null avatar willemdj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

soap's Issues

Parsing error messages

Hi,
I use the library to consume SOAP service and when error 500 occurres, the XML returns as string, like following:

{:error,
 {:client,
  {:parsing_message, 500,
   [{'connection', 'close'}, {'date', 'Mon, 21 Aug 2017 09:13:58 GMT'},
    {'server', 'serverName'}, {'content-length', '525'},
    {'content-type', 'text/xml;charset=utf-8'}], :error, :function_clause}},
 "<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><S:Fault xmlns:ns4=\"http://www.w3.org/2003/05/soap-envelope\"><faultcode>S:Server</faultcode><faultstring>FailtString</faultstring><detail><ns2:RecordName xmlns:ns2=\"http://soap.url\"><errorCode>NOT_FOUND</errorCode><message>Error Message</message></ns2:RecordName></detail></S:Fault></S:Body></S:Envelope>"}

There is generated record for fault message, but it is not used.

-record('P:RecordName ', {
	errorCode :: string() | undefined,
	message :: string() | undefined}).

How to make it parse XML into a erlang records when SOAP service returns an error?

If wsdl:part have "type" attribute and haven't "element" attribute, give error message.

For example,

<wsdl:message name="getLibSysCodeResponse">
<wsdl:part name="getLibSysCode" type="xsd:string" />
</wsdl:message>

LocalPart = erlsom_lib:localName(Element), <---- throw here.

I have changed soap_parse_wsdl.erl as follows, still have error.

type_for_message(#'wsdl:definitions'{message = Messages}, Message, Model) ->
    case lists:keyfind(Message, #'wsdl:message'.name, Messages) of
        false ->
            {error, "Message " ++ Message ++ " not found"};
        #'wsdl:message'{part = Parts} when length(Parts) /= 1 ->
            {error, "Message " ++ Message ++ " does not have exactly 1 part"};
        A = #'wsdl:message'{part = [#'wsdl:part'{element = Element,type=Type}]} ->
            %% what we need is the type
            lager:debug("_381:~n\t~p",[A]),
            case Element of
                undefined ->
                    Type;
                _ ->
                    LocalPart = erlsom_lib:localName(Element),
                    Uri = erlsom_lib:getUriFromQname(Element),
                    Prefix = erlsom_lib:getPrefixFromModel(Model, Uri),
                    Element_name = case Prefix of 
                                       undefined ->
                                           LocalPart;
                                       "" ->
                                           LocalPart;
                                       _ -> 
                                           Prefix ++ ":" ++ LocalPart
                                   end,
                    type_for_element(list_to_atom(Element_name), Model)                    
            end
    end.
2016-04-30 10:18:59.993 [debug] |erlsom|erlsom_example_value|from_type|63|Undefined|Undefined|Undefined|Undefined|Undefined|Undefined|Undefined|_62:
        {qname,"http://www.w3.org/2001/XMLSchema","string","xsd","xsd"}
        2
        [{type,'_document',sequence,[{el,[],1,1,undefined,2}],[],undefined,undefined,1,1,1,false,undefined}]
** exception throw: {error,"Type not found",
                           {qname,"http://www.w3.org/2001/XMLSchema","string","xsd",
                                  "xsd"}}
     in function  erlsom_example_value:from_type/3 (src/erlsom_example_value.erl, line 66)
     in call from soap_test_module:make_function/5 (src/soap_test_module.erl, line 115)
     in call from soap_test_module:'-make_functions/4-lc$^0/1-0-'/5 (src/soap_test_module.erl, line 109)
     in call from soap_test_module:from_interface/5 (src/soap_test_module.erl, line 94)
     in call from soap_compile_wsdl:file/5 (src/soap_compile_wsdl.erl, line 104)

Soap Server Protocol for Cowboy 2

Hi,

I'm using your library for exposing a couple of soap services over Cowboy 2. I noticed that your protocol was out of date with regards to the upgrade method signature provided by Cowboy as well as with the change from cowboy_req:body to cowboy_req:read_body. I've made a change on my forked repo which seems to work perfectly, I was just wondering if you accept pull requests and what you require before you do.

Regards,
Paolo

Parameter types cannot be reused

It looks like here:

case lists:keyfind(Record_type, #op.in_type, Operations) of

a function name in the server handler module is selected based on the record type of input parameters. But what if the same record type (i.e. same parameter type) is used in different operations (and then the first match is always currently used)?
Maybe it would be more correct selecting a function based on soap_action from the request?

https / ssl

support for https would be a huge improvement. Inets has support for it, but you have to pass it as an option.

Error when parsing a WSDL

When using soap:wsdl2erlang(...). on http://demo-hotelws.touricoholidays.com/HotelFlow.svc?wsdl, I get the following.

** exception error: no function clause matching 
                    soap_parse_wsdl:'-services/1-lc$^0/1-0-'(undefined) (src/soap_parse_wsdl.erl, line 116)
     in function  soap_parse_wsdl:get_services/3 (src/soap_parse_wsdl.erl, line 107)
     in call from soap_parse_wsdl:get_services/3 (src/soap_parse_wsdl.erl, line 112)
     in call from soap:wsdl2erlang/2 (src/soap.erl, line 305)

A little investigation shows that erlsom:scan(...) is returning a bunch of undefined elements for the imported document at http://demo-hotelws.touricoholidays.com/HotelFlow.svc?wsdl=wsdl0.

So, it is possible that this is erlsom's problem. Or, it could be a problem with the model being passed to erlsom:scan.

In any case, could you take a look at this, please? All help is appreciated. Thanks!

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

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.

Parse WSDL Without Services

I have some WSDLs that pull in services from other WSDLs using imports. When I try running soap:wsdl2erlang on the files, it errors out with:

** exception error: no function clause matching 
                    soap_parse_wsdl:'-services/1-lc$^0/1-0-'(undefined) (src/soap_parse_wsdl.erl, line 114)
     in function  soap_parse_wsdl:get_services/3 (src/soap_parse_wsdl.erl, line 105)
     in call from soap_parse_wsdl:get_services/3 (src/soap_parse_wsdl.erl, line 110)
     in call from soap:wsdl2erlang/2 (/tmp/soap/_build/default/lib/soap/src/soap.erl, line 305)

For reproduction I uploaded a modified version of the w3schools TempConverter WSDL from the docs. There's a services WSDL that contains all the services and an abstract WSDL with the rest of the code.

I'm not sure what the best way to handle this would be. In Java wsimport outputs class files for each service but since this outputs a file per WSDL maybe there's a way to merge abstract and service WSDLs? If this doesn't sound like a common use case then feel free to close it and I'll stick to editing the files by hand.

soap generate wrong interface for WSDL with overloaded functions

Hello,

just found soap generates multiple equals functions (the only difference is specs) from WSDL with the same overloaded RPC calls. This ends up with errors during compilation like:

api_client.erl:48: spec for 'CardIssueRequest'/3 already defined
api_client.erl:51: function 'CardIssueRequest'/3 already defined
api_client.erl:54: spec for 'CardIssueRequest'/3 already defined
api_client.erl:57: function 'CardIssueRequest'/3 already defined

After removing duplicate lines from erlang file and editing specs it works fine.

WSDL parsing error

Hello!
I'm trying to use wsdl2erlang with complex wsdl from here(file air_v41_0/Air.wsdl), and I got this

soap:wsdl2erlang("air_v41_0/Air.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: 2
** 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/",
                                                                                      "binding",[],
                                                                                      [{attribute,"type",[],[],"tns:EMDRetrievePortType"},
                                                                                       {attribute,"name",[],[],"EMDRetrieveBinding"}]}}]}
     in function  soap_parse_wsdl:get_services/3 (/Users/anatolynosov/projects/search/deps/soap/src/soap_parse_wsdl.erl, line 104)
     in call from soap:wsdl2erlang/2 (/Users/anatolynosov/projects/search/deps/soap/src/soap.erl, line 305)

And I have no idea what's going wrong. Any suggestions?

Thank you.

Namespace not found when parsing a wsdl file (that works with parser from other languages)

When parsing the attached file
api.wsdl.txt
(remove .txt before testing. github doesn't accept a .wsdl file)

I get:

Erlang/OTP 20 [erts-9.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Eshell V9.2  (abort with ^G)
1> soap_parse_wsdl:get_namespaces("api.wsdl",[]).
** exception error: no match of right hand side value {error,"Namespace not found http://common.dto.ws.hss.onevox.com"}
     in function  soap_parse_wsdl:add_schemas/5 (/Users/joel/src/soaptest/deps/soap/src/soap_parse_wsdl.erl, line 214)
     in call from soap_parse_wsdl:parse_wsdls/3 (/Users/joel/src/soaptest/deps/soap/src/soap_parse_wsdl.erl, line 146)
     in call from soap_parse_wsdl:file/4 (/Users/joel/src/soaptest/deps/soap/src/soap_parse_wsdl.erl, line 80)
     in call from soap_parse_wsdl:get_model/2 (/Users/joel/src/soaptest/deps/soap/src/soap_parse_wsdl.erl, line 55)
     in call from soap_parse_wsdl:get_namespaces/2 (/Users/joel/src/soaptest/deps/soap/src/soap_parse_wsdl.erl, line 66)
2> 

And I can't manage to find the problem. Obviously there is no error when parsing the file with soap libraries of other programming languages (python, ruby).

undefined function generating using example code

$ 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{}.```

Wrong Type in attribute type, expected qname

When running soap:erlang2wsdl("store.hrl", "store", "http://localhost:8080") in the examples provided for generating an WSDL from Erlang specifications, i get this error:

** exception throw: {error,"Wrong Type in attribute type, expected qname, got {{qname,\"http://www.w3.org/2001/XMLSchema\",\"string\",undefined,undefined},\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)

soap_server_cowboy_2 fails to work with {reason,undef}

I am trying to access the soap exposed functions through the ibrowse client on a soap_server using cowboy_v2 but getting an error (see error.txt) but when I use the mochiweb as the server I get no problem. What could be the cause of the error when it comes to cowboy_v2?

Not able to parse the DIDWW wsdl

Hello,

I have the following wsdl files:

https://sandbox-api.didww.com/api2/index.php?wsdl
https://api.didww.com/api2/?wsdl

But I'm not able to generate the client.

soap:wsdl2erlang("conf/did-sandbox.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,
                                                       "Include file not found (undefined)"}
     in function  soap_parse_wsdl:add_schemas/5 (src/soap_parse_wsdl.erl, line 212)
     in call from soap_parse_wsdl:parse_wsdls/3 (src/soap_parse_wsdl.erl, line 146)
     in call from soap_parse_wsdl:file/4 (src/soap_parse_wsdl.erl, line 80)
     in call from soap_parse_wsdl:get_model/2 (src/soap_parse_wsdl.erl, line 55)
     in call from soap_parse_wsdl:get_namespaces/2 (src/soap_parse_wsdl.erl, line 66)
     in call from soap:wsdl2erlang/2 (src/soap.erl, line 313)

Silviu

XSD includes are expected in local file system

When I try to parse a WSDL with remote XSD includes, the XSDs are expected in local file system which breaks the parsing:

soap:wsdl2erlang("http://reiseauskunftdritte.bahn.de/webservices/reiseauskunft/v1?wsdl").

Select client; yes, client only; ibrowse

...

** exception error: no match of right hand side value {error,"Include file not found http://reiseauskunftdritte.bahn.de:80/webservices/reiseauskunft/v1?xsd=3"}
in function soap_parse_wsdl:add_schemas/5 (src/soap_parse_wsdl.erl, line 212)
in call from soap_parse_wsdl:parse_wsdls/3 (src/soap_parse_wsdl.erl, line 146)
in call from soap_parse_wsdl:file/4 (src/soap_parse_wsdl.erl, line 80)
in call from soap_parse_wsdl:get_model/2 (src/soap_parse_wsdl.erl, line 55)
in call from soap_parse_wsdl:get_namespaces/2 (src/soap_parse_wsdl.erl, line 66)
in call from soap:wsdl2erlang/2 (src/soap.erl, line 313)

exception error: undefined function soap:wsdl2erlang/1

I am not able to call soap:wsdl2erlang function.

 -> soap:wsdl2erlang("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL").
** exception error: undefined function soap:wsdl2erlang/1

 -> code:get_path().
["deps/yamerl/ebin","deps/unicode_util_compat/ebin",
 "deps/ssl_verify_fun/ebin","deps/soap/ebin",
 "deps/ranch/ebin","deps/poolboy/ebin","deps/mimerl/ebin",
 "deps/metrics/ebin","deps/idna/ebin","deps/hackney/ebin",
 "deps/erlsom/ebin","deps/detergent/ebin","deps/cowlib/ebin",
 "deps/cowboy/ebin","deps/certifi/ebin",".",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/kernel-5.4.1/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/stdlib-3.4.3/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/xmerl-1.3.16/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/wx-1.8.3/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/tools-2.11.1/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/syntax_tools-2.1.4/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/ssl-8.2.3/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/ssh-4.6.4/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/snmp-5.2.9/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/sasl-3.1.1/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/runtime_tools-1.12.3/ebin",
 "/usr/local/Cellar/erlang/20.2.2/lib/erlang/lib/reltool-0.7.5/ebin",
 [...]|...]

bug: soap_fault:parse_fault_1_1 funciton_clause

soap_fault module fails on parsing xml that looks like this

<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soap:Body>
<soap:Fault>
  <faultcode>soap:Server</faultcode>
  <faultstring>Some description goes here</faultstring>
  <detail><ns2:SomeTag xmlns:ns2=\"http://some_namespace_goes_here/\">
             <tag1>something</tag1>
             <tag2>something else</tag2>
         </ns2:SomeTag>
  </detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

The stacktrace looks like:

  "stacktrace" : [
    "{soap_fault,parse_fault_1_1, [{startElement,[],\"tag1\",[],[]}, 
[{\"ns2\",\"http://some_namespace_goes_here/\"},
{\"soap\",\"http://schemas.xmlsoap.org/soap/envelope/\"}],             
{pf_state,'1.1',detail,[], {faultcode,\"http://schemas.xmlsoap.org/soap/envelope/\",\"Server\",undefined}, \"Some description goes here\", undefined,[],undefined,  {\"SomeTag\",\"http://some_namespace_goes_here\"}, []}], [{file,\"src/soap_fault.erl\"},{line,327}]}",
    "{soap_client_util,xml_parser_cb,2,[{file,\"src/soap_client_util.erl\"},{line,421}]}",
    "{erlsom_sax_utf8,wrapCallback,2,[{file,\"src/erlsom_sax_utf8.erl\"},{line,1408}]}",
    "{erlsom_sax_utf8,parseContentLT,2,[{file,\"src/erlsom_sax_utf8.erl\"},{line,936}]}",
    "{erlsom_sax_utf8,parse,2,[{file,\"src/erlsom_sax_utf8.erl\"},{line,196}]}",
    "{soap_client_util,parse_xml,9,[{file,\"src/soap_client_util.erl\"},{line,259}]}",
    ...

Generated Client doesnt work in Elixir Distillery Release

I used this library to generate the Client out of my wsdl files.

All works fine in my dev environment - i can successfully call the services.

The Problem:
When I build a Elixir Release by Distillery it seems not to work at all.
I get following back by the previous generated Client:

{:error, {:client, {:encoding_body, :error, :undef}}, ""}

I thought about a path problem regarding hrl-records (include folder) or generated client (src folder). All tries - no luck.
Moreover my application is an Umbrella-Application (maybe there is a problem..?)

Any help appreciated!

Using lists in hrl to create wsdl errors

Using part of the example from https://github.com/bet365/soap/blob/master/doc/generating_a_wsdl.md

-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
        married :: boolean(),
        age :: non_neg_integer(),
        height :: float(),
        hobbies :: [string()]
}).

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

errors with

1> soap:erlang2wsdl("contacts.hrl", "contacts", "http://localhost:8080").
** exception throw: {error,"Wrong Type in attribute type, expected qname, got {{qname,\"http://www.w3.org/2001/XMLSchema\",\"string\",undefined,undefined},\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)

undefined function soap_compile_wsdl:get_services

I keep getting:
** exception error: undefined function soap_compile_wsdl:get_services/2
in function soap:wsdl2erlang/2 (soap.erl, line 305)

While running "soap:wsdl2erlang".

OTP_version: 23.0.4

Running on mac OSX - Mojave 10.14.6

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

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)

WSDL -

Hi,

while trying to go with the procedure, I get an error while calling soap:wsdl2erlang("<local fs .wsdl>")


.
.
.
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,"Unexpected attribute (not namespace qualified): final"}},
{stack,[schemaType]},
{received,{startElement,"http://www.w3.org/2001/XMLSchema",
"simpleType","xs",
[{attribute,"final",[],[],"restriction"},
{attribute,"name",[],[],"LocationServiceType"}]}}]}


Though, if I use SoapUI with this wsdl and it works.

This error is something that I don't know how to interpret.

I am really not sure how to proceed

Best

wsdl2erlang client generation: Namespace not found

I'm trying to generate a client using wsdl2erlang, and I'm seeing the following error "Namespace not found".

Any ideas what could be wrong here?

The namespace in question is without a http:// prefix, could that be the issue?

2> soap:wsdl2erlang("http://my_host/path?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: 2

Which http client must be used?
1: ibrowse
2: inets
Select a number: 2
** exception error: no match of right hand side value {error,
"Namespace not found my.namespace.here"}
in function soap_parse_wsdl:add_schemas/5 (src/soap_parse_wsdl.erl, line 213)
in call from soap_parse_wsdl:parse_wsdls/3 (src/soap_parse_wsdl.erl, line 146)
in call from soap_parse_wsdl:file/4 (src/soap_parse_wsdl.erl, line 80)
in call from soap_parse_wsdl:get_model/2 (src/soap_parse_wsdl.erl, line 55)
in call from soap_parse_wsdl:get_namespaces/2 (src/soap_parse_wsdl.erl, line 66)
in call from soap:wsdl2erlang/2 (src/soap.erl, line 313)

How to use soap in service with different environments?

Hello,

I have remote service with almost the same WSDL interface, the only difference is it's environment: test and production. Test uses own targetNamespace which is different form production. What is the best way to deal with such kind services using soap? Should I generate two client and switch them in runtime, or does soap have any instruments for configure namespace for programmatically?

Redefinition of macros and records

In order to compose several service requests I need to include some *.hrl files generated with soap:wsdl2erlang/1. The problem is that including them in the same module leads to compile errors because of the redefinition of the macro INTERFACE and the records faultdetail, faultcode, faultreasong, soap_fault_1_1, soap_fault_1_2 and qname.

I think it is not very difficult to avoid the problem:

  • I see the records are available from soap_fault.hrl and soap_wsdl_*.hrl.
  • Generated macro INTERFACE could include the name of the service in its name: INTERFACE_My_Service.
  • Generators should take into account that macro INTERFACE changes its name to the proper one.

The only limit, I think, is that qname record is defined in soap_wsdl_1_1.hrl and soap_wsdl_2_0.hrl and the client code should decide on which one to include.

What do you think?

PS. What a nice tool and library! Thanks!

Import XSDs With Relative Path

I have some WSDLs with XSD includes that use relative paths. When running the tool it errors out on relative paths but works for full paths. Here's a sample error message:

** exception error: no match of right hand side value {error,
                                                       "Include file not found import.xsd"}
     in function  soap_parse_wsdl:add_schemas/5 (src/soap_parse_wsdl.erl, line 215)
     in call from soap_parse_wsdl:parse_wsdls/3 (src/soap_parse_wsdl.erl, line 148)
     in call from soap_parse_wsdl:file/4 (src/soap_parse_wsdl.erl, line 80)
     in call from soap_parse_wsdl:get_model/2 (src/soap_parse_wsdl.erl, line 55)
     in call from soap_parse_wsdl:get_namespaces/2 (src/soap_parse_wsdl.erl, line 66)
     in call from soap:wsdl2erlang/2 (/tmp/soap/_build/default/lib/soap/src/soap.erl, line 313)

I uploaded a case for repro that highlights the problem. There's a WSDL here and a XSD to import here.

This seems like a fairly common case. I could try working on a patch if this seems helpful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.