锘??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闃呰鍏ㄦ枃

]]>
主站蜘蛛池模板: 国产成人精品日本亚洲11| 亚洲成AV人片在线观看ww| 亚洲午夜国产精品无卡| 免费h片在线观看网址最新| 亚洲国产一区在线| 国产精品怡红院永久免费| 在线免费观看亚洲| 一二三四影视在线看片免费 | 波多野结衣免费一区视频 | 亚洲午夜无码毛片av久久京东热| 波多野结衣免费在线| 亚洲免费黄色网址| 午夜寂寞在线一级观看免费| 亚洲爆乳AAA无码专区| 四虎影视在线永久免费看黄| 一级片在线免费看| 亚洲av福利无码无一区二区| 91精品免费久久久久久久久| 亚洲爆乳无码专区www| 中文字幕不卡亚洲| 精品无码AV无码免费专区| 亚洲色大18成人网站WWW在线播放| 免费在线观看黄网站| 免费看无码特级毛片| 亚洲午夜精品一区二区公牛电影院| 成人a免费α片在线视频网站| 香蕉视频免费在线| 亚洲AV日韩AV天堂一区二区三区| 免费做爰猛烈吃奶摸视频在线观看 | 精品无码专区亚洲| 亚洲人JIZZ日本人| 久久久久久免费视频| 日韩在线一区二区三区免费视频| 亚洲精品国产精品乱码在线观看| 成人免费激情视频| 特级av毛片免费观看| 中文字幕亚洲综合久久2| 国产a级特黄的片子视频免费| 久久免费视频网站| 一本色道久久88亚洲精品综合| 国产国拍精品亚洲AV片|