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

wsdl2erlang client generation: Namespace not found #32

Open
sveinfid opened this issue Oct 1, 2017 · 3 comments
Open

wsdl2erlang client generation: Namespace not found #32

sveinfid opened this issue Oct 1, 2017 · 3 comments

Comments

@sveinfid
Copy link

sveinfid commented Oct 1, 2017

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)

@willemdj
Copy link
Contributor

(Probably this response comes too late to help you, but in case other people run into this problem)

If the location of the include file starts with "http://" or "https://", soap:wsdl2erlang will try to retrieve it from the url. If not, it will try to get it from disk.

You can modify this behavior by providing an erlsom_option (erlsom is the parser that is used to parse the WSDL). Erlsom offers various options to find included files, for example you can pass a list of directories or your own function to locate the XSD given the namespace.

@elielhaouzi
Copy link

Hi @sveinfid, did you success to resolve the bug of "Namespace not found.." ? I have the same error.

@willemdj can you explain how to pass option to erlsom to fix this bug ?

Thanks

@willemdj
Copy link
Contributor

willemdj commented Aug 4, 2018

Something like:

soap:wsdl2erlang("http://my_host/path?wsdl", [{erlsom_options, [{include_fun, IncludeFun}]]).

where IncludeFun is a function that finds the files that are included or imported in the XSD. It should be a function that takes 4 arguments:

  • Namespace (from the XSD). This is a string or 'undefined'
  • SchemaLocation (from the XSD). This is a string or 'undefined'
  • Include_files. This is the value of the ‘include_files’ option if this option was passed to compile_xsd(); [] otherwise.
  • Include_dirs. This is the value of the ‘include_dirs’ option if this option was passed to compile_xsd(); 'undefined' otherwise.

Include_fun should return {XSD, Prefix}, where XSD is a XSD = string(), Prefix = string or 'undefined' - if the value is undefined, ‘P’ will be used.

There are other erlsom_options that you might use, for example you can pass the name of a directory where the files are located. See https://github.com/willemdj/erlsom/blob/master/doc/reference.md#compile_xsd

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

3 participants