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

Namespace not being added #89

Open
okkdev opened this issue Dec 28, 2020 · 5 comments
Open

Namespace not being added #89

okkdev opened this issue Dec 28, 2020 · 5 comments

Comments

@okkdev
Copy link

okkdev commented Dec 28, 2020

When I try to use any actions from my WSDL file the namespace is missing from the request, thus resulting in an invalid request.

It should look like this:

<env:Body>
    <login xmlns:ns1="http://www.abacus.ch/abaconnect/2007.10/core/AbaConnectTypes">
        <ns1:UserLogin>
            <ns1:Mandant>1</ns1:Mandant>
            <ns1:Password>pass</ns1:Password>
            <ns1:UserName>user</ns1:UserName>
        </ns1:UserLogin>
    </login>
</env:Body>

But what I currently get is:

<env:Body>
    <login>
        <UserLogin>
            <Mandant>1</Mandant>
            <Password>pass</Password>
            <UserName>user</UserName>
        </UserLogin>
    </login>
</env:Body>

This is my code:

{:ok, wsdl} = Soap.init_model("wsdl/Customer.wsdl", :file)

params = %{
  UserLogin: %{
    Mandant: "1",
    Password: "pass",
    UserName: "user"
  }
}

{:ok, response} = Soap.call(wsdl, "login", params)

Is this a problem with my wsdl or is it not being added by the lib?

Here is my wsdl and the xsds
wsdl.zip

@dportalesr
Copy link

dportalesr commented May 18, 2022

Hey, did you ever figured this out? I'm stuck with the same problem. Not sure what I'm missing...

@okkdev
Copy link
Author

okkdev commented May 27, 2022

Unfortunately not 😞

@dportalesr
Copy link

I did. Turned out to be an inconsistent namespace definition in the WSDL I was targeting.

@skostojohn
Copy link

I am struggling with this issue currently - trying to use this client with the Salesforce WSDL. I can provide more details (wsdl, request body being generated by soap, example of "correct" request body, etc. if anyone has interest and bandwidth to try and help.

@doofyus
Copy link

doofyus commented Jul 12, 2023

I've had issues with the namespace problem too - got it working by going over the lib's code and seeing that it's using some configurations (it helped initially):

config :soap, :globals,
  env_namespace: "soapenv",
  version: "1.1",
  custom_namespaces: %{
    aut: "some_action_url",
    veh: "some_other_action_url"
  }

Unfortunately, after a few days, the lib doesn't build the correct request again and i had to use a "hacky" way to do the requests:

  • made a template of the body of the request
  • sent the filled template with a "regular" HTTP client
  • used :sweet_xml to handle the response (also this lib's Soap.Response.parse/2 worked)

EDIT / UPDATE:
After digging around the lib, i found that my issue was that the wsdl that i'm using doesn't have complex_types filled (they're linked from another location, but the lib isn't able to / doesn't read them) - that data was needed for my problem (action-namespace mismatch) to be gone.

For my case, the solution was like this:

extra_complex_type = %{
  name: "action_name",
  type: "name_space:action_name"
}

wsdl = %{wsdl | complex_types: [extra_complex_type | wsdl.complex_types]}

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

4 participants