Olá
tenho um web service dummie e queria saber se existe alguma forma de exportar em java a saída Soap (xml) do meu web service quando o método é
invocado.
Exemplo:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:calcularSalarioResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:TesteFabioWs">
<calcularSalarioReturn href="#id0"/>
</ns1:calcularSalarioResponse>
<multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:double" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">900.0</multiRef>
</soapenv:Body>
</soapenv:Envelope>
Queria pegar esse SOAP e exportar em java, o que eu coloquei acima gerei pelo SOAPUI. Queria fazer isso em java quando chamo o web service:
try {
//recupera a URL do Serviço
String url = "http://localhost:8080/implantacao-core/services/TesteFabioWs.wsdl";
// Locator é a classe que localiza o serviço...
// Nela, se vc procurar, vai achar a URL de chamada do Web Service
TesteWebServiceServiceLocator locator = new TesteWebServiceServiceLocator();
// Interface que define o Web Service - "Contrato do Web Service"
TesteWebService teste = locator.getTesteWebService((new java.net.URL(url)));
// Crio o stub através do servico definido acima
TesteWebServiceSoapBindingStub stub = (TesteWebServiceSoapBindingStub) teste;
//chamo o webservice
int resultado = stub.somaValores(a, b);
} catch (java.lang.Exception e) {
log.error(e.getMessage());
throw new ExecuteException(e.getMessage(),e);
}
Queria pegar o valor retornado pra variavel resultado, tipo no formato SOAP como mostrado acima gerado pelo SOAPUI.
Isso é possivel?
Obrigado!