Skip to content

Commit

Permalink
Update SOAP service to handle requests without setting up the path in…
Browse files Browse the repository at this point in the history
… requests
  • Loading branch information
Nuvindu committed Apr 26, 2024
1 parent 6001ea5 commit 68ff9ef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ballerina/modules/soap11/tests/http_soap_service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ crypto:PublicKey serverPublicKey = check crypto:decodeRsaPublicKeyFromTrustStore

service / on new http:Listener(9090) {

resource function post .(http:Request request) returns http:Response|error {
http:Response response = new;
xml payload = xml `<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AddResponse xmlns="http://tempuri.org/"><AddResult>5</AddResult></AddResponse></soap:Body></soap:Envelope>`;
response.setPayload(payload);
return response;
}

resource function post getPayload(http:Request request) returns http:Response|error {
http:Response response = new;
response.setPayload(check (check request.getBodyParts())[0].getXml());
Expand Down
7 changes: 7 additions & 0 deletions ballerina/modules/soap12/tests/http_soap_service.bal
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ crypto:PublicKey serverPublicKey = check crypto:decodeRsaPublicKeyFromTrustStore

service / on new http:Listener(9090) {

resource function post .(http:Request request) returns http:Response|error {
http:Response response = new;
xml payload = xml `<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AddResponse xmlns="http://tempuri.org/"><AddResult>5</AddResult></AddResponse></soap:Body></soap:Envelope>`;
response.setPayload(payload);
return response;
}

resource function post getPayload(http:Request request) returns http:Response|error {
http:Response response = new;
response.setPayload(check (check request.getBodyParts())[0].getXml());
Expand Down

0 comments on commit 68ff9ef

Please sign in to comment.