8000 Update wsdl:part messages to use XML name from referenced element by silverspace · Pull Request #110 · fiorix/wsdl2go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update wsdl:part messages to use XML name from referenced element #110

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

Merged
merged 4 commits into from
Oct 29, 2018

Conversation

silverspace
Copy link
Contributor
@silverspace silverspace commented Oct 8, 2018

Greetings! First of all, thanks for an awesome Go package!

I am interfacing with a WSDL-based SOAP service that worked with an older version of your wsdl2go library. When I upgraded from 8f16131 to c0bfd34, our client started generating an XML request that the server now rejects. The reason for this is due to <wsdl:part> messages using the part name attribute instead of the referenced element's name.

Here is the relevant <wsdl:part> message snippet from our WSDL file:

<wsdl:message name="IELDSubmissionService_Submit_InputMessage">
  <wsdl:part name="parameters" element="tns:Submit"/>
</wsdl:message>

The current wsdl2go master XML output (rejected by server): <parameters><data><ELDIdentifier>...</parameters>.

The older wsdl2go output (accepted by server): <Submit xmlns="http://www.fmcsa.dot.gov/schemas/FMCSA.ELD.Infrastructure"><data><ELDIdentifier>...</Submit>

In other words, the XML tag is now parameters instead of Submit for the above WSDL snippet:

type OperationIELDSubmissionService_Submit_InputMessage struct {
	Parameters *Submit `xml:"parameters,omitempty" json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

I took a shot at a PR that fixes my particular use case, but I don't know enough about SOAP to know what the proper behavior for all <wsdl:part> tags should be.

Greg Hogan added 4 commits October 8, 2018 16:01
With the current encoder, a WSDL message such as

<wsdl:message name="IELDSubmissionService_Submit_InputMessage">
  <wsdl:part name="parameters" element="tns:Submit"/>
</wsdl:message>

Will have the XML tag of "parameters" rather than "Submit". In other
words, the current generated output looks like:
type OperationIELDSubmissionService_Submit_InputMessage struct {
	Parameters *Submit `xml:"parameters,omitempty" json:"parameters,omitempty" yaml:"parameters,omitempty"`
}

The correct output should be:
type OperationIELDSubmissionService_Submit_InputMessage struct {
	Submit *Submit `xml:"Submit,omitempty" json:"Submit,omitempty" yaml:"Submit,omitempty"`
}
@fiorix
Copy link
Owner
fiorix commented Oct 29, 2018

I don't particularly like the generated code's variable names reflecting their type, but it works. Merging.

@fiorix fiorix merged commit 69b96af into fiorix:master Oct 29, 2018
@fiorix
Copy link
Owner
fiorix commented Oct 29, 2018

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants
0