锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲人成人77777在线播放,亚洲黄色在线观看视频,亚洲综合精品第一页http://m.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://m.tkk7.com/justinchen/archive/2008/11/05/238909.htmlJustin ChenJustin ChenWed, 05 Nov 2008 14:48:00 GMThttp://m.tkk7.com/justinchen/archive/2008/11/05/238909.htmlhttp://m.tkk7.com/justinchen/comments/238909.htmlhttp://m.tkk7.com/justinchen/archive/2008/11/05/238909.html#Feedback1http://m.tkk7.com/justinchen/comments/commentRss/238909.htmlhttp://m.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://m.tkk7.com/justinchen/archive/2008/11/05/238868.htmlJustin ChenJustin ChenWed, 05 Nov 2008 10:24:00 GMThttp://m.tkk7.com/justinchen/archive/2008/11/05/238868.htmlhttp://m.tkk7.com/justinchen/comments/238868.htmlhttp://m.tkk7.com/justinchen/archive/2008/11/05/238868.html#Feedback0http://m.tkk7.com/justinchen/comments/commentRss/238868.htmlhttp://m.tkk7.com/justinchen/services/trackbacks/238868.html闃呰鍏ㄦ枃

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

]]>
主站蜘蛛池模板: 日本免费高清视频| 国产精品hd免费观看| 1000部啪啪未满十八勿入免费| 亚洲中文字幕久久精品无码喷水| 相泽南亚洲一区二区在线播放| 美女黄网站人色视频免费国产 | 亚洲欧美综合精品成人导航| av无码国产在线看免费网站| 亚洲AV无码精品色午夜在线观看| 中文字幕无线码中文字幕免费| 亚洲午夜久久久久妓女影院 | 精品久久久久久久久亚洲偷窥女厕| 青娱分类视频精品免费2| 亚洲国产成人久久三区| 成年美女黄网站18禁免费| 最新亚洲卡一卡二卡三新区| 亚洲视屏在线观看| xxxxwww免费| 亚洲影院天堂中文av色| 国产精品免费小视频| 一级毛片视频免费观看| 亚洲成Av人片乱码色午夜| 9420免费高清在线视频| 亚洲精品无码成人片久久不卡| 免费不卡中文字幕在线| 日本免费高清视频| 99999久久久久久亚洲| 无码国产亚洲日韩国精品视频一区二区三区| 添bbb免费观看高清视频| 亚洲三区在线观看无套内射| 99re免费视频| 亚洲а∨精品天堂在线| 中文字幕亚洲日韩无线码| 在线观看的免费网站无遮挡| 中文字幕在线观看亚洲视频| 亚洲国产成人久久综合野外| 怡红院免费的全部视频| 亚洲AV无码久久久久网站蜜桃| 一区二区三区亚洲视频| 免费无码成人AV在线播放不卡| 亚洲成av人片在线天堂无 |