接口协议restful报文类型xml通用格式怎么测试
发布网友
发布时间:2022-05-29 07:44
我来回答
共1个回答
热心网友
时间:2023-10-11 12:58
ic class TestHttp {
public void testRegist(){
try{
StringBuffer sb = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\" ?> ");
sb.append("<getData>");
sb.append("<recNum>2015</recNum>");
sb.append("<accountID>wangxin2015</accountID>");
sb.append("</getvData>");
byte[] xmlbyte = sb.toString().getBytes("UTF-8");
URL url = new U uxxx/xxxxxx");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setDoOutput(true