请求webservice(请求格式 字符转换等)

public Object getVehicleInfo(String url, Map params, String code) throws UnsupportedEncodingException, MalformedURLException {
    String queryXmlDoc = getWriteXML(params, "QueryCondition");
    String outServiceUrlInnerurl = "http://10.231.89.224:9092/outService/services/CdtOutAccess?wsdl";
    queryXmlDoc = code + "@@" + outServiceXlh + "@@" + queryXmlDoc;
     Service service = new Service();
    String backMsgXML = "";
    try {
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new URL(url));
        call.setUseSOAPAction(true);
        // WSDL里面描述的接口名称
        call.setOperationName(new javax.xml.namespace.QName("命名空间", "接口方法名"));
        call.addParameter("jkurl", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("jkhsm", XMLType.XSD_STRING, ParameterMode.IN);
        call.addParameter("jkcs", XMLType.XSD_STRING, ParameterMode.IN);
        // 设置返回类型
        call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
        Object[] param = {outServiceUrlInnerurl, "outService", queryXmlDoc};
        System.out.println(queryXmlDoc);
        String xmlResult = (String) call.invoke(param);
        System.out.println(xmlResult);
        backMsgXML = decodeUTF8(xmlResult);
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return backMsgXML;
}
 
  
/**
 * 中文转utf-8
 *
 * @param xmlDoc
 * @return
 */
public static String encodeUTF8(String xmlDoc) {
    String str = null;
    try {
        str = URLEncoder.encode(xmlDoc, "utf-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return str;
}

/**
 * utf-8转中文
 *
 * @param str
 * @return
 */
public static String decodeUTF8(String str) {
    String xmlDoc = null;
    try {
        xmlDoc = URLDecoder.decode(str, "utf-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    return xmlDoc;
}

/**
 * XML文档格式封装
 *
 * @param param
 * @param jdbq
 * @return
 */
public static String getWriteXML(Map param, String jdbq) throws UnsupportedEncodingException {
    StringBuilder writeXML = new StringBuilder("\'1.0\' encoding=\'GBK\'?>");
    writeXML.append("");
    writeXML.append("<").append(jdbq).append(">");
    for (Map.Entry entry : param.entrySet()) {
        writeXML.append("<").append(entry.getKey().toString().toLowerCase()).append(">")
                .append(encodeUTF8(entry.getValue() == null ? "" : entry.getValue().toString()))
                .append(").append(entry.getKey().toString().toLowerCase()).append(">");
    }
    writeXML.append(").append(jdbq).append(">");
    writeXML.append("");
    return writeXML.toString();
}