package demo;

import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import demo.ws.logmsg.LogMessageService;

public class LogMessageProducerWebServiceClient {

	public static void main(String args[]) {
		JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
		factory.setServiceClass(LogMessageService.class);
		factory.setAddress("http://localhost:9999/services/LogMessageService");
		LogMessageService client = (LogMessageService) factory.create();
		String response = client.processLogMessageRequest(logMessage);
		System.out.println("sent following request:\n"+logMessage);
		System.out.println("received following response:\n"+response);
	}

	private static final String logMessage =
		"<LogMessage>\n"
		+"  <appName>LogMessageProducerWebServiceClient</appName>\n"
		+"  <timeStamp>01-SEP-2009 20:08:14 MDT</timeStamp>\n"
		+"  <logLevel>FATAL</logLevel>\n"
		+"  <shortMsg>out of caffeine beverages!</shortMsg>\n"
		+"  <longMsg>AAACCCKKK, there's no more coffee, tea, or Monster juice -- buy some now!</longMsg>\n"
		+"</LogMessage>\n\n";
}
