Skip to content

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

@imadu

Description

@imadu

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions