프 록 시 를 통 해 WebService 에 접근

5531 단어 webservice
    ( )

public
String getService(String methodName, String xml) {
try {
String endpointURL = "http://219.136.207.188/mobtongbao/services/UmpsToGmccWS";
AxisProperties.setProperty("http.proxyHost", "10.243.184.17"); // IP
AxisProperties.setProperty("http.proxyPort", "8081"); //
AxisProperties.setProperty("http.proxyUser", "dwyaoyongsheng"); //
AxisProperties.setProperty("http.proxyPassword", "yys963"); //
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(endpointURL);
call.addParameter("test", XMLType.XSD_STRING, ParameterMode.IN);
call.setOperationName(methodName);
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
String ret = (String) call.invoke(new Object[] { new String(xml) });
return ret;
} catch (Exception e) {
return "";
}
}
( )
proxyFalg=getinfo.getNetProxyProperty("proxyFalg");
// try...cache
URL url = new URL( "http://192.168.80.7:8080/DBJailServer/services/ReadClient");
if(proxyFalg.equals("1")){
//
SocketAddress add = new InetSocketAddress("192.168.80.4",
808);
// webservices
AxisProperties.setProperty("http.proxyHost","168.168.80.4");
AxisProperties.setProperty("http.proxyPort","808");
AxisProperties.setProperty("http.proxyUser","");
AxisProperties.setProperty("http.proxyPassword","");
Proxy p=null;
if(getinfo.getNetProxyProperty("proxyType").equals("sock5")){
p= new Proxy(Proxy.Type.SOCKS , add);
}
else
{
p = new Proxy(Proxy.Type.HTTP , add);
}
//
HttpURLConnection conn = (HttpURLConnection)url.openConnection(p);
conn.connect();
}
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(url);
call.setOperationName( new QName("ReadClient", name) );
call.addParameter( "op1", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "op2", XMLType.XSD_STRING, ParameterMode.IN );
call.addParameter( "op3", XMLType.XSD_INT, ParameterMode.IN );
call.addParameter( "op4", XMLType.XSD_INT, ParameterMode.IN );
call.setReturnType(XMLType.XSD_STRING );

result = (String)call.invoke(new Object[]{str,key,length,count});//
System.out.println(result);
    ( )
/**
axis webservice 。 :*
*/

AxisProperties.setProperty("http.proxyHost", ProxyServer.getValue("host"));
AxisProperties.setProperty("http.proxyPort", ProxyServer.getValue("port"));
AxisProperties.setProperty("http.proxyUser",ProxyServer.getValue("username"));
AxisProperties.setProperty("http.proxyPassword",ProxyServer.getValue("password"));

//ProxyServer 。


좋은 웹페이지 즐겨찾기