我有以下登录服务界面:
@Path("/loginService/")
@WebService(serviceName = "LoginService", name = "LoginService", targetNamespace = "http://ws.test.com")
public interface LoginService {
/**
* Takes an authentication request, and returns an authentication response.
* In the event of an authentication failure, an HTTP status of 401 should
* be returned.
*
* @param request
* @return
*/
@WebMethod
@GET
@Path("/")
public AuthenticationResponse login(@WebParam(name = "request") final AuthenticationRequest request);
}
我的春季档案中有以下内容
<bean id="loginService" autowire="autodetect"
class="com.test.mobile.webservices.authentication.LoginServiceImpl">
</bean>
<jaxws:endpoint id="LoginServiceEndpoint"
serviceName="LoginService"
implementorClass="com.test.mobile.webservices.authentication.LoginService"
implementor="#loginService"
address="/loginService">
<jaxws:serviceFactory>
<ref bean="jaxws-and-aegis-service-factory"/>
</jaxws:serviceFactory>
</jaxws:endpoint>
当我尝试点击以下网址时:
http://localhost:8080/TPCMobileWS/api/rest/loginService?wsdl
我收到以下消息:
发生JAXBException:在[row,col。的prolog中意外的EOF {unknown-source}]:[1,0]。意外的EOF在prolog的[row,col {unknown-source}]:[1,0]。
如果我在登录方法中完全删除了“request”参数,那么上面的URL就可以了......没有错误,显示正确的数据。
传递POJO时我做错了什么?它只有几个原始类型,包括getter和setter。我错过了一些注释吗?
非常感谢您的帮助!
以下是身份验证请求:
package com.test.mobile.webservices.authentication;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import com.test.mobile.webservices.Localization;
@XmlRootElement
public class AuthenticationRequest implements Serializable {
private static final long serialVersionUID = 1L;
private String username;
private Localization.Country country;
private String password;
public AuthenticationRequest() {
}
/**
* For now, this is the consultant's ID.
*
* @return
*/
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
/**
* The country that the consultant is associated with, as a two letter ISO
* country code.
*
* @return
*/
public Localization.Country getCountryCode() {
return country;
}
public void setCountryCode(Localization.Country country) {
this.country = country;
}
/**
* The consultant's password.
*
* @return
*/
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}