// add mockoperation
if( mockOperation == null )
mockOperation = mockService.addNewMockOperation( request.getOperation() );
WsdlMockResponse mockResponse = mockOperation.addNewMockResponse(
"Response " + ( 1 + mockOperation.getMockResponseCount() ), false );
// add expected response if available
if( request != null && request.getResponse() != null )
{
WsdlResponse response = request.getResponse();
mockResponse.setResponseContent( response.getContentAsString() );
Attachment[] attachments = response.getAttachments();
for( Attachment attachment : attachments )
{
mockResponse.addAttachment( attachment );
}
if( mockResponse.getResponseHeaders() != null && mockResponse.getResponseHeaders().size() > 0
&& UISupport.confirm( "Add current Response HTTP Headers to MockResponse", title ) )
mockResponse.setResponseHeaders( response.getResponseHeaders() );
}
else
{
mockResponse.setResponseContent( request.getOperation().createResponse( true ) );
}
if( UISupport.confirm( "Open MockResponse editor?", title ) )
{
SoapUI.getDesktop().showDesktopPanel( mockResponse );