Php Ksoap2是否要求web服务生成wsdl?
我已经成功地编写了一个Android应用程序,它使用Ksoap2调用asp.net web服务。我现在想迁移应用程序以使用PHP web服务。我已经成功地将web服务迁移到本地PHP web服务(并使用PHP客户机进行了测试),但使用KSOAP调用它时遇到了问题。让我印象深刻的一个想法是,本机PHPWeb服务不是使用wsdl生成的,并且不能自动生成wsdl。 ksoap2是否需要wsdl才能成功调用web服务方法 asp.net web服务位于 要成功调用asp.net服务,请执行以下操作:Php Ksoap2是否要求web服务生成wsdl?,php,android,web-services,ksoap2,Php,Android,Web Services,Ksoap2,我已经成功地编写了一个Android应用程序,它使用Ksoap2调用asp.net web服务。我现在想迁移应用程序以使用PHP web服务。我已经成功地将web服务迁移到本地PHP web服务(并使用PHP客户机进行了测试),但使用KSOAP调用它时遇到了问题。让我印象深刻的一个想法是,本机PHPWeb服务不是使用wsdl生成的,并且不能自动生成wsdl。 ksoap2是否需要wsdl才能成功调用web服务方法 asp.net web服务位于 要成功调用asp.net服务,请执行以下操作: p
private static final String NAMESPACE = "http://mycomputer/";
private static final String URL = "http://mycomputer/AlumLocateService/Service.asmx";
private static final String METHOD_NAME_3 = "FindCloseDetails";
private static final String SOAP_ACTION_3 = NAMESPACE + METHOD_NAME_3;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME_3);
PropertyInfo pi = new PropertyInfo();
pi.setName("userid");
pi.setValue(userid);
pi.setType(string.class);
request.addProperty(pi);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION_3, envelope);
//Parse Response
Object myResult = envelope.bodyIn;
SoapObject resultsRequestSOAP = (SoapObject) myResult;
String[] results = getStringArrayResponse(resultsRequestSOAP, null);
return results;
PHP服务位于并复制asp.net web服务的方法。我希望我所需要做的就是改变以下内容
private static final String URL = "http://mycomputer/PHPTest/testserver.php";
然后拆下线路
envelope.dotNet = true;
但当我这样做时,当androidHttpTransport.call(SOAP_ACTION_3,envelope)调用时,我得到了“XmlPullParserException:意外类型(position END_DOCUMENT null…)。我已经改为使用PHP Zend_SOAP_服务器,我不得不将Android代码的最后一部分改为:
Object myResult = envelope.getResponse();
String[] results = null;
if (myResult instanceof Vector)
{
Vector<Object> myVector = (Vector<Object>) myResult;
results = new String[myVector.size()];
for (int i = 0; i< myVector.size();i++){
results[i] = myVector.elementAt(i).toString();
}
}
return results;
objectmyresult=envelope.getResponse();
字符串[]结果=null;
if(myResult instanceof Vector)
{
向量myVector=(向量)myResult;
结果=新字符串[myVector.size()];
对于(int i=0;i
请给出使用ksoap2调用PHP Web服务的代码。我现在已经使用Zend_Soap_服务器而不是本机SoapServer实现了我的PHP服务。Zend_Soap_服务器能够自动生成WSDL。我刚刚检查了-本机PHP SoapServer也可以工作,因为我已经更改了Android代码。