android - 思科 MSE API : SOAP communication with Android APP

标签 android soap cisco ksoap

我想知道如何在 android 源代码中应用 SOAP-Request 参数。

例子...

Q1。这是正确的吗 ? (<--)

private static final String SOAP_ACTION = "           "; <-- ???
private static final String METHOD_NAME = "GetStationStats "; <-- Is this right?
private static final String NAMESPACE = " http://cisco/mse/location"; <-- Is this right?
private static final String URL = "https://192.168.100.231/location"; <-- Is this right?

Q2。 从 Soap-xml 更改

<AesBusinessSession id="10510"/>      
<AesMobileStation macAddress="00:01:02:03:04:05"/> 

=> 到安卓源

request.addProperty("AesBusinessSession id" ,10510);    <-- Is this right?
request.addProperty("AesMobileStation macAddress" ,00:01:02:03:04:05);    <-- Is this right?

这是我的来源。

private void soapData(String searchData) {
SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);        
Log.e("dd", "Soap Created");        
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);        
envelope.dotNet=true;        
envelope.setOutputSoapObject(request);
request.addProperty("SQL" ,searchData);
HttpTransportSE androidHttpTransport=new HttpTransportSE(URL);
androidHttpTransport.debug = true;
 try       
{            
   androidHttpTransport.call(SOAP_ACTION, envelope);           
   SoapPrimitive result = (SoapPrimitive)envelope.getResponse();            //String result1 = xmlPasing(result.toString()); //xml파싱           
   String re_xml = result.toString();            
   outPut.setText(re_xml); //결과값 출력       
} 
catch(Exception e)       
{           
   Log.e("dd", "Soap Catch",e);            
   e.printStackTrace();       
} //try-catch    
}

============================================= ===== 例子 方法:GetStationStats

根据各种搜索条件返回当前存储在 MSE 中的 AesMobileStation 统计记录。结果:一个 AesBaseStats 对象,如果找不到则返回 null 参数:AesBusinessSession、AesMobileStation Key

7.3.1 SOAP 请求

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">   
<SOAP-ENV:Body>    
<GetStationStats xmlns=” http://cisco.com/mse/location”>       
<AesBusinessSession id="10510"/>      
<AesMobileStation macAddress="00:01:02:03:04:05"/>     
</GetStationStats>   
</SOAP-ENV:Body>
 </SOAP-ENV:Envelope> 

7.3.2 SOAP 响应 7.3.2.1 成功

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">   
<SOAP-ENV:Body>    
<Response xmlns=” http://cisco.com/mse/location”>       
<AesBaseStats  macAddress="00:01:02:03:04:05" packetsSent=”12” bytesSent=”1221111” packetsRecv=”1111” bytesRecv=”1212204” policyErrors=”0” changedOn=”1220324324”/>    
</Response>  
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> 

============================================= =============

最佳答案

SOAP_ACTION - 你可以在 wsdl 中看到它,可能是这样的:"http://cisco/mse/location/GetStationStats" . METHOD_NAMENAMESPACE似乎是正确的。 URL - 服务网址,我不知道它是否正确。你也可以在 wsdl 中看到它。

request.addProperty("AesBusinessSession id" ,10510);
request.addProperty("AesMobileStation macAddress" ,00:01:02:03:04:05);

这是错误的(输出类似于:<AesBusinessSession id>10510</AesBusinessSession id>。 您可以使用 SoapObjectSoapPrimitive用于添加属性:

SoapObject request=new SoapObject(NAMESPACE, METHOD_NAME);
SoapObject aesBusinessSession = new SoapObject(NAMESPACE, "AesBusinessSession");
aesBusinessSession.addAttribute("id",10510); 
SoapObject aesBaseStats = new SoapObject(NAMESPACE, "AesBaseStats");  
...//add attrs to aesBaseStats 
request.addSoapObject(aesBusinessSession);
request.addSoapObject(aesBaseStats);

关于android - 思科 MSE API : SOAP communication with Android APP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18138483/

相关文章:

java - Bitmap Compressor() 返回空指针异常

Android 服务,可能与否?

android - "Select "从现有模型导入 - Gradle ""- Whaaa?

java - 从新上下文绑定(bind)到服务以进行配置更改或从应用程序上下文绑定(bind)?

java - 无法读取 SOAP 请求和响应中存在的自定义 xsd 命名空间

.net - 如何从.NET生成的SOAP客户端而不是序列化的对象获得原始XML响应?

javascript - CSRF错误发生在Angular2中,但在Postman中一切正常(SOAP XML Ajax)

network-programming - 以编程方式管理思科; Telnet 与 SNMP?

java - 如何修复执行 `javax.telephony.Call#connect` 时代码为 100 的 PlatformException Impl ?

linux - 如何打包 Go 程序使其自给自足?