%@page import="com.blogspot.diegopacheco.soap.core.SOAP12WsBokerService" %>
<%@page import="java.util.*" %>
<%@page import="java.net.*" %>
<%@page import="javax.xml.soap.*" %>
<%@page import="javax.xml.transform.*" %>
<%@page import="javax.xml.namespace.*" %>
<%@page import="javax.xml.transform.stream.*" %>
soap12-oas-dotnet:Teste de acesso a WS feito em aspx sendo comsumido
com soap 1.2 em Java.
<%
SOAP12WsBokerService swbs = new SOAP12WsBokerService();
SOAPMessage sm = swbs.createDefaultMessage();
QName operation = new QName("cer:Listar_Acordos");
sm.getSOAPBody().addBodyElement(operation);
sm.saveChanges();
SOAPMessage result = swbs.send(sm);
// Mostra o retorno no console ...
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();
Source sc = result.getSOAPPart().getContent();
StreamResult streamResult = new StreamResult(System.out);
tf.transform(sc, streamResult);
out.println();
// Percore o resultado...
out.println("Lista de Acordos:
");
Iterator ise = swbs.getResponseIterator(result);
while(ise.hasNext()){
SOAPElement table = ise.next();
SOAPElement codigo = (SOAPElement)table.getChildElements().next();
SOAPElement desc = (SOAPElement)table.getLastChild();
out.println("Código: " + codigo.getValue());
out.println("
Descricao: " + desc.getValue());
out.println("--
");
}
%>