Webservices jax-ws

Olá a todos.

Estou com a seguinte duvida.

Contrui um webservice cliente - servidor , no lado do servidor tenho um metodo que gostava de devolve-se para o cliente uma LIST e que o cliente a recebe-se mas isso não acontece, apesar de ter também a classe ASILinhaPO do lado do servidor, eles não reconhece. Mas se colocar no metodo de retorno uma String o cliente recebe a mesma sem problema algum.

Como resolver este problema?

Posso passar um objecto do tipo LIST para o cliente, ou terei de utilizar outra solução.

Servidor


import java.util.ArrayList;
import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;


@WebService()
public class ANACORPORATIVO {

    /**
     * Web service operation
     */

    @WebMethod(operationName = "createPO")
    public  List  createPO(@WebParam(name = "CENTRO")
    String CENTRO, @WebParam(name = "REQUISITANTE")
    String REQUISITANTE, @WebParam(name = "DATA")
    String DATA, @WebParam(name = "NUMMAXIMO")
    String NUMMAXIMO, @WebParam(name = "LINHAMAXIMO")
    String LINHAMAXIMO, @WebParam(name = "DEPOSITO")
    String DEPOSITO, @WebParam(name = "CODMAT")
    String CODMAT, @WebParam(name = "QUANT")
    String QUANT, @WebParam(name = "UNID")
    String UNID, @WebParam(name = "CCUSTO")
    String CCUSTO, @WebParam(name = "ORDINT")
    String ORDINT, @WebParam(name = "FORNECEDOR")
    String FORNECEDOR, @WebParam(name = "OBS")
    String OBS, @WebParam(name = "DTPREV")
    String DTPREV) {

       ArrayList <ASILinhaPO> linhasPO = new ArrayList ();

        ASILinhaPO linhaPO = new ASILinhaPO ("a1", "a2", "a3",
			"a4", "a5", "a6",
			"a7", "a8", "a9", "a10",
			"a11", "a12","a13", "a14");

        linhasPO.add(linhaPO);

      return  linhasPO;
       

    }

}

Cliente


public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here


        try { // Call Web Service Operation
            asi.ana.corporativo.ANACORPORATIVOService service = new asi.ana.corporativo.ANACORPORATIVOService();
            asi.ana.corporativo.ANACORPORATIVO port = service.getANACORPORATIVOPort();
            // TODO initialize WS operation arguments here
            java.lang.String centro = "";
            java.lang.String requisitante = "";
            java.lang.String data = "";
            java.lang.String nummaximo = "";
            java.lang.String linhamaximo = "";
            java.lang.String deposito = "";
            java.lang.String codmat = "";
            java.lang.String quant = "";
            java.lang.String unid = "";
            java.lang.String ccusto = "";
            java.lang.String ordint = "";
            java.lang.String fornecedor = "";
            java.lang.String obs = "";
            java.lang.String dtprev = "";


            java.util.List result = port.createPO(centro, requisitante, data, nummaximo, linhamaximo, deposito, codmat, quant, unid, ccusto, ordint, fornecedor, obs, dtprev);
          
  System.out.println("Result = "+result);


        } catch (Exception ex) {
            // TODO handle custom exceptions here
        }


    }

}

Classe ASILinhaPO



public class ASILinhaPO {

	private String siteID;

	private String requisitante;

	private String dataPedido;

	private String ponum;

	private String polinenum;

	private String codMaterial;

	private String quantidade;

	private String unidade;

	private String ccusto;

	private String ordint;

	private String fornecedor;

	private String obs;

	private String dataEntregaReq;
	
	private String storeloc; 

	public ASILinhaPO(String siteID, String requisitante, String dataPedido,
			String ponum, String polinenum, String codMaterial,
			String quantidade, String unidade, String ccusto, String ordint,
			String fornecedor, String obs, String dataEntregaReq, String storeloc) {

		this.siteID = siteID;
		this.requisitante = requisitante;
		this.dataPedido = dataPedido;
		this.ponum = ponum;
		this.polinenum = polinenum;
		this.codMaterial = codMaterial;
		this.quantidade = quantidade;
		this.unidade = unidade;
		this.ccusto = ccusto;
		this.ordint = ordint;
		this.fornecedor = fornecedor;
		this.obs = obs;
		this.dataEntregaReq = dataEntregaReq;
		this.storeloc=storeloc;
	}

	/**
	 * @return the ccusto
	 */
	public String getCcusto() {
		return ccusto;
	}

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

	/**
	 * @return the codMaterial
	 */
	public String getCodMaterial() {
		return codMaterial;
	}

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

	/**
	 * @return the dataEntregaReq
	 */
	public String getDataEntregaReq() {
		return dataEntregaReq;
	}

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

	/**
	 * @return the dataPedido
	 */
	public String getDataPedido() {
		return dataPedido;
	}

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

	/**
	 * @return the fornecedor
	 */
	public String getFornecedor() {
		return fornecedor;
	}

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

	/**
	 * @return the obs
	 */
	public String getObs() {
		return obs;
	}

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

	/**
	 * @return the ordint
	 */
	public String getOrdint() {
		return ordint;
	}

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

	/**
	 * @return the polinenum
	 */
	public String getPolinenum() {
		return polinenum;
	}

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

	/**
	 * @return the ponum
	 */
	public String getPonum() {
		return ponum;
	}

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

	/**
	 * @return the quantidade
	 */
	public String getQuantidade() {
		return quantidade;
	}

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

	/**
	 * @return the requisitante
	 */
	public String getRequisitante() {
		return requisitante;
	}

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

	/**
	 * @return the siteID
	 */
	public String getSiteID() {
		return siteID;
	}

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

	/**
	 * @return the unidade
	 */
	public String getUnidade() {
		return unidade;
	}

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

	/**
	 * @return the storeloc
	 */
	public String getStoreloc() {
		return storeloc;
	}

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

Obrigado

Pode sim!!!

A classe ASILinhaPO tem que ter um contrutor publico e sem argumentos.
Provavelmente colocando esse construtor vai funcionar.

qualquer coisa, só falar.

abs

Repare que seu método createPO não delimita o tipo do retorno (retorno não é genérico).

Além do mais, seria interessante se você usasse, também , @WebResult no retorno do método.

[]´s

@WebResult e @WebParam são opcionais, acho que o problema dele é que não tem um construtor publico sem parametros na classe ASILinhaPO, com isso o Jaxb não consegue montar um WSDL.

abs

[quote=mcbarsotti]@WebResult e @WebParam são opcionais, acho que o problema dele é que não tem um construtor publico sem parametros na classe ASILinhaPO, com isso o Jaxb não consegue montar um WSDL.

abs[/quote]

Sim, isso também… estava só complementando.

[]´s