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

Wrong namespace used in call #48

Open
mpaluchowski opened this issue Dec 27, 2019 · 1 comment · May be fixed by #87
Open

Wrong namespace used in call #48

mpaluchowski opened this issue Dec 27, 2019 · 1 comment · May be fixed by #87
Assignees

Comments

@mpaluchowski
Copy link

mpaluchowski commented Dec 27, 2019

I'm trying to make a call via this WSDL and the namespace that the server expects is http://tempuri.org/, but the library sends http://tempuri.org/Imports instead. The WSDL has a section:

<wsdl:types>
  <xsd:schema targetNamespace="http://tempuri.org/Imports">
    <xsd:import schemaLocation="https://datastore.ceidg.gov.pl/CEIDG.DataStore/services/DataStoreProvider201901.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
    <xsd:import schemaLocation="https://datastore.ceidg.gov.pl/CEIDG.DataStore/services/DataStoreProvider201901.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
    <xsd:import schemaLocation="https://datastore.ceidg.gov.pl/CEIDG.DataStore/services/DataStoreProvider201901.svc?xsd=xsd2" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
  </xsd:schema>
</wsdl:types>

and it looks like the call takes the namespace from this section's targetNamespace instead of taking it from the xsd:import or the top level wsdl:definitions.

@ShankarSubedi
Copy link

Go to encoder.go and assign namespace as c.Client.Definitions.TargetNamespace

namespace := ""
if c.Client.Definitions.Types != nil {
	schema := c.Client.Definitions.Types[0].XsdSchema[0]
	namespace = c.Client.Definitions.TargetNamespace
	if namespace == "" && len(schema.Imports) > 0 {
		namespace = schema.Imports[0].Namespace
	}
}

kcaashish added a commit to kcaashish/gosoap that referenced this issue Aug 19, 2022
During request marshal the namespace is not set correctly. Instead of
using from xsd:schema targetNamespace, it now uses the namespace from
wsld definitions.

Fixes: tiaguinho#48
@kcaashish kcaashish linked a pull request Aug 19, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants