Java 为什么不是´;我无法识别我的Web服务

Java 为什么不是´;我无法识别我的Web服务,java,web-services,jax-ws,websphere-7,Java,Web Services,Jax Ws,Websphere 7,我一直在使用WebSphere7和jaxws开发Web服务。 因此,如果我的Web服务返回字符串、整数、int或浮点。当我部署它时,websphere会识别我的Web服务,但如果我更改Web服务以返回JavaBean;它无法识别我的Web服务 这是我的密码。 界面: import javax.jws.WebMethod; import javax.jws.WebService; @WebService public interface MensajeSMS { @WebMethod

我一直在使用WebSphere7和jaxws开发Web服务。 因此,如果我的Web服务返回字符串、整数、int或浮点。当我部署它时,websphere会识别我的Web服务,但如果我更改Web服务以返回JavaBean;它无法识别我的Web服务

这是我的密码。 界面:

import javax.jws.WebMethod;
import javax.jws.WebService;

@WebService
public interface MensajeSMS {
    @WebMethod
    String sendMessage(Long idUsuario, String token, Integer idServicio,
            String mensaje, String contacto, String idMensaje);
}
实施:

import javax.jws.WebService;

@WebService(endpointInterface = "bisnet.sms.MensajeSMS")
public class MensajeSMSImpl implements MensajeSMS {

    @Override
    public String sendMessage(Long idUsuario, String token, Integer idServicio,
            String mensaje, String contacto, String idMensaje) {
        return "Hola " + idUsuario +" "+ "tu token con Bisnet Corporativo será: " + token
                +". El número telefónico que registraste es: " + idServicio
                + " y tu nombre es: " +mensaje +" " +contacto+ " " +idMensaje ;
    }

}
我的请求:

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement(name = "sendMessage", namespace = "http://sms.bisnet/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sendMessage", namespace = "http://sms.bisnet/")
public class SendMessage {

    @XmlElement(name = "arg0", namespace = "")
    private Long idUsuario;

    @XmlElement(name = "arg1", namespace = "")
    private String token;

    @XmlElement(name = "arg2", namespace = "")
    private Integer idServicio;

    @XmlElement(name = "arg3", namespace = "")
    private String mensaje;

    @XmlElement(name = "arg4", namespace = "")
    private String contacto;

    @XmlElement(name = "arg5", namespace = "")
    private String idMensaje;

    /**
     * @return the idUsuario
     */
    public Long getIdUsuario() {
        return idUsuario;
    }

    /**
     * @param idUsuario the idUsuario to set
     */
    public void setIdUsuario(Long idUsuario) {
        this.idUsuario = idUsuario;
    }

    /**
     * @return the token
     */
    public String getToken() {
        return token;
    }

    /**
     * @param token the token to set
     */
    public void setToken(String token) {
        this.token = token;
    }

    /**
     * @return the idServicio
     */
    public Integer getIdServicio() {
        return idServicio;
    }

    /**
     * @param idServicio the idServicio to set
     */
    public void setIdServicio(Integer idServicio) {
        this.idServicio = idServicio;
    }

    /**
     * @return the mensaje
     */
    public String getMensaje() {
        return mensaje;
    }

    /**
     * @param mensaje the mensaje to set
     */
    public void setMensaje(String mensaje) {
        this.mensaje = mensaje;
    }

    /**
     * @return the contacto
     */
    public String getContacto() {
        return contacto;
    }

    /**
     * @param contacto the contacto to set
     */
    public void setContacto(String contacto) {
        this.contacto = contacto;
    }

    /**
     * @return the idMensaje
     */
    public String getIdMensaje() {
        return idMensaje;
    }

    /**
     * @param idMensaje the idMensaje to set
     */
    public void setIdMensaje(String idMensaje) {
        this.idMensaje = idMensaje;
    }

}
最后,我的回答是:

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

@XmlRootElement(name = "sendMessageResponse", namespace = "http://sms.bisnet/")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "sendMessageResponse", namespace = "http://sms.bisnet/")
public class SendMessageResponse {

    @XmlElement(name = "return", namespace = "")
    private String _return;

    /**
     *
     * @return
     *     returns String
     */
    public String getReturn() {
        return this._return;
    }

    /**
     *
     * @param _return
     *     the value for the _return property
     */
    public void setReturn(String _return) {
        this._return = _return;
    }

}
它现在的工作方式,但是如果我更改接口、实现和响应,使它们返回一个JavaBean而不是字符串;websphere不识别我的Web服务,因此它不显示或生成wsdl

有人知道为什么会这样吗


提前感谢。

如果您的Web服务或服务定义有问题,WebSphere将在应用程序启动期间抛出错误。通常您可以在
SystemOut.log
中找到它


如果运行字符串版本,您应该会找到一个日志,表明服务已在同一地点成功启动。

JAX-WS运行时是否可以从新的bean定义生成WSDL(您可以在控制台输出中看到这一点)?共享库中的bean定义(Java类)在哪里?如果使用XML简单类型,则不需要JAXB注释。如果部署它并尝试在我的navigator中打开wsdl,那么如果我的Web服务返回一个对象,则不会显示该wsdl。此外,我还需要jax注释,以便可以在客户端进行编组和解编。对象类在哪里?罐子里有吗?在共享库中?在同一个包中,比如服务接口和实现?