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

Custom SOAPFault detail unmarshaling #188

Merged
merged 4 commits into from
Feb 19, 2021

Conversation

lizapolyudova
Copy link
Contributor

@lizapolyudova lizapolyudova commented Dec 19, 2020

#180

Background

This PR fixes the described discrepancy between SOAP 1.1 spec and gowsdl implementation of fault detail.

Overview of changes

Add a new function

func (s *Client) 
CallWithFault(soapAction string, request, response, faultDetail interface{}) error

which allows to inject a custom fault detail type, similar to request and response.
Previously existing Call function remain backwards compatible and passes in nil for the fault, which is correctly handled (ignores detail information).

A slight awkwardness with this approach is: you cannot simply rely on Body.Fault == nil as a condition indicating there is no fault, since Fault is initialized with the custom detail type. Instead, there's a boolean faultOccurred, which is filled out during Body unmarshalling.

SOAPFault has to still be a pointer, since it has to be nil to pass a check in TestClient_MTOM, since it enforces that there are not multiple elements inside SOAP body.

@lizapolyudova lizapolyudova marked this pull request as ready for review December 19, 2020 23:53
@lizapolyudova lizapolyudova marked this pull request as draft December 19, 2020 23:54
@lizapolyudova lizapolyudova marked this pull request as ready for review December 20, 2020 00:06
@c4milo
Copy link
Member

c4milo commented Dec 31, 2020

@lizapolyudova, thank you! I will review it after the holidays. 🙇‍♂️

@lizapolyudova
Copy link
Contributor Author

@c4milo sorry to ping you again. We are running into some issues on our side with not being able to distinguish errors from warnings (which are encoded within the detail of the XML fault) and it's been somewhat frustrating.
lmk if there's anything I can help with.

@c4milo c4milo merged commit b77b4a4 into hooklift:master Feb 19, 2021
@c4milo
Copy link
Member

c4milo commented Feb 19, 2021

@lizapolyudova, apologies for the delay 😓thanks for the contribution! 🙌🏻

@lizapolyudova lizapolyudova deleted the error-messages branch March 7, 2021 04:36
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