// Filter for the Soap GDC XML API
//
public type SoapGdcFilter object {
public function filterRequest(http:Caller caller, http:Request request, http:FilterContext context) returns boolean {
if (context.attributes.hasKey(gateway:SKIP_ALL_FILTERS) && <boolean>context.attributes[gateway:SKIP_ALL_FILTERS]) {
return true;
}
xml|error payload = request.getXmlPayload();
return true;
}
public function filterResponse(http:Response response, http:FilterContext context) returns boolean {
return true;
}
}; // SoapGdcFilter
- Add the below configuration to the deployment-config.toml residing under the /conf directory:
[[filters]]
name = "SoapGdcFilter"
position = 1
- Configure SOAP UI to send a post request with MTOM enabled.
- Invoke the API using the SOAP UI and you will be able to observe that the **CRLF** ("/r/n" ) character is being missed in the first multipart boundary when sending the request to the backend server. Check the backend server's log.
`"body": "------=_Part_32_1103335936.1688648631996\r\nContent-Transfer-Encoding: 8bit\r\ncontent-type:
`- It should include the CRLF character as below,
`"body": "\r\n------=_Part_32_1103335936.1688648631996\r\nContent-Transfer-Encoding: 8bit\r\ncontent-type:
`
### Affected Component
APIM
### Version
wso2am-micro-gw-3.2.0
### Environment Details (with versions)
_No response_
### Relevant Log Output
_No response_
### Related Issues
_No response_
### Suggested Labels
_No response_
Description
The
CRLF
characters at the beginning of the body are being removed when building the payload via the ballerina filter.Steps to Reproduce
http://localhost:8889
Setting up the backend.docker-compose up -d
docker-compose logs -f
- Add a custom filter to the microgateway project.xmlns "http://****" as gdc14;
string CONFIG_SOAP_GDCXML_CONTEXT = "usr_soap_gdcxml_context"; string CONFIG_ENVIRONMENT = "usr_environment"; string CONFIG_ENVIRONMENT_ID = "usr_environment_id";
string REQUEST_CONTENT_TYPE = "requestContentType"; string GDC_REQUEST_MESSAGE_ID = "gdcRequestMessageId"; string GDC_REQUEST_HEADER = "gdcRequestHeader";
string ERROR_RESPONSE_CODE = "error_response_code";
// Filter for the Soap GDC XML API // public type SoapGdcFilter object {
}; // SoapGdcFilter
[[filters]] name = "SoapGdcFilter" position = 1