bet365 / soap

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

Error when parsing a WSDL #10

Open js-ojus opened 7 years ago

js-ojus commented 7 years ago

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!

js-ojus commented 7 years ago

Bumping this, because of urgency at my end! My apologies!

Could this be an erlsom issue @willemdj?

willemdj commented 7 years ago

I think that it is more likely to be caused by a somewhat unusual structure of the WSDL. You could for example try to replace the bit

<wsdl:import namespace="http://tourico.com/webservices/hotelv3" location="http://demo-hotelws.touricoholidays.com/HotelFlow.svc?wsdl=wsdl0"/> <wsdl:types/>

by the contents (the wsdl:types part) of http://demo-hotelws.touricoholidays.com/HotelFlow.svc?wsdl

js-ojus commented 7 years ago

Thanks for your quick reply @willemdj!

I have downloaded both WSDLs, modified the main one to include the imported types. When this modified version is given as input, the referred XSDs are no longer being fetched from the net.

** exception error: no match of right hand side value {error,
                                                       "Include file not found http://demo-hotelws.touricoholidays.com/HotelFlow.svc?xsd=xsd0"}
     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 (src/soap.erl, line 313)

I am still looking into this, but posting the update here!

mkrogemann commented 7 years ago

Same issue here. It looks like the imported types, which are given as remote resources ("http://...") are not downloaded. It appears that soap expects them to be located in the local file system. Any prognosis on how difficult it would be to produce a fix?

willemdj commented 7 years ago

Hi,

I don't think that is the problem, it should get remote resources as well.

I do recognize that there is a problem with the WSDL that the original issue refers to. This is related to the complex structure of that WSDL. Assuming that you are trying to process a different WSDL, could you let me know what error you are getting, and if possible also provide the files?

Thanks, Willem

mkrogemann commented 7 years ago

The error that I get is that included XSDs appear to be expected in local file system. I'll open another issue.

js-ojus commented 7 years ago

Apologies for disappearing!

The problem indeed was with the WSDL. It got resolved after I upgraded a later version of the API, with an updated WSDL.

Nonetheless, I could make calls using the original WSDL from Python. So, soap did have some problem fetching the referenced WSDLs.