cancel
Showing results for 
Search instead for 
Did you mean: 

Response message automatically encoded to base64

SOLVED
Highlighted
Occasional Contributor

Response message automatically encoded to base64

Hi All;

 

I wonder if someone came across this issue and has a way to solve it. I am getting an valid SOAP response from the service and that does not have a CDATA section in it. When receiving it in ReadyApi (2.60) the response is automatically encoded to base64. This does not happen for other services I am using and when debugging the message in NJams I get a normal response from the service.

 

Of course I have looked into the base64 encoding option that is in the settings of ReadyApi and the compression limit setting is empty. I have tried putting in a large value so the message falls within the limit set in the option (so it is not encoded). 

 

Hopefully someone can give me a hand. 

 

Thanks in advance !

 

Paul

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: Response message automatically encoded to base64

This is the correct solution:

 

Add the RequestFilter.afterRequest event handler with this string to decode the response - 

def encodedResp = context.httpResponse.responseContent
def decodedResp = encodedResp.decodeBase64()
String toText = new String (decodedResp)
context.httpResponse.responseContent = toText

The script will be executed on receiving each response, and you will see the decoded response content in the XML, Outline and Overview tabs.
In this article, you will find more details about handling events - https://support.smartbear.com/readyapi/docs/testing/handling-events.html

View solution in original post

8 REPLIES 8
Highlighted
Community Hero

Re: Response message automatically encoded to base64

Hi @Pabe1975 

 

Ive never used nJAMS before - but you're saying that when publishing a message via nJAMS - you get an uncompressed/decoded response - but when you make the same request in ReadyAPI! - you're response is base64 encoded?

 

You mention you haven't got a CDATA wrapper in your SOAP response - but i dont understand the significance of you mentioning this other than to emphasise the response is being correctly read in by the ReadyAPI! xml parser.

 

whats the Congent-Type header associated with the response?  if ReadyAPI! is receiving the response compressed and encoded, Id expect the type to be maybe gzipped (so this proves ReadyAPI! isnt altering the response)

 

 

Ok - I normally do this with Postman and ReadyAPI! when trying to diagnose this sort of thing but the nJAMS will do fine.  

 

Run Fiddler (to proxy your requests)

Publish the message via nJAMS (ensuring the request is proxied via Fiddler)

Publish the message via ReadyAPI! (ensuring the request is proxied via Fiddler)

 

 

you need to try and determine the cause of the compression/decode so it makes sense if you compare the RAW requests against the RAW responses to check the differences.  Fiddler allows you to do this.  There could be an additional header in the request determining the behaviour, etc., .etc.

 

re: the Compression Limit editable field - have you tried putting a negative integer into the field? - I know the help innfo is a little thin in regards to allowed values in the fields - but II kinda remember someone suggesting sticking a negative integer into the chunking option field to disable - this might also work on the wsdl's Compression Limit field?

 

cheers,

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Highlighted
Community Manager

Re: Response message automatically encoded to base64

Hi @Pabe1975,

 

Could you please check if you see the same behavior in ReadyAPI 3.0? This is the latest product version - if this is an issue, it can be fixed there.

You can download the installation file here: https://support.smartbear.com/downloads/readyapi/

 

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Highlighted
Occasional Contributor

Re: Response message automatically encoded to base64

Hi Richie;

 

Unfortunately the -1 value did not resolve my problem. Channeling through fiddler is something I still need to set up. The weird thing is that is the first service of which the response is auto-encoded to base64. It does not seem to have any relation to the size of the response returned as far as I can see. Will let everyone know when I found the solution via Fiddler as it might help others with similar problems.

 

The reason I mentioned the CDATA because it is referred to in deh Smartbear documentation.

Highlighted
Occasional Contributor

Re: Response message automatically encoded to base64

Dear Tanya.. will try that. thanks

Highlighted
Occasional Contributor

Re: Response message automatically encoded to base64

Dear Tanya, Richie;

 

The issue is also present in Readyapi 3.0, just tested it. 

 

In Fiddler the message also shows as base64 encoded.  So far no solution yet. Need to check some things with developers.

Highlighted
Community Manager

Re: Response message automatically encoded to base64

Thanks for checking this.

I cannot tell you for sure if a response should be encoded automatically. I recommend that you contact our ReadyAPI Support team to investigate this. You can reach out to them here: https://support.smartbear.com/message/?prod=readyapi

 

Please post here an update once the solution is found

 

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!
Occasional Contributor

Re: Response message automatically encoded to base64

This is the correct solution:

 

Add the RequestFilter.afterRequest event handler with this string to decode the response - 

def encodedResp = context.httpResponse.responseContent
def decodedResp = encodedResp.decodeBase64()
String toText = new String (decodedResp)
context.httpResponse.responseContent = toText

The script will be executed on receiving each response, and you will see the decoded response content in the XML, Outline and Overview tabs.
In this article, you will find more details about handling events - https://support.smartbear.com/readyapi/docs/testing/handling-events.html

View solution in original post

Highlighted
Community Manager

Re: Response message automatically encoded to base64

Great to hear that the solution was found!

And thanks for sharing it with the Community, @Pabe1975.

Good luck in testing Smiley Happy

 

 

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!