Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
jose_sequeira
Active Participant
Hello,

One of this days, i had a scenario that the sender system could only pass query parameters on the URL (for some limitation) in my interface, and that's not a problem at all. So based on my experience, i've decided to use a great tutorial already created by SAP® to enhance the iFlow for similar purposes, just in case anyone needs something like this in the future.


The SAP® tutorial mentioned can be found here. After you follow all the steps, your iFlow will look like this:


And your interface will return correctly like this:


Notice that the Product Identifier is passed in the Body (HT-2000).

So if you wanted to pass it like a Query Parameters and not in the request body, how could you do it? Let's get to it now!

So i'm assuming here that you already have an iFlow exactly like the tutorial shows you.

My HTTPs Sender now:


Delete the JSON to XML converter and the Content Modifier and insert a Groovy Script step, like this:


Insert the Groovy Script below:
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
//Headers
def map = message.getHeaders();
def HttpQuery = map.get("CamelHttpQuery");
def elements = HttpQuery.split('=');
//Properties
message.setProperty("MyProduct", elements[1]);
return message;
}

What have we done? We're using the CamelHttpQuery variable, that stores the Query Parameter that we're gonna pass.


And saving in the MyProduct property:


In the OData Receiver, go back to where you've configured the Filter and replace with our new property MyProduct:


Insert: ${property.MyProduct}.


Before, it was the created variable using XPath.


So now go back to Postman and call your URL with...?Product=HT-2000:


Et voilà, we have now the same functionality sending the product ID in the Query Parameter and not in the body anymore.

Enjoy!

Regards.
2 Comments
Labels in this area