cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud Platform Integration - Encoded character (/) beeing replaced in HTTP call

former_member724776
Discoverer
0 Kudos

Hi everyone,

I'm having a really weird behavior with the HTTP Adapter in SAP Cloud Platform Integration.

The HTTP call is configured as below:

I'm using a property to concatenate the URL. When I lookup in the trace data, the property has the value:

But then, the HTTP call returns an error, because the adapter its replacing the %2 with a "/" character, as below:

I need to send the HTTP call with the %2F, not a "/" character. Note that the %7C (|) is not beeing replaced. It remains %7C.

Is there a way to make this possible?

Thanks,
Maicon Friedel

View Entire Topic
PriyankaChak
Active Contributor

Hi Maicon,

Can you please include a groovy script to URL encode the property named 'MaterialID' before the HTTP call and try?

def value = message.getProperties().get("MaterialID");

String encodedUrl = URLEncoder.encode(value, "UTF-8");

message.setProperty("MaterialID", encodedUrl)

Regards,

Priyanka

former_member724776
Discoverer
0 Kudos

Hello Priyanka,

I made a test here, and it worked perfectly.

Thanks a lot for the help!

sanfrancios
Explorer
0 Kudos

import com.sap.gateway.ip.core.customdev.util.Message;

import java.util.HashMap;

import java.net.URLEncoder;

def value = message.getProperties().get("downloadLink");

String encodedUrl = URLEncoder.encode(value, "UTF-8");

message.setProperty("downloadLink", encodedUrl)

I have used this above code to encode my url but getting error :javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: message for class: encode__Script, cause: groovy.lang.MissingPropertyException: No such property: message for class: encode__Script

can you please help me?

regards,

Santosh