Skip to content

Commit

Permalink
Fix creating SOAP responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuvindu committed Jul 29, 2024
1 parent 2057fb0 commit 8c734f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ballerina/soap_utils.bal
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ public isolated function sendReceive(xml|mime:Entity[] body, http:Client httpCli
: createSoap11HttpRequest(body, <string>soapAction, headers);
do {
http:Response response = check httpClient->post(path, req);
if soap12 {
return check createSoapResponse(response);
}
return check createSoapResponse(response);
} on fail var soapError {
return error Error(SOAP_RESPONSE_ERROR, soapError);
Expand Down Expand Up @@ -180,7 +177,11 @@ isolated function createSoap12HttpRequest(xml|mime:Entity[] body, string? soapAc
isolated function createSoapResponse(http:Response response) returns xml|mime:Entity[]|error {
mime:Entity[]|http:ClientError payload = response.getBodyParts();
if payload !is mime:Entity[] {
return response.getXmlPayload();
xml|error responsePayload = response.getXmlPayload();
if responsePayload is xml {
return responsePayload;
}
return error(response.reasonPhrase);
}
return payload;
}
Expand Down

0 comments on commit 8c734f9

Please sign in to comment.