张晨的个人博客

android使用ksoap2访问JAX-WS注解webservice服务取不到值 警告:Received WS-I BP non-conformant Unquoted SoapAction

张晨的个人博客2015-04-08安卓技术 6237 0A+A-

服务器使用JAX-WSZ注解方式发布webservice服务,方法录下:


@WebMethod
public String login(@WebParam(name = "userName") String userName,@WebParam(name = "password") String password){
	/*
	 * 处理逻辑
	 */
	return "";
}


方法

android客户端使用KSOAP2方式访问此webservice,请求可以得到相应,但是服务器后台发生警告信息,并且获取到的参数值为NULL

警告: Received WS-I BP non-conformant Unquoted SoapAction HTTP header: http://webservice.cxy/login


解决办法:

在方法注解@WebParam设置中添加targetNamespace设置即可解决问题,如:

@WebMethod
public String login(@WebParam(name = "userName",targetNamespace="http://webservice.cxy/") String userName,@WebParam(name = "password",targetNamespace="http://webservice.cxy/") String password){
	/*
	 * 处理逻辑
	 */
	return "";
}


然后就可以解决问题了,如果还是不行请查看webservice类声明中@SOAPBinding的设置,因为使用的是soap请求,如果有设置style属性,则需要确认@SOAPBinding(style=SOAPBinding.Style.DOCUMENT)


发表评论