Netbeans 当webservice中操作的返回类型为STRING[]时,从webservice获取属性到servlet时出现问题
我做了一个返回类型为STRING[]的Webservice操作 下面是代码Netbeans 当webservice中操作的返回类型为STRING[]时,从webservice获取属性到servlet时出现问题,netbeans,web-services,netbeans6.7,Netbeans,Web Services,Netbeans6.7,我做了一个返回类型为STRING[]的Webservice操作 下面是代码 @WebMethod(operationName = "authorize") public String [] authorize(@WebParam(name = "Username") String Username) { CAuthorization CA = new CAuthorization(); String [] Result= null; try { Re
@WebMethod(operationName = "authorize")
public String [] authorize(@WebParam(name = "Username")
String Username) {
CAuthorization CA = new CAuthorization();
String [] Result= null;
try {
Result = CA.CheckAuthorization(Username);
} catch (SQLException ex) {
Logger.getLogger(WS_Authentication.class.getName()).log(Level.SEVERE, null, ex);
}
**return Result;**
}
然后我做了一个Servlet
servlet的代码是:
try { // Call Web Service Operation
java.lang.String result = null;
result = port.authorize(Username);
out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
问题是在我的返回语句中的WEbservice代码中,我有任何表的属性
我想将这些属性带到servlet,以便在前端看到它们
但我在这里得到的只是最后一个属性
谢谢 这是处理字符串返回类型的Webservice操作的方法
@WebMethod(operationName = "authorize")
public String authorize(@WebParam(name = "Username")
String Username) {
CAuthorization CA = new CAuthorization();
StringBuffer result = new StringBuffer();
try {
if (CA.CheckAuthorization(Username).length > 0) {
result.append(CA.CheckAuthorization(Username)[0]);
for (int i = 1; i < CA.CheckAuthorization(Username).length; i++) {
result.append(",");
result.append(CA.CheckAuthorization(Username)[i]);
}
}
} catch (SQLException ex) {
Logger.getLogger(WS_Authentication.class.getName()).log(Level.SEVERE, null, ex);
}
//TODO write your implementation code here:
return result.toString();
}
@WebMethod(operationName=“authorize”)
公共字符串授权(@webgram(name=“Username”)
字符串(用户名){
烧灼CA=新烧灼();
StringBuffer结果=新的StringBuffer();
试一试{
如果(CA.CheckAuthorization(Username).length>0){
result.append(CA.CheckAuthorization(Username)[0]);
for(int i=1;i
}请修正问题中的标记。不要在你的单词中使用大写字母。这里没有人(神智正常的人)喜欢被人骂。