You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<soap:Envelopexmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Requestxmlns="https://example.com"> <!-- We have xmlns here which is a good thing -->
<filter>
<SomeParameter>SomeValue</SomeParameter> <!-- Note the lack of xmlns="TestNamespace" Here -->
<SomeNestedParameter> <!-- And Here -->
<SomeInnerParameter>InnerValue</SomeInnerParameter>
</SomeNestedParameter>
</filter>
</Request>
</soap:Body>
</soap:Envelope>
The generated code looks like
typeRequeststruct {
XMLName xml.Name`xml:"https://example.com Request"`// I believe this parameter is used to add// xmlns="https://example.com"// to the request which is the same as zeep responseFilter*Filter`xml:"filter,omitempty" json:"filter,omitempty"`
}
typeResponsestruct {
XMLName xml.Name`xml:"https://example.com Response"`Message*string`xml:"Message,omitempty" json:"Message,omitempty"`
}
typeFilterstruct {
SomeParameter*string`xml:"SomeParameter,omitempty" json:"SomeParameter,omitempty"`// (see challenge 1)SomeNestedParameter*NestedType`xml:"SomeNestedParameter,omitempty" json:"SomeNestedParameter,omitempty"`
}
typeNestedTypestruct {
// Here we also need something like// XMLName xml.Name `xml:"TestNamespace SomeNestedParameter"`// but it is not generated (see challenge 2)SomeInnerParameter*string`xml:"SomeInnerParameter,omitempty" json:"SomeInnerParameter,omitempty"`
}
Challenges
The method used to add xmlns attribute does not work for a primitive (non-struct) types. But there is this workaround:
type Filter struct {
SomeParameter *SomeParameter `xml:"SomeParameter,omitempty" json:"SomeParameter,omitempty"`
// (see challenge 1)
SomeNestedParameter *NestedType `xml:"SomeNestedParameter,omitempty" json:"SomeNestedParameter,omitempty"`
}
type SomeParameter struct {
XMLName xml.Name `xml:"TestNamespace SomeParameter"`
Value string `xml:",chardata"` // <- Note here we make it to become the root value of the containing node
}
The second challenge is that we need to include the name of this type in the parent parameter inside the type definition which is impossible since these struct types may be reused in multiple messages with different names.
The text was updated successfully, but these errors were encountered:
Assume we have the following wsdl:
Using zeep in python I can generate a valid request:
The result is
But using gowsdl I cannot.
With the following we can see the generated xml
Which is
The generated code looks like
Challenges
xmlns
attribute does not work for a primitive (non-struct) types. But there is this workaround:The text was updated successfully, but these errors were encountered: