use of org.apache.axis.client.Service in project portal by ixinportal.
the class ReceiptConfigService method receiptTest.
// 电票查询票数测试
public Map<String, Object> receiptTest(String idCode) {
Map<String, Object> re = new HashMap<String, Object>();
re.put("retCode", false);
re.put("retMsg", "测试失败");
Call call;
String val = "";
String content = "<REQUEST_COMMON_FPKCCX class='REQUEST_COMMON_FPKCCX'> <NSRSBH>" + idCode + "</NSRSBH> </REQUEST_COMMON_FPKCCX> ";
try {
String xml = getCommonXml("DFXJ1001", new BASE64Encoder().encodeBuffer(content.getBytes("UTF-8")));
String ssl_store = "D:/cer/fapiao_ceshi.truststore";
String ssl_pwd = "654321";
System.setProperty("javax.net.ssl.trustStore", ssl_store);
System.setProperty("javax.net.ssl.keyStorePassword", ssl_pwd);
HostnameVerifier hv = new HostnameVerifier() {
public boolean verify(String urlHostName, SSLSession session) {
System.out.println("Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost());
return true;
}
};
HttpsURLConnection.setDefaultHostnameVerifier(hv);
Service s = new Service();
call = (Call) s.createCall();
call.setTargetEndpointAddress(new java.net.URL("https://202.104.113.26:8999/fpt_dsqz/services/DZFPService"));
call.setOperation("doService");
Object[] fn01 = { xml };
System.out.println(xml);
val = (String) call.invoke(fn01);
if (StringUtils.isNotEmpty(val)) {
re.put("retCode", true);
re.put("retMsg", "测试成功");
}
System.out.println(val);
} catch (Exception e) {
e.printStackTrace();
}
return re;
}
use of org.apache.axis.client.Service in project OpenTripPlanner by opentripplanner.
the class NoDownloadIDException method getDownloadURLs.
private List<URL> getDownloadURLs() {
List<URL> urls = new ArrayList<URL>();
List<String> payloads = getValidateElements();
log.info("Getting urls from request validation service");
String RTendpointURL = "http://extract.cr.usgs.gov/requestValidationService/services/RequestValidationService";
try {
int nd = 0;
for (String payload : payloads) {
// FIXME document why this sleep call exists. Rate limiting?
sleep(2000);
Service RTservice = new Service();
Call RTcall = (Call) RTservice.createCall();
RTcall.setTargetEndpointAddress(new java.net.URL(RTendpointURL));
// Service method
RTcall.setOperationName(new QName("edc.usgs.gov", "processAOI"));
String response = (String) RTcall.invoke(new Object[] { payload });
Document doc = stringToDoc(response);
XPathExpression expr = makeXPathExpression("//ns1:processAOIReturn/text()");
String xml = expr.evaluate(doc);
if (!xml.equals("")) {
// case where response is wrapped
doc = stringToDoc(xml);
}
// ... which seems to get prematurely decoded
// xml = xml.replace("&", "&");
expr = makeXPathExpression("//PIECE/DOWNLOAD_URL");
NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET);
// hopefully, this will be a list of one.
if (nodes.getLength() > 1) {
log.debug("One of our NED tiles requires more than one tile from the server. This is slightly inefficient, and sort of yucky.");
}
for (int i = 0; i < nodes.getLength(); ++i) {
Node node = nodes.item(i);
String urlString = node.getTextContent().trim();
log.info("Getting URL {}/{}", ++nd, payloads.size());
log.debug("Adding NED URL: " + urlString);
// use one specific, less-broken server at usgs
// urls returned are broken
urlString = urlString.replaceAll(" ", "+");
// sometimes.
URL url = new URL(urlString);
urls.add(url);
}
}
return urls;
} catch (Exception e) {
throw new RuntimeException("Error getting data from USGS Request Validation Server", e);
}
}
use of org.apache.axis.client.Service in project csb-sdk by aliyun.
the class AxisTest method testCmdWsCaller.
@Test
public void testCmdWsCaller() throws Exception {
String ak = "ak";
String sk = "sk";
String apiName = "PING";
String apiVersion = "vcsb.ws";
Service service = new Service();
Call call = AxisCallWrapper.createCallWrapper(service, ak, sk, apiName, apiVersion);
call.setTargetEndpointAddress("http://localhost:9081/PING/vcsb.ws/ws2ws");
call.setOperationName(new QName("http://hc.wsprocess.csb.alibaba.com/", "ping"));
// call.setEncodingStyle(null);
// 设置要传递的参数
call.addParameter(// 设置要传递的参数
"arg0", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
Object[] args = { "wiseking" };
Object ret = call.invoke(args);
System.out.println("ret=" + ret);
}
Aggregations