软件开发与调试的实践与思考
一、HotKey服务测试与XML处理
在软件开发中,我们常常需要对服务进行测试并处理复杂的XML数据。下面是一个测试HotKey服务的Java代码示例:
public class TestHotKeyService {
public static void main (String[] args) throws Exception {
String strURL = "http://xxxxxxxxxxx/HotKey/HotKeyService";
String strXMLFilename = "SampleXMLRequest.xml";
File input = new File(strXMLFilename);
PostMethod post = new PostMethod(strURL);
post.setRequestBody(new FileInputStream(input));
if (input.length( ) < Integer.MAX_VALUE) {
post.setRequestContentLength((int)input.length( ));
} else {
post.setRequestContentLength(
EntityEnclosingMethod.CONTENT_LENGTH_CHUNKED);
}
post.setReq
超级会员免费看
订阅专栏 解锁全文
22万+

被折叠的 条评论
为什么被折叠?



