0

私は、websphere 7 と jaxws を使用して Web サービスに取り組んできました。したがって、私のWebサービスが文字列、整数、およびintまたはfloatを返す場合。デプロイすると、Websphere は Web サービスを認識しますが、Web サービスを Java Bean を返すように変更すると、私の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;
    }

}

現在の動作方法ですが、インターフェイス、実装、および応答を変更すると、文字列ではなく Java Bean が返されます。websphere は私の Web サービスを認識しないため、wsdl を表示または生成しません。

なぜこれが起こるのか知っている人はいますか??

前もって感謝します。

4

1 に答える 1

0

Web サービスまたはサービス定義に問題がある場合、WebSphere はアプリケーションの起動時にエラーをスローします。通常、あなたはあなたの中にそれを見つけることができますSystemOut.log.

String バージョンを実行すると、サービスが同じ場所で正常に開始されたというログが見つかるはずです。

于 2013-03-27T18:46:37.640 に答える