Java tutorial
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package ycga.webservice; import org.springframework.context.support.ClassPathXmlApplicationContext; public final class CxfClient { private CxfClient() { } public static void main(String args[]) throws Exception { // START SNIPPET: client String xmlData = "<?xml version=\"1.0\" encoding=\"utf-8\" ?> "; xmlData = xmlData + "<DataExchange>"; xmlData = xmlData + "<ApplicationName>TestApp</ApplicationName>"; xmlData = xmlData + "<UserName>Quanj</UserName>"; xmlData = xmlData + "<AuthCode>AAAAAAAA</AuthCode>"; xmlData = xmlData + "<JMSTimeToLive>3600000</JMSTimeToLive>"; xmlData = xmlData + "<JMSPriority>4</JMSPriority>"; xmlData = xmlData + "<JMSTopic>message</JMSTopic>"; xmlData = xmlData + "<JMSQueue>message</JMSQueue>"; xmlData = xmlData + "<JMSId></JMSId>"; xmlData = xmlData + "<JMSBody>"; // xmlData=xmlData+ "<![CDATA["; xmlData = xmlData + ""; // // xmlData=xmlData+ "]]>"; xmlData = xmlData + "</JMSBody>"; xmlData = xmlData + "</DataExchange>"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[] { "client-beans.xml" }); ISendMessage client = (ISendMessage) context.getBean("messageClient"); // String response = client.sayHi("quanj"); String response = client.sendMessage(xmlData, "asdfsafd"); System.out.println("Response: " + response); System.exit(0); // END SNIPPET: client } }