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


Java HttpTransportSE类代码示例

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


HttpTransportSE类属于org.ksoap2.transport包,在下文中一共展示了HttpTransportSE类的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: printLog

import org.ksoap2.transport.HttpTransportSE; //导入依赖的package包/类
@Override
public void printLog(String soapAction, String method, SoapSerializationEnvelope envelope,
                     HttpTransportSE androidHttpTransport, long processingTime, String url) throws SoapFault {
    try {
        System.out.println("URL: " + url);
        System.out.println("Response code: " + androidHttpTransport.getServiceConnection().getResponseCode());

        String prefix = String.format("-->[%s] -- begin\n", url);
        String requestRaw
                = UnformatedXmlPrettyFormmater.prettyXml(androidHttpTransport.requestDump);
        String responseRaw
                = UnformatedXmlPrettyFormmater.prettyXml(androidHttpTransport.responseDump);
        String responseSuffix = "\n<-- response\n";
        String result = String.format("\n**--- result ---**\n%s\n**--------------**\n",
                envelope.getResponse().toString());
        String processingTimeStr = String.format("Processing Time: %d(ms)\n", processingTime);
        String suffix = String.format("<-- [%s] -- end\n", url);
        String testLog = prefix + requestRaw + responseSuffix + responseRaw + result + 
                processingTimeStr + suffix;
        System.out.println(testLog);
    } catch (IOException | ParserConfigurationException | SAXException | TransformerException e) {
        e.printStackTrace();
    }
}
 
开发者ID:moltak,项目名称:Rx-Soap,代码行数:25,代码来源:DefaultSoapPrinter.java

示例4: send

import org.ksoap2.transport.HttpTransportSE; //导入依赖的package包/类
/**
 * 执行请求
 *
 * @param context
 * @param url
 * @param namespace
 * @param action
 * @param params
 * @param responseHandler
 */
public void send(Context context, String url, String namespace, String action, HashMap<String, String> params, SoapResponseHandler responseHandler) {

    if (params != null) {
        StringBuilder paramsStr = new StringBuilder(url);
        paramsStr.append('/')
                .append(action);
        if (params.size() > 0) {
            paramsStr.append('?');
        }
        SoapObject rpc = new SoapObject(namespace, action);
        for (Map.Entry<String, String> entry : params.entrySet()) {
            rpc.addProperty(entry.getKey(), entry.getValue());
            paramsStr.append(entry.getKey())
                    .append('=')
                    .append(entry.getValue())
                    .append('&');
        }
        Log.d(TAG, "sendRequest " + paramsStr.toString());
        envelope.bodyOut = rpc;
    }
    ht = new HttpTransportSE(url, TIMEOUT);
    sendRequest(ht, envelope, namespace, responseHandler, context);
}
 
开发者ID:Cangol,项目名称:Cangol-appcore,代码行数:34,代码来源:SoapClient.java

示例5: sendRequest

import org.ksoap2.transport.HttpTransportSE; //导入依赖的package包/类
/**
 * 发生请求
 *
 * @param ht
 * @param envelope
 * @param namespace
 * @param responseHandler
 * @param context
 */
protected void sendRequest(HttpTransportSE ht, SoapSerializationEnvelope envelope,
                           String namespace, SoapResponseHandler responseHandler, Context context) {

    Future<?> request = threadPool.submit(new SoapRequest(ht, envelope, namespace, responseHandler));

    if (context != null) {
        // Add request to request map
        List<WeakReference<Future<?>>> requestList = requestMap.get(context);
        if (requestList == null) {
            requestList = new LinkedList<WeakReference<Future<?>>>();
            requestMap.put(context, requestList);
        }
        requestList.add(new WeakReference<Future<?>>(request));
    }
}
 
开发者ID:Cangol,项目名称:Cangol-appcore,代码行数:25,代码来源:SoapClient.java

示例6: 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

示例7: 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

示例8: 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

示例9: getHttpTransportSE

import org.ksoap2.transport.HttpTransportSE; //导入依赖的package包/类
private final HttpTransportSE getHttpTransportSE(String serviceUrl) {
	HttpTransportSE ht = new HttpTransportSE(Proxy.NO_PROXY, serviceUrl,
			60000);
	ht.debug = true;
	ht.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->");
	return ht;
}
 
开发者ID:cheeray,项目名称:ws-bridge,代码行数:8,代码来源:Soaper.java

示例10: 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

示例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);
	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

示例12: run

import org.ksoap2.transport.HttpTransportSE; //导入依赖的package包/类
@Override
public Deferred run(Map<String, Object> params, List<String> urlExtraSegments) {
    httpTransport = new HttpTransportSE(baseUrl);
    soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    soapEnvelope.implicitTypes = true;
    soapEnvelope.dotNet = false;
    soapEnvelope.xsd = SoapSerializationEnvelope.XSD;
    soapEnvelope.enc = SoapSerializationEnvelope.ENC;
    return super.run(params, urlExtraSegments);
}
 
开发者ID:prashant31191,项目名称:meets-android,代码行数:11,代码来源:SoapApiMethod.java

示例13: 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

示例14: 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

示例15: 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


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