| | |
| | | * 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; |
| | |
| | | |
| | | 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(); |
| | | } |
| | |
| | | * @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-----------"); |
| | |
| | | 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; |
| | | } |