2013-03-26 1 views
0

websphere 7 및 jaxws를 사용하여 webservice를 작성했습니다. 그래서 내 webservice가 문자열과 Integer, int 또는 float을 반환하면. 배포 할 때 websphere가 내 webservice를 인식하지만 Java bean을 반환하도록 내 webservice를 변경하면; 그것은 내 웹 서비스를 인식하지 못합니다.websphere가 내 웹 서비스를 인식하지 못하는 이유

여기 내 코드입니다. 인터페이스 :

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 = "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; 
    } 

} 

방법을 키우면 :

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; 
    } 

} 

그리고 마지막으로 내 대답 작동하지만, 인터페이스, 구현 및 응답을 변경하여 문자열 대신 java bean을 반환하면; websphere는 내 webservice를 인식하지 못하므로 wsdl을 표시하거나 생성하지 않습니다.

누구에게 이런 일이 발생하는지 알고 있습니까?

미리 감사드립니다.

+0

JAX-WS 런타임은 새 빈 정의에서 WSDL을 생성 할 수 있습니까? (콘솔 출력에서 ​​볼 수 있습니다)? 공유 라이브러리에서 bean 정의 (Java 클래스)는 어디에 있습니까? XML 단순 유형을 사용하는 경우 JAXB 어노테이션은 필요하지 않습니다. –

+0

배포하고 내 탐색기에서 wsdl을 열려고하면 내 webservice가 객체를 반환하면 나타나지 않습니다. – linker85

+0

또한 클라이언트 쪽에서 마샬링 및 언 마샬링을 수행 할 수 있도록 jax 주석이 필요합니다. – linker85

답변

0

웹 서비스 또는 서비스 정의에 문제가있는 경우 WebSphere는 응용 프로그램 시작 중에 오류를 발생시킵니다. 보통 SystemOut.log에서 찾을 수 있습니다.

String 버전을 실행하면 서비스가 동일한 지점에서 성공적으로 시작된 로그를 찾아야합니다.