概述
我做了一个简单的项目,使用ksoap2调用wcf Web服务.但是当它调用envelope.getResponse();它给出了错误的说法
错误:
SoapFault – faultcode:’a:InternalServiceFault’faultstring:’由于内部错误,服务器无法处理请求.有关错误的更多信息,请在服务器上启用IncludeExceptionDetailInFaults(来自ServiceBehaviorAttribute或配置行为)以将异常信息发送回客户端,或者根据Microsoft .NET Framework 3.0 SDK文档启用跟踪并检查服务器跟踪日志. faultactor:’null’detail:null
package testing.wcf;
import java.io.IOException;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlSerializer;
import android.os.Bundle;
import android.os.StrictMode;
import android.widget.TextView;
import android.annotation.SuppressLint;
import android.app.Activity;
public class MainActivity extends Activity
{
private static final String strNAMESPACE = "http://www.testing.co.in/TestingService/";
private static final String strURL = "http://www.testing.co.in/TestingService/UserDetails.svc";
private static final String strSOAP_ACTION = "http://testing.co.in/TestingService/UserDetails/LoginDetails";
private static final String strMETHOD_NAME = "LoginDetails";
TextView tv;
StringBuilder sb;
String strInputXML;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tv = (TextView)findViewById(R.id.testing);
sb = new StringBuilder();
Call();
tv.setText(sb.toString());
//setContentView(tv);
}
public void Call()
{
try
{
SoapObject request = new SoapObject(strNAMESPACE, strMETHOD_NAME);
String inputxml = "<?xml version="+"""+"1.0"+"""+" encoding="+"""+"utf-8"+"""+" ?>" +" n 0000 n TEST n 112233 n LoginVal n ";
request.addAttribute("strInputXML", inputxml);
request.addAttribute("strOutputXML","");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(strURL);
androidHttpTransport.call(strSOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
String resultData = result.toString();
sb.append(resultData + "n");
}
catch(Exception e)
{
sb.append("Error:n" + e.getMessage() + "n");
}
}
}
在这里,我想发送这样的请求
0000
HELLO
1234
0
我的回应应该是XML
1234
最后
以上就是彪壮豌豆为你收集整理的android soapfault 服务器无法处理请求,使用ksoap2的WCF Web服务的Android – 错误SoapFault – faultcode:’a:InternalServic...的全部内容,希望文章能够帮你解决android soapfault 服务器无法处理请求,使用ksoap2的WCF Web服务的Android – 错误SoapFault – faultcode:’a:InternalServic...所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复