Forum Discussion

anuj24's avatar
anuj24
New Contributor
9 years ago

How to create REST request using SOAPUI programmatically through java?

Hi,

 

I know how to create SOAP request and getting response from it programmatically through java..

 

WsdlProject project = new WsdlProject();

project.setName("newProject");

WsdlInterface objIface = WsdlInterfaceFactory.importWsdl(project, url, true )[0];

WsdlOperation objOperation = (WsdlOperation) objIface.getOperationByName(operation);

String req=objOperation.createRequest(true);

WsdlRequest objRequest=objOperation.addNewRequest("MyRequest1");

objRequest.setRequestContent(strRequest);

WsdlSubmit objSubmit = (WsdlSubmit) objRequest.submit(new WsdlSubmitContext(objRequest), false);

Response objResponse = objSubmit.getResponse();

String strContent = objResponse.getContentAsString();

 

I need to do the same for REST service...

Can you please help me with this, creating REST request and getting response back from rest service.

 

Thanks in Advance.

Anuj