cancel
Showing results for 
Search instead for 
Did you mean: 

Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Occasional Contributor

Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Configuration: 

OS: LLinux UBUNTU 14.04 64bit

SoapUI 5.1.0 installed 64bit

Ready!API using Soapui NG pro licence 64 bit, installed as root

 

Ready! API 1.5.0
© SmartBear Inc. 2007-2016
http://www.smartbear.com

Build Date: 20151106-1037
0b28e4ec11c2f0d7c6d8995905c7b7f3cacd73c6
Information about 3rd party libraries

 

 

In Ready! API in SoapUI NG Pro, when i POST a json command on my request URL, the call is working but i stop getting my response as XML.When i use Soapui 5.1.0
there is NO XML in the response BUT when i use properties transfer, i can still use ResponseAsXml to get my data and use Xpath (we need to use Xpath because we need to do lot of calculation, string truncate etc. on the data we get from previous call response, json path seems not able to do this )

 

So using a properties transfer i use property ResponseAsXML and path language Xpath and then when i click the buton "Select Source Xpath", it is not enabled at all


i need to do this sum to be able to continue

declare namespace ns1='${#TestSuite#URLResponse}';
sum((//ns1:room,75))

But Xpath is not working using jsonPath and jsonPath do not have sum function ( as far as I checked )

 

Hope it is enough, i cannot send the real json due to Confidentiality, but anything in json used get the same behaviour

 

Thanks a Lot for a quick answer, that prevent us to move to ready! API and/or Soapui NG

json request

{
"header": {
"ver": "1.0",
"sid": "${#TestSuite#Reference}",
"mode": 4
},
"command1": {
"cmd": "create.form",
"control": {
"ver": "${#TestSuite#ver}",
"lange": "${#TestSuite#lange}",
"room": "${#TestSuite#room}",
"reference": "${#TestSuite#reference}",
"id": ""${#TestSuite#id}"
},
"data": {}
}
}

json response

{
"header": {
"ver": "1.0",
"sid": "Step_5",
"mode": 4,
"result": "0x0"
},
"command1": {
"cmd": "create.form",
"control": {
"ver": "1.2.6.0",
"lange": "en-us",
"room": "NORTH",
"reference": "Step_5",
"id": 1,
"result": {
"code": "0x0"
}
},
"data": {
"form": {
"id": "4f2d44e3-ac7c-41e4-a0bb-adf10aa79ebc",
"state": "INITIAL"
}
}
}
}


XML response ( i expect something here )
<xml/>


the Request url need to have the port after the url to work on my system

request url
http://myadresse:2048/process/
response url
http://myadresse/process/


error log

 

Spoiler
Tue Jan 05 08:11:16 EST 2016:ERROR:java.net.MalformedURLException: For input string: "2048:2048"
java.net.MalformedURLException: For input string: "2048:2048"
at java.net.URL.<init>(URL.java:620)
at java.net.URL.<init>(URL.java:483)
at java.net.URL.<init>(URL.java:432)
at java.net.URI.toURL(URI.java:1089)
at com.eviware.soapui.impl.wsdl.submit.transports.http.support.methods.ExtendedPostMethod.getURL(ExtendedPostMethod.java:187)
at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.<init>(BaseHttpResponse.java:77)
at com.eviware.soapui.impl.wsdl.submit.transports.http.SinglePartHttpResponse.<init>(SinglePartHttpResponse.java:44)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.httpRequest(HttpPackagingResponseFilter.java:81)
at com.eviware.soapui.impl.wsdl.submit.filters.HttpPackagingResponseFilter.afterAbstractHttpResponse(HttpPackagingResponseFilter.java:52)
at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.afterRequest(AbstractRequestFilter.java:70)
at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:270)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:119)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: For input string: "2048:2048"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at java.net.URLStreamHandler.parseURL(URLStreamHandler.java:216)
at java.net.URL.<init>(URL.java:615)
... 16 more
Tue Jan 05 08:11:16 EST 2016:ERROR:java.lang.NullPointerException
java.lang.NullPointerException
at com.eviware.soapui.impl.rest.support.handlers.JsonMediaTypeHandler.makeNamespaceUriFrom(JsonMediaTypeHandler.java:114)
at com.eviware.soapui.impl.rest.support.handlers.JsonMediaTypeHandler.createXmlRepresentation(JsonMediaTypeHandler.java:59)
at com.eviware.soapui.impl.wsdl.submit.transports.http.BaseHttpResponse.getContentAsXml(BaseHttpResponse.java:388)
at com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep.propertyChange(HttpTestRequestStep.java:225)
at java.beans.PropertyChangeSupport.fire(PropertyChangeSupport.java:335)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:327)
at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:263)
at com.eviware.soapui.model.support.AbstractModelItem.notifyPropertyChanged(AbstractModelItem.java:77)
at com.eviware.soapui.impl.support.AbstractHttpRequest.setResponse(AbstractHttpRequest.java:923)
at com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequest.setResponse(HttpTestRequest.java:114)
at com.eviware.soapui.impl.support.panels.AbstractHttpRequestDesktopPanel.afterSubmit(AbstractHttpRequestDesktopPanel.java:462)
at com.eviware.soapui.impl.wsdl.panels.teststeps.HttpTestRequestDesktopPanel.afterSubmit(HttpTestRequestDesktopPanel.java:359)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.notifyListenersAfterSubmit(WsdlSubmit.java:101)
at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:146)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

 

4 REPLIES 4
Community Hero

Re: Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Do you need to extract a value from json? Is that what it is ?


Regards,
Rao.
Occasional Contributor

Re: Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Yes, the result of the first json call is a price: in example 1500$ and there is a charge not yet summarized in it ( example 200$)

 

in the next call i need to pass 1700$ in it, so i need to sum(1500,200)

Occasional Contributor

Re: Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Anybody have a clue ?

Highlighted
Community Hero

Re: Posting json call in SoapUI NGdo not get xml response like in Soapui Pro

Check this example (you can try it in groovy script) - how to read values from json.
https://github.com/nmrao/soapUIGroovyScripts/blob/master/groovy/AssertJsonArrayElement.groovy

You will be able to apply it to your response.


Regards,
Rao.