Injetando @WebServiceClient via Spring

Estou tentando injetar um @WebServiceClient via Spring (no JBoss 4.2.3 > JBossWs 3.0.3 / stack Native). Por quê?

Bem, este WebService é do tipo complexo, pois possui dois bindings e esta classe me retorna ou um binding SOAP 1.1 ou um SOAP 1.2. Coisas do cliente.

Injetando diretamente o Spring não consegue, pois o org.apache.cxf.jaxws.JaxWsProxyFactoryBean só consegue injetar interfaces.

Se for direto, injetar usando o que importei via wsimport, não funciona também, claro. Pois ele não tem referência à interface do Servidor.

javax.xml.ws.soap.SOAPFaultException: Server was unable to process request. —> Object reference not set to an instance of an object.

Portanto preciso injetar este, recuperado runtime, para pode ter acesso ao Web Service proxy.

Obrigado!

Classes Geradas:

WebService Client

@WebServiceClient(name = "ServicoWs", targetNamespace = "http://algo.org/", wsdlLocation = "http://www.algo.com.br/ws/ServicoWs.asmx?wsdl")
public class ServicoWs
    extends Service
{

    private final static URL SERVICO_WSDL_LOCATION;

    static {
        URL url = null;
        try {
            url = new URL("http://www.algo.com.com.br/wsmetro/WsServicoWs.asmx?wsdl");
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
        SERVICO_WSDL_LOCATION = url;
    }

    public ServicoWs(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public ServicoWs() {
        super(SERVICO_WSDL_LOCATION, new QName("http://algo.org/", "ServicoWs"));
    }

    /**
     * 
     * @return
     *     returns ServicoWsSoap
     */
    @WebEndpoint(name = "ServicoWsSoap")
    public ServicoWsSoap getServicoWs() {
        return (ServicoWsSoap)super.getPort(new QName("http://algo.org/", "ServicoWsSoap"), ServicoWsSoap.class);
    }

    /**
     *      * @return
     *     returns ServicoWsSoap
     */
    @WebEndpoint(name = "ServicoWsSoap12")
    public ServicoWsSoap getServicoWs12() {
        return (ServicoWsSoap)super.getPort(new QName("http://algo.org/", "ServicoWsSoap12"), ServicoWsSoap.class);
    }

}

Web Service

@WebService(name = "ServicoWsSoap", targetNamespace = "http://algo.org/")
public interface ServicoWsSoap {


    /**
     * Insert Order 
     * 
     * @param pedido
     * @return
     *     returns _177._0._16._172._9190.RETPEDIDO
     */
    @WebMethod(operationName = "InsertOrder", action = "http://algo.org/InsertOrder")
    @WebResult(name = "InsertOrderResult", targetNamespace = "http://algo.org/")
    @RequestWrapper(localName = "InsertOrder", targetNamespace = "http://algo.org/", className = "org.algo.InsertOrder")
    @ResponseWrapper(localName = "InsertOrderResponse", targetNamespace = "http://algo.org/", className = "org.algo.InsertOrderResponse")
    public RETPEDIDO insertOrder(
        @WebParam(name = "_pedido", targetNamespace = "http://algo.org/")
        PedidoItens pedido);

    /**
     * Insert Order Purchase 
     * 
     * @param pedidoCompra
     * @return
     *     returns java.lang.String
     */
    @WebMethod(operationName = "InsertPurchase", action = "http://algo.org/InsertPurchase")
    @WebResult(name = "InsertPurchaseResult", targetNamespace = "http://algo.org/")
    @RequestWrapper(localName = "InsertPurchase", targetNamespace = "http://algo.org/", className = "org.algo.InsertPurchase")
    @ResponseWrapper(localName = "InsertPurchaseResponse", targetNamespace = "http://algo.org/", className = "org.algo.InsertPurchaseResponse")
    public String insertPurchase(
        @WebParam(name = "_pedidoCompra", targetNamespace = "http://algo.org/")
        PedidoCompra pedidoCompra);

}

Achei em um fórum que tenho que retirar as bibliotecas padrão jboss-jaxws e jboss-jaxws-ext da lib endorsed do JBoss. Ela conflita com as do CFX que acredito que estão sendo utilizadas pelo JBoss (embora tenha lido que o padrão do JBoss é usar o stack Native). Será que ele usa o CFX por baixo dos panos? Não sei… Quem puder nos esclarecer, gracias!

Ih, Consumiu! :smiley: