return file;
}
private void addMessageConfig( Log log, WsdlMockResponse modelItem ) throws MalformedURLException
{
HttpMessageEntry requestMessage = HttpMessageEntry.Factory.newInstance();
WsdlMockRequest mockRequest = modelItem.getMockResult().getMockRequest();
requestMessage.addNewMessageContent().setStringValue( mockRequest.getRequestContent() );
requestMessage.setConversationID( "1" );
requestMessage.setTimestamp( Calendar.getInstance() );
requestMessage.setID( "1" );
MockService mockService = modelItem.getMockOperation().getMockService();
URL endpoint = new URL( "http://127.0.0.1:" + mockService.getPort() + mockService.getPath() );
requestMessage.setSenderHostAndPort( "localhost" );
if( endpoint.getPort() > 0 )
requestMessage.setReceiverHostAndPort( endpoint.getHost() + ":" + endpoint.getPort() );
else
requestMessage.setReceiverHostAndPort( endpoint.getHost() );
requestMessage.setType( TcpMessageType.REQUEST );
HttpMessageEntry responseMessage = HttpMessageEntry.Factory.newInstance();
responseMessage.addNewMessageContent().setStringValue( modelItem.getMockResult().getResponseContent() );
responseMessage.setConversationID( "1" );
responseMessage.setType( TcpMessageType.RESPONSE );
responseMessage.setTimestamp( Calendar.getInstance() );
responseMessage.setID( "2" );
responseMessage.setSenderHostAndPort( requestMessage.getReceiverHostAndPort() );
responseMessage.setReceiverHostAndPort( requestMessage.getSenderHostAndPort() );
String requestHeaders = buildHttpHeadersString( mockRequest.getRequestHeaders() );
requestMessage.setHttpHeaders( "POST " + mockRequest.getPath() + " " + mockRequest.getProtocol() + "\r\n"
+ requestHeaders );
responseMessage.setHttpHeaders( "HTTP/1.1 200 OK"
+ buildHttpHeadersString( modelItem.getMockResult().getResponseHeaders() ) );
log.setMessageEntryArray( new MessageEntry[] { requestMessage, responseMessage } );
}