当前位置: 首页 > 工具软件 > Anytype > 使用案例 >

android中SOAP的anytype问题

公孙阳文
2023-12-01
SoapObject resultObj = null;
		try{
			SoapObject rpc = new SoapObject(NAMESPACE, METHORD_NAME); 
	    	
	    	SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
	    	envelope.bodyOut = rpc; 
	    	envelope.setOutputSoapObject(rpc);
	    	
	    	rpc.addProperty("methodName", methodName);
	    	rpc.addProperty("xmlInfo", xml_info);
	    	
	    	String URL = SysConfig.getInstance().getRootPath()+"services/"+AXIS_NAME+"?wsdl"; 
	    	HttpTransportSE ht = new HttpTransportSE(URL); 
	    	ht.debug = true;
	    	
	    	String SOAP_ACTION = NAMESPACE+"/" + METHORD_NAME; 
	    	ht.call(SOAP_ACTION, envelope);  
	    	
	    	resultObj = (SoapObject)envelope.bodyIn;
		}catch(Throwable ex){
			Log.d("connect",ex.getMessage());
			resultObj = new SoapObject(NAMESPACE, METHORD_NAME);
			resultObj.addProperty("return", "登录连接异常");
		}

在调测时,发现

String rtnStr = resultObj.getProperty("return").toString();

方式获取的rtnStr是anyType{},在经过一段时间排查和验证,发现如果服务器测返回return "",则会出现在这种情况

 类似资料: