无法访问tempconvert Web服务 [英] Can't access tempconvert web services
本文介绍了无法访问tempconvert Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我消费tempconvert Web服务,但它不会给任何结果只是显示空白屏幕。
这是不是意味着我的应用程序不能访问Web服务,或者我有一些设置,以便它会连接到URL,我使用ksoap2 2.6.5。
这是我的code
包com.example.webservice2;进口android.os.Bundle;
进口android.widget.TextView;
进口android.app.Activity;
导入org.ksoap2 *。
进口org.ksoap2.serialization.SoapObject;
进口org.ksoap2.serialization.SoapPrimitive;
进口org.ksoap2.serialization.SoapSerializationEnvelope;
进口org.ksoap2.transport.HttpTransportSE;公共类WebService的延伸活动{ 私人最终字符串SOAP_ACTION =http://tempuri.org/CelsiusToFahrenheit;
私人最终字符串METHOD_NAME =CelsiusToFahrenheit;
私人最终字符串NAMESPACE =http://tempuri.org/;
私人最终字符串URL =http://www.w3schools.com/webservices/tempconvert.asmx; TextView的电视; @覆盖
公共无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.main); 电视=(的TextView)findViewById(R.id.tv); SoapObject请求=新SoapObject空间(namespace,METHOD_NAME);
Request.addProperty(摄氏,32); SoapSerializationEnvelope信封=新SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = TRUE;
envelope.setOutputSoapObject(请求); HttpTransportSE androidHttpTransport =新HttpTransportSE(URL); 尝试{
androidHttpTransport.call(SOAP_ACTION,信封);
SoapPrimitive响应=(SoapPrimitive)envelope.getResponse(); tv.setText(状态:+响应); }赶上(例外五){
e.printStackTrace();
}
}
}
我使用的Web服务从这个网址
http://www.w3schools.com/webservices/tempconvert.asmx
解决方案
有时,当你代理的网络上,而不是设置代理服务器设置比这个发生检查你是不是代理网络。
I am consuming tempconvert web services but it does not give any result just show blank screen.
Does that mean my app does not access the web services, or i have to some setting so it will connect to URL, i am using ksoap2 2.6.5 .
this is my code
package com.example.webservice2;
import android.os.Bundle;
import android.widget.TextView;
import android.app.Activity;
import org.ksoap2.*;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class WebService extends Activity {
private final String SOAP_ACTION = "http://tempuri.org/CelsiusToFahrenheit";
private final String METHOD_NAME = "CelsiusToFahrenheit";
private final String NAMESPACE = "http://tempuri.org/";
private final String URL = "http://www.w3schools.com/webservices/tempconvert.asmx";
TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.tv);
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("celsius", "32");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(Request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
tv.setText("status:" + response);
} catch (Exception e) {
e.printStackTrace();
}
}
}
i am using web service from this url
http://www.w3schools.com/webservices/tempconvert.asmx
解决方案
Sometime when you are on the proxy network and not set the proxy setting than this occured check that you are not on proxy network.
这篇关于无法访问tempconvert Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文