最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

org.apache.axis2.AxisFault:Transporterror:411Error:Leng

来源:动视网 责编:小采 时间:2020-11-09 07:36:02
文档

org.apache.axis2.AxisFault:Transporterror:411Error:Leng

org.apache.axis2.AxisFault:Transporterror:411Error:Leng:package axiom; import java.util.Date; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Cons
推荐度:
导读org.apache.axis2.AxisFault:Transporterror:411Error:Leng:package axiom; import java.util.Date; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Cons


package axiom; import java.util.Date; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Cons

package axiom;

import java.util.Date;

import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HTTPConstants;
import org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties;

public class WeatherAxiomClient {

private static EndpointReference targetEPR =
new EndpointReference(
"http://www.webxml.com.cn/WebServices/WeatherWebService.asmx");

private static OMFactory fac = OMAbstractFactory.getOMFactory();

public static void main(String args[]) throws AxisFault{
Date start=new Date();
System.out.println("start:"+start);
ServiceClient sender = new ServiceClient();
sender.setOptions(buildOptions());
OMElement result = sender.sendReceive(buildParam());
System.out.println(result);
Date end=new Date();
System.out.println("end:"+end);
System.out.println("between:"+(end.getTime()-start.getTime()));
}
public static OMElement buildParam() {
OMNamespace omNs = fac.createOMNamespace("http://WebXml.com.cn/", "tns");
OMElement data = fac.createOMElement("getSupportCity", omNs);
OMElement inner = fac.createOMElement("byProvinceName", omNs);
inner.setText("All");
data.addChild(inner);
return data;

}

public static Options buildOptions(){
Options options = new Options();
options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);
options.setAction("http://WebXml.com.cn/getSupportCity");
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
// options.setProperty(HTTPConstants.CHUNKED, "false");//设置不受限制.
options.setProperty(HTTPConstants.PROXY, buildProxy());
return options;

}
public static ProxyProperties buildProxy(){
ProxyProperties proxyProperties=new ProxyProperties();
proxyProperties.setProxyName("172.19.18.22");
proxyProperties.setProxyPort(8080);
return proxyProperties;
}


}
点评:这里有一点要注意的是,当采用axiom进行服务端webservice调用时,http会受限制,所以以上注释的地方必需加上,就可以访问了

文档

org.apache.axis2.AxisFault:Transporterror:411Error:Leng

org.apache.axis2.AxisFault:Transporterror:411Error:Leng:package axiom; import java.util.Date; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMNamespace; import org.apache.axiom.soap.SOAP11Cons
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top