向https端发送报文出错,源代码都研究好几天了无果,求救
PostMethod mypost = new PostMethod();
mypost.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
mypost.addParameter("reqData", getrevFromBASE64(body.getBytes()));//请根据实际修改上送包xml数据
HttpClient client = new HttpClient();
client.getParams().makeStrict(); //此句必需
client.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "GBK");
Protocol myhttps = new Protocol("https", new AuthSSLProtocolSocketFactory(null, null, new URL("file:" + i.getTruststore()), null), 443);
client.getHostConfiguration().setHost(i.getIp(), Integer.parseInt(i.getPort()), myhttps);
int re_code = client.executeMethod(mypost);
结果在调用client.executeMethod(mypost);方法时报错,异常很诡异,和用
HttpConnection myconn = new HttpConnection(i.getIp(), Integer.parseInt(i.getPort()), myhttps);
myconn.open();
mypost.execute(new HttpState(), myconn);
报错是一样的,都是因为在at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)这个位置调用open方法出错,而且也不是网络的错误信息,异常如下:
Caused by: java.lang.AbstractMethodError
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at org.apache.commons.httpclient.HttpClient$executeMethod.call(Unknown Source)
at dsf.IcbcPayService.send(IcbcPayService.groovy:211)
at dsf.IcbcPayService$send.callCurrent(Unknown Source)
at dsf.IcbcPayService.sendToBank(IcbcPayService.groovy:102)
at dsf.IcbcPayService$$FastClassByCGLIB$$adfefb5f.invoke(<generated>)
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
at dsf.IcbcPayService$$EnhancerByCGLIB$$2499c1b.sendToBank(<generated>)
at dsf.IcbcPayService$sendToBank.call(Unknown Source)
at dsf.IcbcPayService$sendToBank.call(Unknown Source)
at dsf.TbAgentpayDetailsInfoController$_closure18.doCall(TbAgentpayDetailsInfoController.groovy:1136)
at dsf.TbAgentpayDetailsInfoController$_closure18.doCall(TbAgentpayDetailsInfoController.groovy)
... 1 more
--------------------编程问答--------------------
类库版本不一致,导致某些方法在旧版本的类库中没有
--------------------编程问答--------------------
我用的是这个版本commons-httpclient-3.1,并没有出现像异常提示的,调用抽象方法的动作,httpconnection.open方易做图是抽象方法吗?
补充:Java , Java EE