bet365 / soap

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

Import XSDs With Relative Path #31

Closed greenyouse closed 7 years ago

greenyouse commented 7 years ago

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.

willemdj commented 7 years ago

See the (general) comment to issue #32. There are various options to tell the tool how to find included XSDs. I think it should actually work also with relative paths, but they will be considered relative to the current working directory. Making them relative to something else (the location of the including file?) might be confusing, perhaps.

greenyouse commented 7 years ago

Thanks, I overlooked the erlsom options for including XSD files. That works for importing XSDs with relative paths.

I had a larger project so I ended up converting the relative paths to absolute and that seemed to work too but it was much more of a hack.