在使用 .net Web 服务单击列表中的项目后,我试图获取子文件夹。请建议。谢谢
public void Treedata(){
try {
SoapObject datarequest = new SoapObject(NAMESPACE, TREEDATA_METHOD);
datarequest.addProperty("UserID", 1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(datarequest);
Log.i("LoginDetail", "UserID " + 1);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION_TREEDATA, envelope);
SoapObject dataresponse = (SoapObject)envelope.getResponse();
Log.i("myData", dataresponse.toString());
datalist = new String[dataresponse.getPropertyCount()];
for(int i=0; i< dataresponse.getPropertyCount(); i++)
datalist[i] = dataresponse.getProperty(i).toString();
treedata = (ListView)findViewById(R.id.treedata);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, datalist);
treedata.setAdapter(adapter);
treedata.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View v,int position, long id) {
// TODO Auto-generated method stub
// What to do here??? So that sub folders can get into next activity.
Intent intent = new Intent(getApplicationContext(), Files_Folders_Activity.class);
startActivity(intent);
}
});
}
}
}
下一个活动:
public void subfolderTreedata(){
try {
SoapObject subfolderrequest = new SoapObject(NAMESPACE, SUBFOLDERTREEDATA_METHOD);
subfolderrequest.addProperty("FolderID", 13002); //13002 is folderID how can I get multiple Id Dynamically?
subfolderrequest.addProperty("UserID", 1);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(subfolderrequest);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
androidHttpTransport.call(SOAP_ACTION_SUBFOLDERTREEDATA , envelope);
SoapObject dataresponse = (SoapObject)envelope.getResponse();
Log.i("subfoldersData", dataresponse.toString());
// if(UserID || FolderID == dataresponse){ //How to get dynamic userId and Password right now I am having static 1 for user password authentication, what to do for multiple authentication.
subfolderslist = new String[dataresponse.getPropertyCount()];
for(int i=0;i< dataresponse.getPropertyCount(); i++)
subfolderslist[i] = dataresponse.getProperty(i).toString();
subfolderstreedata = (ListView)findViewById(R.id.subfolderstreedata);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, subfolderslist);
subfolderstreedata.setAdapter(adapter);
我的网络服务:
Host: ***.***.*.*
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/TreeDataSubFolder"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TreeDataSubFolder xmlns="http://tempuri.org/">
<FolderID>string</FolderID>
<UserId>string</UserId>
</TreeDataSubFolder>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<TreeDataSubFolderResponse xmlns="http://tempuri.org/">
<TreeDataSubFolderResult>
<FileFolderDetails>
<ID>int</ID>
<Name>string</Name>
<SubjectType>string</SubjectType>
</FileFolderDetails>
<FileFolderDetails>
<ID>int</ID>
<Name>string</Name>
<SubjectType>string</SubjectType>
</FileFolderDetails>
</TreeDataSubFolderResult>
</TreeDataSubFolderResponse>
</soap:Body>
</soap:Envelope>
我只是想确认如何同时发送 FOLDERID 和 USERID 以获取子文件夹并从 listitem 检索数据。