cancel
Showing results for 
Search instead for 
Did you mean: 

Need help! with empty response when I using the external XML as response.

SOLVED
Occasional Contributor

Need help! with empty response when I using the external XML as response.

Hi,

 

I'm the beginner for SoapUI.

I have a problem when using the external XML file for dynamic responses. It returns an empty message for the response but it appears on the log.info.

1. I created the request "Req_NAME_ID1"

2. I created the response and force it reads the XML from specifying the path.

def resultRespXML = new File("C:\\Users\\Administrator\\Desktop\\Temp\\Test\\mockResponses\\Resp_0000202130123310_0057076200.xml")
log.info resultRespXML

context.content = resultRespXML

3. Run and see the log. It shows the message log from log.info

4. But it doesn't show the data at the Response.

 

Please help me.

 

Regards,

Dan

1 ACCEPTED SOLUTION

Accepted Solutions
Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

It's working now.
I fixed it by adding the ${ResposeData} to the response message as the picture below.

Thank you for your help and answer Smiley Happy


2019-06-25 15_54_24-SoapUI 5.0.0-m-SNAPSHOT.png

8 REPLIES 8
Highlighted
Super Contributor

Re: Need help! with empty response when I using the external XML as response.

You need to use below approach:- 

def resultRespXML = new File("C:\\Users\\Administrator\\Desktop\\Temp\\Test\\mockResponses\\Resp_0000202130123310_0057076200.xml") 
log.info resultRespXML.text

This will print the xml details.

Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

I saw the XML detail when I printed log.info but It stills doesn't show the XML as log.info to the response message.

 

Regards,

Dan

Super Contributor

Re: Need help! with empty response when I using the external XML as response.

is it possible to share .xml here? I am able to see the xml details when I used the code I gave you.

Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

Sorry for the late reply.

For share XML, I can't share it for you because it has confidential company data.

 

So, Do you have the example that you can be shared to me?

I just need to read the XML file and use it responsibly when the request calls it.

 

I followed the topic below:

https://www.soapui.org/soap-mocking/creating-dynamic-mockservices.html

No.7. Using files in a mock response

 

 

Regards,

Dan

Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

I shared the captured picture below:

It returns "null".

 

The destination XML file is valid and has the information inside.

2019-06-25 12_17_43-SoapUI 5.5.0.png

Regards,

Dan

Super Contributor

Re: Need help! with empty response when I using the external XML as response.

i have attached the data.xml file. Please use the same code. It will give you the result. And i can see here, you are using tearup/teardown script. i am not sure here, whether it will work or not. If you create a groovy script by creating a test step and use that code. it will work.

Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

I used your code and run:

2019-06-25 13_31_48-SoapUI 5.5.0.png

 

It still doesn't work.

It shows the data at the log.info but it doesn't show at the response message.

 

Regards,
Dan

Occasional Contributor

Re: Need help! with empty response when I using the external XML as response.

Hi @avidCoder ,

 

It's working now.
I fixed it by adding the ${ResposeData} to the response message as the picture below.

Thank you for your help and answer Smiley Happy


2019-06-25 15_54_24-SoapUI 5.0.0-m-SNAPSHOT.png

New Here?
Join us and watch the welcome video:
Watch the New Interview
APITestingMistake#2
Top Kudoed Authors