private static final QName SERVICE_NAME = new QName("http://order.demo/", "OrderProcessService");
private static final QName PORT_NAME = new QName("http://order.demo/", "OrderProcessPort");
private static final String WSDL_LOCATION = "http://localhost:8080/OrderProcess?wsdl";
public static void main(String args[]) throws Exception {
URL wsdlURL = new URL(WSDL_LOCATION);
Service service = Service.create(wsdlURL, SERVICE_NAME);
OrderProcess port = service.getPort(PORT_NAME, OrderProcess.class);
Order order = new Order();
order.setCustomerID("C001");
order.setItemID("I001");
order.setPrice(100.00);
order.setQty(20);
String result = port.processOrder(order);
System.out.println("The order ID is " + result);
}
}
package demo.order.client;import java.net.URL;import javax.xml.namespace.QName;import javax.xml.ws.Service;import demo.order.Order;import demo.order.OrderProcess;public class ProxyClient { private static final QName SERVICE_NAME = new QName("http://order.demo/", "OrderProcessService"); private static final QName PORT_NAME = new QName("http://order.demo/", "OrderProcessPort"); private static final String WSDL_LOCATION = "http://localhost:8080/OrderProcess?wsdl"; public static void main(String args[]) throws Exception { URL wsdlURL = new URL(WSDL_LOCATION); Service service = Service.create(wsdlURL, SERVICE_NAME); OrderProcess port = service.getPort(PORT_NAME, OrderProcess.class); Order order = new Order(); order.setCustomerID("C001"); order.setItemID("I001"); order.setPrice(100.00); order.setQty(20); String result = port.processOrder(order); System.out.println("The order ID is " + result); } }
OrderProcess service = (OrderProcess)factory.create();
Order order = new Order();
order.setCustomerID("C001");
order.setItemID("I001");
order.setPrice(100.00);
order.setQty(20);
String result = service.processOrder(order);
System.out.println("The order ID is " + result);
}
}
package demo.order.client;import demo.order.Order;import demo.order.OrderProcess;import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;public class ClientProxyClient { public static void main(String args[]) throws Exception { JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); factory.setServiceClass(OrderProcess.class); factory.setAddress("http://localhost:8080/OrderProcess"); OrderProcess service = (OrderProcess)factory.create(); Order order = new Order(); order.setCustomerID("C001"); order.setItemID("I001"); order.setPrice(100.00); order.setQty(20); String result = service.processOrder(order); System.out.println("The order ID is " + result); } }
// Invoke the processOrder() method and print the result
// The response class is String
Object[] result = client.invoke(opName, orderObject);
System.out.println("The order ID is " + result[0]);
}
}
package demo.order.client;import java.beans.PropertyDescriptor;import java.util.List;import javax.xml.namespace.QName;import org.apache.cxf.endpoint.Client;import org.apache.cxf.endpoint.Endpoint;import org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory;import org.apache.cxf.service.model.BindingInfo;import org.apache.cxf.service.model.BindingMessageInfo;import org.apache.cxf.service.model.BindingOperationInfo;import org.apache.cxf.service.model.MessagePartInfo;import org.apache.cxf.service.model.ServiceInfo;public class OrderProcessJaxWsDynClient { public OrderProcessJaxWsDynClient() { } public static void main(String str[]) throws Exception { JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance(); Client client = dcf.createClient("http://localhost:8080/OrderProcess?wsdl"); Endpoint endpoint = client.getEndpoint(); // Make use of CXF service model to introspect the existing WSDL ServiceInfo serviceInfo = endpoint.getService().getServiceInfos().get(0); QName bindingName = new QName("http://order.demo/", "OrderProcessServiceSoapBinding"); BindingInfo binding = serviceInfo.getBinding(bindingName); QName opName = new QName("http://order.demo/", "processOrder"); BindingOperationInfo boi = binding.getOperation(opName); // Operation name is processOrder BindingMessageInfo inputMessageInfo = null; if (!boi.isUnwrapped()) { //OrderProcess uses document literal wrapped style. inputMessageInfo = boi.getWrappedOperation().getInput(); } else { inputMessageInfo = boi.getUnwrappedOperation().getInput(); } List parts = inputMessageInfo.getMessageParts(); MessagePartInfo partInfo = parts.get(0); // Input class is Order // Get the input class Order Class orderClass = partInfo.getTypeClass(); Object orderObject = orderClass.newInstance(); // Populate the Order bean // Set customer ID, item ID, price and quantity PropertyDescriptor custProperty = new PropertyDescriptor("customerID", orderClass); custProperty.getWriteMethod().invoke(orderObject, "C001"); PropertyDescriptor itemProperty = new PropertyDescriptor("itemID", orderClass); itemProperty.getWriteMethod().invoke(orderObject, "I001"); PropertyDescriptor priceProperty = new PropertyDescriptor("price", orderClass); priceProperty.getWriteMethod().invoke(orderObject, Double.valueOf(100.00)); PropertyDescriptor qtyProperty = new PropertyDescriptor("qty", orderClass); qtyProperty.getWriteMethod().invoke(orderObject, Integer.valueOf(20)); // Invoke the processOrder() method and print the result // The response class is String Object[] result = client.invoke(opName, orderObject); System.out.println("The order ID is " + result[0]); }}
启动服务端
mvn test –Pserver
启动客户端
mvn test -POrderProcessJaxWsDynClient
动态调用时cxf有bug,重写了一下
/** * 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. */
1、网络上现成的资料
格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径`
linux sed 批量替换多个文件中的字符串
sed -i "s/oldstring/newstring/g" `grep oldstring -rl yourdir`
例如:替换/home下所有文件中的www.admi
对于AJAX应用(使用XMLHttpRequests)来说,向服务器发起请求的传统方式是:获取一个XMLHttpRequest对象的引用、发起请求、读取响应、检查状态码,最后处理服务端的响应。整个过程示例如下:
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange
Hive中的排序语法 2014.06.22 ORDER BY
hive中的ORDER BY语句和关系数据库中的sql语法相似。他会对查询结果做全局排序,这意味着所有的数据会传送到一个Reduce任务上,这样会导致在大数量的情况下,花费大量时间。
与数据库中 ORDER BY 的区别在于在hive.mapred.mode = strict模式下,必须指定 limit 否则执行会报错。
post-commit hook failed (exit code 1) with output:
svn: E155004: Working copy 'D:\xx\xxx' locked
svn: E200031: sqlite: attempt to write a readonly database
svn: E200031: sqlite: attempt to write a