当前位置: 首页>>代码示例>>Java>>正文


Java HttpTransportSE.call方法代码示例

本文整理汇总了Java中org.ksoap2.transport.HttpTransportSE.call方法的典型用法代码示例。如果您正苦于以下问题:Java HttpTransportSE.call方法的具体用法?Java HttpTransportSE.call怎么用?Java HttpTransportSE.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ksoap2.transport.HttpTransportSE的用法示例。


在下文中一共展示了HttpTransportSE.call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getWSResponse

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
Komunikat getWSResponse(String code, String soapAction, String methodName, String outerBox) 
				throws HttpResponseException, IOException, XmlPullParserException{
	    //create envelope
	    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
	    envelope.dotNet = true;
	    envelope.implicitTypes=false;
	    
	    addSecurityHeader(envelope);
	    addMappings(envelope, outerBox);
	    
	    envelope.setOutputSoapObject(createRequestParameter(code, methodName));
	    
	    //WS call
	    HttpTransportSE transport = new HttpTransportSE(URL);
    	transport.debug = true;
//    	try{
    	transport.call(soapAction, envelope);
//    	}catch(Exception e){
//    		e.printStackTrace();
//    	}
	        
        WSResponse response = (WSResponse) envelope.bodyIn;
		return response.getKomunikat();
	}
 
开发者ID:mmprog,项目名称:wspocztapolska,代码行数:25,代码来源:WSPoczta.java

示例2: Banner

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public static String Banner(String webMethName) {
	String resTxt = null;
	// Create request
	SoapObject request = new SoapObject(NAMESPACE, webMethName);

	// Create envelope
	SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
	envelope.dotNet = true;
	// Set output SOAP object
	envelope.setOutputSoapObject(request);
	// Create HTTP call object
	HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
	try {
		// Invole web service
		androidHttpTransport.call(SOAP_ACTION + webMethName, envelope);
		// Get the response
		SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
		// Assign it to fahren static variable
		resTxt = response.toString();

	} catch (Exception e) {
		e.printStackTrace();
		resTxt = "Error occured";
	}
	return resTxt;
}
 
开发者ID:devonEdison,项目名称:videoMerge,代码行数:27,代码来源:WebService.java

示例3: doRequestInternal

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
private <TYPE> TYPE doRequestInternal(String namespace, String action, String url, HashMap<String, Object> parameters, Class<TYPE> clazz, int soapEnvelopeVersion) throws TechnicalException {
	SoapObject request = new SoapObject(namespace, action);
	for (Map.Entry<String, Object> parameter : parameters.entrySet()) {
		request.addProperty(parameter.getKey(), parameter.getValue());
	}
	SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(soapEnvelopeVersion);
	envelope.dotNet = true;
	envelope.setOutputSoapObject(request);

	HttpTransportSE httpTransport = new HttpTransportSE(url);

	try {
		if (!namespace.endsWith("/")) {
			namespace += "/";
		}
		httpTransport.call(namespace + action, envelope);
		return (TYPE) envelope.getResponse();
	} catch (Exception exception) {
		throw new TechnicalException(exception);
	}
}
 
开发者ID:KoljaTM,项目名称:HoebApp,代码行数:22,代码来源:SoapLibraryService.java

示例4: doCall

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
/**
 * Do call.
 *
 * @param url the url
 * @param nameSpace the name space
 * @param methodName the method name
 * @param params the params
 * @param listener the listener
 */
public void doCall(String url,String nameSpace,String methodName,AbSoapParams params, AbSoapListener listener) {

	String result = null;
	try {
		SoapObject request = new SoapObject(nameSpace, methodName);
		// 传递参数
		List<BasicNameValuePair> paramsList = params.getParamsList();
		for (NameValuePair nameValuePair : paramsList) {
			request.addProperty(nameValuePair.getName(), nameValuePair.getValue());
		}
		SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
				SoapEnvelope.VER11);
		envelope.bodyOut = request;
		envelope.dotNet = mDotNet;
		envelope.setOutputSoapObject(request);
		HttpTransportSE httpTransportSE = new HttpTransportSE(url,mTimeout);
		httpTransportSE.debug = true;

		AbLogUtil.d(AbSoapClient.class, "--call--");
		httpTransportSE.call(nameSpace+methodName, envelope);

		SoapObject bodyIn = (SoapObject) envelope.bodyIn;
		result = bodyIn.toString();
		if (result != null) {
			listener.sendSuccessMessage(AbHttpStatus.SUCCESS_CODE, result);
		}
	} catch (Exception e) {
		e.printStackTrace();
		listener.sendFailureMessage(AbHttpStatus.UNTREATED_CODE, AbAppConfig.UNTREATED_EXCEPTION, new AbAppException(AbAppConfig.UNTREATED_EXCEPTION));
	}
}
 
开发者ID:jingshauizh,项目名称:androidsummary,代码行数:41,代码来源:AbSoapClient.java

示例5: soap

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public Vector<?> soap(HttpServletRequest req) throws JSONException,
		IOException {
	JSONObject json = new JSONObject(IO.read(req));
	// TODO: Route to SOAP ...
	String action = req.getAttribute(Route.ACTION).toString();
	if (action == null) {
		throw new JSONException("Missing SOAP action.");
	}
	final Route route = router.route(action);
	if (route == null) {
		throw new JSONException("Not support action:" + action);
	}
	final SoapObject so = new SoapObject(route.getNameSpace(),
			route.getAction());

	Envelope envelope = createEnvelope(so, IO.toElement(json, route.getNameSpace(),
			route.getAction()));
	KXmlSerializer xmlWriter = new KXmlSerializer();
	ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
	xmlWriter.setOutput(outputStream, "UTF-8");
	envelope.write(xmlWriter);
	xmlWriter.flush();
	Logger.getLogger(Soaper.class.getName()).info(outputStream.toString());
	
	HttpTransportSE ht = getHttpTransportSE(route.getSoapUrl());
	try {
		ht.call(so.getName(), envelope);
		Vector<?> ro = (Vector<?>) envelope.getResponse();
		return ro;
	} catch (HttpResponseException | XmlPullParserException | SoapFault e) {
		throw new JSONException(e);
	}
}
 
开发者ID:cheeray,项目名称:ws-bridge,代码行数:34,代码来源:Soaper.java

示例6: getProvinceList

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public static List<String> getProvinceList() {
	// ���õķ���
	final String methodName = "getRegionProvince";
	
	FutureTask<List<String>> task = new FutureTask<List<String>>(
	new Callable<List<String>>() {
		@Override
		public List<String> call() throws Exception {
			// ����HttpTransportSE�������
			final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
			ht.debug = true;
			// ʹ��SOAP1.1Э�鴴��Envelop����
			final SoapSerializationEnvelope envelope = 
				new SoapSerializationEnvelope(SoapEnvelope.VER11);
			// ʵ����SoapObject����
			SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
			envelope.bodyOut = soapObject;
			// ������.Net�ṩ��Web Service���ֽϺõļ�����
			envelope.dotNet = true;		
			// ����Web Service
			ht.call(SERVICE_NS + methodName, envelope);
			if (envelope.getResponse() != null) {
				// ��ȡ��������Ӧ���ص�SOAP��Ϣ
				SoapObject result = (SoapObject) envelope.bodyIn;
				SoapObject detail = (SoapObject) result.getProperty(
					methodName + "Result");
				// ������������Ӧ��SOAP��Ϣ��
				return parseProvinceOrCity(detail);
			}
			return null;
		}
	});
	new Thread(task).start();
	try {
		return task.get();
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:binarychan,项目名称:NewsClient,代码行数:41,代码来源:WebServiceUtil.java

示例7: getWeatherByCity

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public static SoapObject getWeatherByCity(String cityName) {
	final String methodName = "getWeather";
	final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
	ht.debug = true;
	final SoapSerializationEnvelope envelope = 
		new SoapSerializationEnvelope(SoapEnvelope.VER11);
	SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
	soapObject.addProperty("theCityCode", cityName);
	envelope.bodyOut = soapObject;
	// ������.Net�ṩ��Web Service���ֽϺõļ�����
	envelope.dotNet = true;
	FutureTask<SoapObject> task = new FutureTask<SoapObject>(
	new Callable<SoapObject>() {
		@Override
		public SoapObject call() throws Exception {
			ht.call(SERVICE_NS + methodName, envelope);
			SoapObject result = (SoapObject) envelope.bodyIn;
			SoapObject detail = (SoapObject) result.getProperty(
				methodName + "Result");
			return detail;
		}
	});
	new Thread(task).start();
	try {
		return task.get();
	} catch (Exception e) {
		e.printStackTrace();
	}
	return null;
}
 
开发者ID:binarychan,项目名称:NewsClient,代码行数:31,代码来源:WebServiceUtil.java

示例8: addSchedule

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public String addSchedule(Schedule schedule) {


        String methodName = "addSchedule";

        SoapObject request = new SoapObject(NameSpace, methodName);

        request.addProperty("schedule", schedule.toString());

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.bodyOut = request;
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);

        HttpTransportSE ht = new HttpTransportSE(serviceURL);
        try {
            ht.call(null, envelope);
            Object response;
            if ((response = envelope.getResponse()) != null) {
                String responseStr = response.toString();
                if (responseStr.equals("anyType{}")) {
                    return "";
                } else {
                    return responseStr;
                }
            }

        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;

    }
 
开发者ID:lvsmart,项目名称:projectmanager,代码行数:34,代码来源:ScheduleService.java

示例9: getSchedule

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public String getSchedule(String day) {
    String methodName = "getSchedule";

    SoapObject request = new SoapObject(NameSpace, methodName);
    request.addProperty("day", day);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.bodyOut = request;
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(serviceURL);
    try {
        ht.call(null, envelope);
        Object response;
        if ((response = envelope.getResponse()) != null) {
            String responseStr = response.toString();
            if (responseStr.equals("anyType{}")) {
                return "";
            } else {
                return responseStr;
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:lvsmart,项目名称:projectmanager,代码行数:30,代码来源:ScheduleService.java

示例10: modifySchedule

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public String modifySchedule(int position, Schedule schedule) {
    String methodName = "modifySchedule";

    SoapObject request = new SoapObject(NameSpace, methodName);

    request.addProperty("id", schedule.getDay() + "-" + position+1);
    request.addProperty("schedule", schedule.toString());

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.bodyOut = request;
    envelope.dotNet = true;
    envelope.setOutputSoapObject(request);

    HttpTransportSE ht = new HttpTransportSE(serviceURL);
    try {
        ht.call(null, envelope);
        Object response;
        if ((response = envelope.getResponse()) != null) {
            String responseStr = response.toString();
            if (responseStr.equals("anyType{}")) {
                return "";
            } else {
                return responseStr;
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:lvsmart,项目名称:projectmanager,代码行数:32,代码来源:ScheduleService.java

示例11: getWeatherByCity

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public static SoapObject getWeatherByCity(String cityName)
		{
			final String methodName = "getWeather";
			final HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
			ht.debug = true;
			final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
			SoapObject soapObject = new SoapObject(SERVICE_NS,methodName);
			soapObject.addProperty("theCityCode",cityName);
//			soapObject.addProperty("theUserID","9cce8dbd179a4f36879a60e08aae2cb8");
			envelope.bodyOut = soapObject;
			//设置与。net提供的Web Service保持较好的兼容性
			envelope.dotNet = true;
			FutureTask<SoapObject> task = new FutureTask<SoapObject>(
					new Callable<SoapObject>(){
						@Override
						public SoapObject call() throws Exception
						{
							ht.call(SERVICE_NS + methodName, envelope);
							SoapObject result = (SoapObject) envelope.bodyIn;
							SoapObject detail = (SoapObject) result.getProperty(methodName + "Result");
							return detail;
						}
					});
			new Thread(task).start();
			try {
				return task.get();
			} catch (Exception e) {
				// TODO: handle exception
				e.printStackTrace();
			}
			return null;
		}
 
开发者ID:Tifosi-M,项目名称:Hi-Top,代码行数:33,代码来源:WeatherService.java

示例12: doInBackground

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
@Override
protected Integer doInBackground(Integer... arg0) {
	Integer result = null;
	//Creamos un objeto para la peticion
	SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
	//A�adimos los parametros
	PropertyInfo param1 = new PropertyInfo();
	param1.setName("a");
	param1.setValue(arg0[0]);
	PropertyInfo param2 = new PropertyInfo();
	param2.setName("b");
	param2.setValue(arg0[1]);
	request.addProperty(param1);
	request.addProperty(param2);
	//Creamos el mensaje a enviar
	SoapSerializationEnvelope env = new SoapSerializationEnvelope(SoapSerializationEnvelope.VER11);
	env.setOutputSoapObject(request);
	//Cliente HTTP que usaremos
	HttpTransportSE http = new HttpTransportSE(URL);
	try {
		//LLamada al web service
		http.call(NAMESPACE+METHOD_NAME, env);
		//REcogida del resultado
		SoapPrimitive prim = (SoapPrimitive) env.getResponse();
		result = Integer.valueOf(prim.toString());
	} catch (Exception e) {
		e.printStackTrace();
	}
	return result;
}
 
开发者ID:zerasul,项目名称:betabeers29nov,代码行数:31,代码来源:AsyncSoapCall.java

示例13: doRequest

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public String doRequest(String methodName, String soapAction, PropertyInfo[] properties)
					throws IllegalArgumentException {
    if ((methodName == null) || methodName.equals("") || (soapAction == null) || soapAction.equals("")
            || URL.equals("")) {
        throw new IllegalArgumentException();
    }
    String reqFileName = methodName + soapAction;
    SoapObject request = new SoapObject(NAMESPACE, methodName);
    if (properties != null) {
        for (PropertyInfo property : properties) {
            request.addProperty(property);
            reqFileName += property.getValue().toString();
        }
    }
    // if (fresh) cached string exists then return it, otherwise
    // continue with the normal retrieval
    String cached = cacher.getCachedString(reqFileName);
    if ((cached != null) && (!netEnabled || (cacher.getTimeFromLastCache(reqFileName) <= Cacher.cacheLimit))) {
        return cached;
    }
    if (netEnabled) {
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
        envelope.setOutputSoapObject(request);
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
        //androidHttpTransport.debug = true;
        try {
            androidHttpTransport.call(soapAction, envelope);
            //Log.i("DebianDebug", androidHttpTransport.requestDump);
            //Cache new response before returning it
            String response = envelope.bodyIn.toString();
            cacher.cacheString(reqFileName, response);
            return response;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    //if any errors occured return the cached string (or "" if no cached version exists)
    return (cached != null) ? cached : "";
}
 
开发者ID:uberspot,项目名称:DebianDroid,代码行数:40,代码来源:SoapCaller.java

示例14: Invoke

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
Object Invoke(Context c) {
        if (c == null)
            throw new NullPointerException("null Context passed to Invoke");

        setLastError("");
        Object o;

        if (!IsOnline(c)) {
            setLastError(c.getString(R.string.errNoInternet));
            return null;
        }

        if (m_methodName.length() == 0) {
            setLastError("No method name specified");
            return null;
        }

        if (m_request == null) {
            setLastError("No request object set");
            return null;
        }

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        // envelope.implicitTypes = true;
        AddMappings(envelope);
        envelope.setOutputSoapObject(m_request);

        String PROTOCOL = "http://";
        String PROTOCOLS = "https://";
        String URL = ((MFBConstants.fIsDebug && MFBConstants.fDebugLocal) ? PROTOCOL : PROTOCOLS) + MFBConstants.szIP + "/logbook/public/webservice.asmx";
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

        androidHttpTransport.debug = MFBConstants.fIsDebug;

        try {
            List<HeaderProperty> headerList = new ArrayList<>();
            Locale l = Locale.getDefault();
            String szLocale = String.format("%s-%s", l.getLanguage(), l.getCountry());
            HeaderProperty hp = new HeaderProperty("accept-language", szLocale);
            headerList.add(hp);

            androidHttpTransport.call(NAMESPACE + m_methodName, envelope, headerList);
            o = envelope.getResponse();
        } catch (Exception e) {
            String szFault = e.getMessage();
            if (szFault == null)
                szFault = c.getString(R.string.errorSoapError);
            else if (szFault.contains(MFBConstants.szFaultSeparator)) {
                szFault = szFault.substring(szFault.lastIndexOf(MFBConstants.szFaultSeparator) + MFBConstants.szFaultSeparator.length()).replace("System.Exception: ", "");
                int iStartStackTrace = szFault.indexOf("\n ");
                if (iStartStackTrace > 0)
                    szFault = szFault.substring(0, iStartStackTrace);
            }

            setLastError(szFault);

            o = null;
        }

        // Un-comment one or the other lines above - if debug is true - to view raw XML:
//        String sRequestDump = androidHttpTransport.requestDump;
//        String sResponseDump = androidHttpTransport.responseDump;

        return o;
    }
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:67,代码来源:MFBSoap.java

示例15: sendRequestUsingSoap

import org.ksoap2.transport.HttpTransportSE; //导入方法依赖的package包/类
public static SoapBaseResponse sendRequestUsingSoap(String namespace, String webServiceName, String method,
                                          String soapAction, Map<String, String> params, 
                                          boolean debug, BaseSoapAdapter.LogLevel logLevel,
                                          SoapPrinter soapPrinter, int timeout)
        throws IOException, XmlPullParserException {
    SoapObject request = new SoapObject(namespace, method);

    if(params != null) {
        for(String i : params.keySet()) {
            request.addProperty(i, params.get(i));
        }
    }

    long begin = Calendar.getInstance().getTimeInMillis();

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true;
    envelope.encodingStyle = SoapSerializationEnvelope.XSD;
    envelope.setOutputSoapObject(request);

    HttpTransportSE androidHttpTransport = new HttpTransportSE(
            namespace + webServiceName,
            timeout);
    androidHttpTransport.debug = debug;
    androidHttpTransport.call(soapAction, envelope);

    String url = String.format("%s%s?op=%s", request.getNamespace(), webServiceName, request.getName());
    int responseCode = androidHttpTransport.getServiceConnection().getResponseCode();

    Object response = envelope.getResponse();
    if(logLevel == BaseSoapAdapter.LogLevel.FULL) {
        long end = Calendar.getInstance().getTimeInMillis();
        soapPrinter.printLog(soapAction, method, envelope, androidHttpTransport, end - begin, url);
    }
    return new SoapBaseResponse(
            responseCode,
            androidHttpTransport.getServiceConnection().getPort(),
            url,
            androidHttpTransport.getServiceConnection().getErrorStream(),
            response);
}
 
开发者ID:moltak,项目名称:Rx-Soap,代码行数:42,代码来源:SoapTransmiter.java


注:本文中的org.ksoap2.transport.HttpTransportSE.call方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。