Soap + JbossPortal + WebService

3 respostas
victormenegusso

Olá, eu tenho um WebService rodando no Jboss Portal, e mandamos msg Soap via um programa em QT, agora tenho que montar a comunicação via java e estou com duvidas de como faço para mandar executar algum metodo que esta no meu WebService
Eu acredito que consegui fazer a comunicação assim…

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;


public class Soap {
	public Soap() throws UnsupportedOperationException, SOAPException, MalformedURLException{
		MessageFactory factory = MessageFactory.newInstance();
		SOAPMessage message = factory.createMessage();
		
		
		SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
		SOAPConnection connection = soapConnectionFactory.createConnection();
		//Sending a Message
		java.net.URL endpoint = new URL("http://xxx.xxx.x.xxx/webservice_a/AWS");
		SOAPMessage response = connection.call(message, endpoint);
		
		connection.close();
		System.out.print("teste");
		//
		
	}
}

3 Respostas

victormenegusso

No QT eu tenho um metodo assim

void soapmessage::reqNumAcessos(QString *nome) { QtSoapMessage request; QtSoapQName n("executeNAcessos", this->sNamespace); request.setMethod(n); request.addMethodArgument("message", "", *nome); http.setAction(this->sNamespace + tr("/executeNAcessos")); http.submitRequest(request, "/webservice_al/AWS"); }

victormenegusso

ninguém ?

victormenegusso
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Iterator;

import javax.xml.namespace.QName;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPElement;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;


public class Soap {
	public Soap() throws UnsupportedOperationException, SOAPException, MalformedURLException{
		
		
		SOAPConnectionFactory soapConnectionFactory =
	        SOAPConnectionFactory.newInstance();
	      SOAPConnection connection =
	        soapConnectionFactory.createConnection();

	      MessageFactory factory =
	        MessageFactory.newInstance();
	      SOAPMessage message = factory.createMessage();

	      SOAPHeader header = message.getSOAPHeader();
	      SOAPBody body = message.getSOAPBody();
	      header.detachNode();

	      QName bodyName = new QName("http://192.168.1.180",
	        "executeNAcessos", "m");
	      SOAPBodyElement bodyElement =
	        body.addBodyElement(bodyName);

	      QName name = new QName("message");
	      SOAPElement symbol = 
	        bodyElement.addChildElement(name);
	      symbol.addTextNode("");

	     
	      
	      URL endpoint = new URL
	        ("http://192.168.1.180/webservice_a/AWS");
	      SOAPMessage response = 
	        connection.call(message, endpoint);
	      
	      System.out.println(response.toString());
	  
	      
	      
	      connection.close();

	      SOAPBody soapBody = response.getSOAPBody();
	      System.out.println(soapBody);



	}
}

minha resposta eh [env:Body: null]

Criado 20 de julho de 2010
Ultima resposta 20 de jul. de 2010
Respostas 3
Participantes 1