Ask a Question

Help in setting a POST request in SoapUI

Me89it
New Member

Help in setting a POST request in SoapUI

Hello everyone,

Not a developer here, just a PM trying to be independent from the dev team in my company...as they take forever to reply.

I was able to set it in the past, but I didn't take a screenshot of the working configuration and I must have changed some settings, so it no longer works. This is what I have to import:

curl --location --request POST 'https://DOMAIN-NAME.COM/uaa/oauth/token' \

--header 'Authorization: Basic <BASE_64_ENCODED_CREDENTIALS>' \

--header 'Content-Type: application/x-www-form-urlencoded' \

--header 'Ocp-Apim-Subscription-Key: <OCP-APIM-SUBSCRIPTION-KEY>' \

--data-urlencode 'grant_type=client_delega' \

--data-urlencode 'clientId=<API-DEVELOPER-PROGRAMME-USERNAME>' \

--data-urlencode 'sfAccountId=<SALESFORCE-ACCOUNT-ID> \

--data-urlencode 'numbers= <number>'

 

 

 

Can you please show me how it is supposed to do? I don't know how set those "data-urlencode" and can't really remember what I did last time...yes, kinda shameful.

Thank you!

2 REPLIES 2
nmrao
Champion Level 2

Are you facing any issue when the request is send?

Do you mean how to generate "BASE_64_ENCODED_CREDENTIALS"?

 

 



Regards,
Rao.
JuZ0
Occasional Contributor

You can use java.net.URLEncoder to encode values in URLencoding format

 

java.net.URLEncoder.encode("Value", "UTF-8")

 

Set POST request mediatype to application/x-www-form-urlencoded

Then in payload field enter

 

yourkey1=${=java.net.URLEncoder.encode("yourvalue1", "UTF-8")}&yourkey2=${=java.net.URLEncoder.encode("yourvalue2", "UTF-8")}

 

This way you can utilize SoapUI capability to dynamically alter values through injected Java / Groovy code. In this case java.net.URLEncoder will take care of encoding any values that you need to convert to URL encoded format.

 

 

cancel
Showing results for 
Search instead for 
Did you mean: