elixir-soap / soap

SOAP client for Elixir programming language
MIT License
135 stars 75 forks source link

Issue parsing wsdl #69

Open chaz8080 opened 5 years ago

chaz8080 commented 5 years ago

I have a wsdl url that seems to be leaving several fields empty when calling init_model: http://services.chromedata.com:80/Description/7a?WSDL

Steps to replicate:

iex> wsdl_path = "http://services.chromedata.com:80/Description/7a?WSDL"
iex> {:ok, wsdl} = Soap.init_model(wsdl_path, :url)
{:ok,
 %{
   complex_types: [],
   endpoint: "",
   messages: [],
   namespaces: %{},
   operations: [],
   schema_attributes: %{
     element_form_default: "qualified",
     target_namespace: "urn:description7a.services.chrome.com"
   },
   soap_version: "1.1",
   validation_types: %{}
 }}
chaz8080 commented 5 years ago

The issue seems to be that this particular wsdl has valid namespaces, but none of the prefixes are present. Line 221 of wsdl.ex prepends the prefixes with the namespaces, and since they aren't there in the wsdl, most of the xpath queries return nothing:

defp ns(name, namespace), do: "#{namespace}:#{name}"