如何在java中为webservice请求编写条件,在我的webservice请求中,我传递的元素为self.userPassword = textField.text;
。在SpeedInfo
元素中,有两个子元素SpeedInfo
和Bandwidth
。
这是我在SoapUI中的请求:
AccessSpeed
我的Java条件:
<sch:SpeedInfo>
<ns:Bandwidth xmlns:ns="http://lpp.att.com/logical/classofservice/schema/v1">4000000</ns:Bandwidth>
<ns:AccessSpeed xmlns:ns="http://lpp.att.com/logical/classofservice/schema/v1">4000000</ns:AccessSpeed>
</sch:SpeedInfo>
我需要我的条件来检查3种情况:
if (request.getSpeedInfo() == null || (request.getSpeedInfo() == null && request.getSpeedInfo().getBandwidth() == null)){
throw new Exception(" SpeedInfo Bandwidth must be passed in the request ");
}
错误我得到了:
1. if <speedInfo> itself is not present
2. <sch:SpeedInfo> is present, but bandwidth not present:
<sch:SpeedInfo>
<ns:AccessSpeed xmlns:ns="http://lpp.att.com/logical/classofservice/schema/v1">40000000</ns:AccessSpeed>
</sch:SpeedInfo>
3. Bandwidth is present but no value
<sch:SpeedInfo>
<ns:Bandwidth xmlns:ns="http://lpp.att.com/logical/classofservice/schema/v1"></ns:Bandwidth>
<ns:AccessSpeed xmlns:ns="http://lpp.att.com/logical/classofservice/schema/v1">40000000</ns:AccessSpeed>
</sch:SpeedInfo>
答案 0 :(得分:4)
CurrentCellChanged
对if (request.getSpeedInfo() == null || (request.getSpeedInfo() == null && request.getSpeedInfo().getBandwidth() == null)){
getSpeedInfo()
进行两次测试是毫无意义的。当然这很明显?而且,这并不能测试单独null
为空的情况。
根据您的要求:
- 如果
醇>getBandwidth()
本身不存在
<speedInfo>
- 醇>
request.getSpeedInfo() == null
存在,但带宽不存在:
<sch:SpeedInfo>
- 带宽已存在,但没有值
醇>
|| request.getSpeedInfo().getBandwidth() == null
全部放在一起:
|| request.getSpeedInfo().getBandwidth().isEmpty() // or whatever API call is appropriate to the datatype
答案 1 :(得分:0)
var newActiveCell = table.rows[activeRowIndex].cells[activeColumnIndex].focus();
activeCell = document.activeElement;
console.log(activeCell);