锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲人成人77777在线播放,亚洲黄色在线观看视频,亚洲综合精品第一页http://www.tkk7.com/justinchen/category/35770.htmlzh-cnWed, 05 Nov 2008 17:23:24 GMTWed, 05 Nov 2008 17:23:24 GMT60Create Restful Web Service With CXF 2.1.X/CXF 2.2, Part 1: create a service in Tomcat (Contine) - Create client codehttp://www.tkk7.com/justinchen/archive/2008/11/05/238909.htmlJustin ChenJustin ChenWed, 05 Nov 2008 14:48:00 GMThttp://www.tkk7.com/justinchen/archive/2008/11/05/238909.htmlhttp://www.tkk7.com/justinchen/comments/238909.htmlhttp://www.tkk7.com/justinchen/archive/2008/11/05/238909.html#Feedback1http://www.tkk7.com/justinchen/comments/commentRss/238909.htmlhttp://www.tkk7.com/justinchen/services/trackbacks/238909.html

The previous message only explains how to create service, this message will describe how to create client and invoke server side. Actually, JSR-311 only defined the server API, so, each vendor will have different ideas on client. But one common way is to use Apache Http Common Client lib. Please see following examples.

1. GET a customer

// Sent HTTP GET request to query customer info

System.out.println(
"Sent HTTP GET request to query customer info");

URL url 
= new URL("http://localhost:8080/vendor_search/services/customerservice/customers/123");

InputStream in 
= url.openStream();

System.out.println(getStringFromInputStream(in)); 
//NOTE, return an input stream, you need convert xml to Java Object by yourself
2. Use PUT to update a customer


System.out.println("Sent HTTP PUT request to update customer info");

Client client 
= new Client();

String inputFile 
= client.getClass().getResource("update_customer.txt").getFile();

File input 
= new File(inputFile);

PutMethod put 
= new PutMethod("http://localhost:8080/vendor_search/services/customerservice/customers");

RequestEntity entity 
= new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");

put.setRequestEntity(entity);

HttpClient httpclient 
= new HttpClient();



try {

int result = httpclient.executeMethod(put);

System.out.println(
"Response status code: " + result);

System.out.println(
"Response body: ");

System.out.println(put.getResponseBodyAsString());

finally {

// Release current connection to the connection pool once you are

// done

put.releaseConnection();

}
3. Use POST to add a customer

System.out.println(
"Sent HTTP POST request to add customer");

inputFile 
= client.getClass().getResource("add_customer.txt").getFile();

input 
= new File(inputFile);

PostMethod post 
= new PostMethod("http://localhost:8080/vendor_search/services/customerservice/customers");

post.addRequestHeader(
"Accept" , "text/xml");

entity 
= new FileRequestEntity(input, "text/xml; charset=ISO-8859-1");

post.setRequestEntity(entity);

httpclient 
= new HttpClient();



try {

int result = httpclient.executeMethod(post);

System.out.println(
"Response status code: " + result);

System.out.println(
"Response body: ");

System.out.println(post.getResponseBodyAsString());

finally {

// Release current connection to the connection pool once you are

// done

post.releaseConnection();

}

So, for this way provided by Apach Common Http Client, the user still need think about the convention from XML to POJO. It is not so convenience. We will provide a utility class to simply this process.



]]>
Create Restful Web Service With CXF 2.1.X/CXF 2.2, Part 1: Create a service in Tomcathttp://www.tkk7.com/justinchen/archive/2008/11/05/238868.htmlJustin ChenJustin ChenWed, 05 Nov 2008 10:24:00 GMThttp://www.tkk7.com/justinchen/archive/2008/11/05/238868.htmlhttp://www.tkk7.com/justinchen/comments/238868.htmlhttp://www.tkk7.com/justinchen/archive/2008/11/05/238868.html#Feedback0http://www.tkk7.com/justinchen/comments/commentRss/238868.htmlhttp://www.tkk7.com/justinchen/services/trackbacks/238868.html闃呰鍏ㄦ枃

]]>
Creating Restful Web Service instead of SOAP web servicehttp://www.tkk7.com/justinchen/archive/2008/11/05/238760.htmlJustin ChenJustin ChenWed, 05 Nov 2008 02:43:00 GMThttp://www.tkk7.com/justinchen/archive/2008/11/05/238760.htmlhttp://www.tkk7.com/justinchen/comments/238760.htmlhttp://www.tkk7.com/justinchen/archive/2008/11/05/238760.html#Feedback1http://www.tkk7.com/justinchen/comments/commentRss/238760.htmlhttp://www.tkk7.com/justinchen/services/trackbacks/238760.html闃呰鍏ㄦ枃

]]>
主站蜘蛛池模板: 国产精品亚洲专区无码WEB| 亚洲精品国产成人| eeuss在线兵区免费观看| 国产伦精品一区二区三区免费下载| 亚洲依依成人精品| 欧洲乱码伦视频免费| 亚洲一级视频在线观看| 免费毛片a在线观看67194| 久久亚洲精品国产亚洲老地址| 国产免费不卡v片在线观看| 亚洲精品无码久久久久久| 亚洲AV无码一区二区三区在线观看 | 国产精品亚洲va在线观看| 免费一级毛片在线播放| 一区二区在线免费视频| 国产成A人亚洲精V品无码| 99久久久国产精品免费牛牛四川| 亚洲国产品综合人成综合网站| 久久精品免费一区二区喷潮| 亚洲av无码专区在线观看亚| 亚洲国产成人精品无码久久久久久综合 | 一本色道久久综合亚洲精品蜜桃冫| 免费黄色app网站| 一区二区三区在线免费| 亚洲成在人天堂在线| 成人爽A毛片免费看| 免费在线观看一区| 婷婷精品国产亚洲AV麻豆不片 | 国产亚洲无线码一区二区| 亚洲精品免费在线| 亚洲av片在线观看| 亚洲第一极品精品无码久久| 国产精品色拉拉免费看| 一区二区三区精品高清视频免费在线播放| 亚洲熟妇无码八AV在线播放| 真人做人试看60分钟免费视频| 色天使亚洲综合一区二区| 国产亚洲精品a在线无码| 久久精品a一国产成人免费网站| 乱淫片免费影院观看| 亚洲精品mv在线观看|