wuxw7
2018-11-25 28c9d9bac4df3dfc10467befdc377b60e29d4031
java110-common/src/main/java/com/java110/common/util/WebServiceAxisClient.java
@@ -7,6 +7,8 @@
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
import com.java110.common.constant.ResponseConstant;
import com.java110.common.exception.BusinessException;
import com.java110.common.log.LoggerEngine;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
@@ -14,16 +16,21 @@
public class WebServiceAxisClient extends LoggerEngine {
    public static void main(String[] args) {
        String url = "http://135.192.100.2:9001/QH10000Web/WebTelecom10000";
        String function = "getBalance";
        String url = "http://135.192.70.67:9084/serviceAgent/http/FactorageManager_ForAgent?AppKey=2017082401";
        String function = "queryOrderInfo";
        String areaCode = "0971";
        String accNbr = "18997240042";
        String type = "2";
        Object[] obj = new Object[]{areaCode, accNbr, type};
        String xml  = "<QueryOrderInfoRequest>\n" +
                "\t<accNbr>18009706604</accNbr>\n" +
                "\t<accNbrType>1</accNbrType> \n" +
                "\t<areaCode>0971</areaCode>\n" +
                "\t<channelId></channelId>\n" +
                "\t<staffCode></staffCode> \t\n" +
                "</QueryOrderInfoRequest>";
        try {
            Object retObj = WebServiceAxisClient.callWebService(url, function, obj);
            Object retObj = WebServiceAxisClient.callWebService(url, function, new Object[]{xml});
        } catch (Exception e) {
            e.printStackTrace();
        }
@@ -52,7 +59,7 @@
     * @return
     * @throws Exception
     */
    public static Object callWebService(String url, String function, Object[] obj,Integer timeOut) throws Exception{
    public static Object callWebService(String url, String function, Object[] obj,Integer timeOut) throws BusinessException {
        Object retObj = null;
        try {
            logger.debug("-----------开始调用Web Service-----------");
@@ -73,7 +80,7 @@
            logger.error("-----------调用Web Service异常,原因:{}", e);
            e.printStackTrace();
            retObj = e.getMessage();
            throw new Exception("WebServiceAxisClient.callWebService throws Exception : " + e.getMessage(), e);
            throw new BusinessException(ResponseConstant.RESULT_CODE_INNER_ERROR,"WebServiceAxisClient.callWebService throws Exception : " + e.getMessage());
        }
        return retObj;
    }