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

Client.Call() check for "<soap" or "<SOAP" tag invalidates XML body #6

Open
imadu opened this issue Dec 3, 2020 · 1 comment
Open

Comments

@imadu
Copy link

imadu commented Dec 3, 2020

First off I'd like to say a big thank you to the makers of this package, your work has helped save my a lot of time in setting up my soap server and client.

However when using the client, to make a call (i.e. client.Call(...)) I get a This is not a SOAP-Message error even when sending valid XML envelopes. I did some digging around and I found this line of code below in the client.go file:

if !(strings.Contains(string(rawbody), "<soap") || strings.Contains(string(rawbody), "<SOAP")) {
			l("This is not a SOAP-Message: \n" + string(rawbody))
			return nil, errors.New("This is not a SOAP-Message: \n" + string(rawbody))
		}

This checks to see if the incoming SOAP envelope has either a "<soap"or "<SOAP" tag anywhere in the response envelope.
I'd like to know first of all why this is important to check for, as some of SOAP envelopes do not contain a soap prefix at all, as see in this example below:

<?xml version="1.0" encoding="UTF-8" ?>
 <NESingleResponse>
<SessionID>000001100913103301000000000001</SessionID> <DestinationInstitutionCode>000002</DestinationInstitutionCode> 
<ChannelCode>1</ChannelCode> 
<AccountNumber>2222000000012345</AccountNumber> 
<AccountName>Ajibade Oluwasegun</AccountName> 
<BankVerificationNumber>1033000441</BankVerificationNumber> 
<KYCLevel>1</KYCLevel>
<ResponseCode>00</ResponseCode>
 </NESingleResponse>

And also can this be removed? so that Envelopes as given in the example below can be parsed as well.

Thank you very much

@florianschlegel
Copy link
Contributor

Hi, the check is indeed a bit sloppy. However, if I am not mistaken your xml is not valid SOAP since it's not using the SOAP namespace. If you need a quick solution I would suggest that you just create a fork and adjust it to your needs since we have no capacity right now to dig into this deeper.

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

2 participants