Client Soap1.2 CXF

	<bean id="clientOtrasConsultasFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
		<property name="serviceClass" value="es.depontevedra.soap.cargows.services.OtrasConsultas" />
		<property name="address" value="#{url}otrasconsultasws" />
		<property name="bindingId" value="http://www.w3.org/2003/05/soap/bindings/HTTP/" />
	</bean>
	<bean id="clientOtrasConsultas" 
		class="es.depontevedra.soap.cargows.services.OtrasConsultas"
		factory-bean="clientOtrasConsultasFactory" factory-method="create" />
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:jaxws="http://cxf.apache.org/jaxws" 
	xmlns:soap="http://cxf.apache.org/bindings/soap" 
	xsi:schemaLocation="
	http://www.springframework.org/schema/beans 
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	http://cxf.apache.org/jaxws 
	http://cxf.apache.org/schemas/jaxws.xsd
	http://cxf.apache.org/bindings/soap
	http://cxf.apache.org/schemas/configuration/soap.xsd">

	<jaxws:client id="clientVR" address="http:/host:port/realizarVerificacion" 
		serviceClass="es.una.ruta.a.una.Interfaz"
		serviceName="VerificacionResidenciaFecha" >
		<jaxws:binding>
			<soap:soapBinding version="1.2"/>
		</jaxws:binding> 
	</jaxws:client>
Anuncios
Client Soap1.2 CXF

Cliente Socket Web Service

No es lo mas recomendable ni lo mas refactorizable, escalable, etc. Pero quiza si es lo mas rapido.

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.Socket;
import javax.net.ssl.SSLSocketFactory;
import sun.misc.BASE64Encoder;

public class SendSMS_Soap {

	public static void main(String[] args) { 
		try { 
			String driver = "DRIVER-DATA; 
			String number = "NUMER-DATA"; 
			String login = "USER:PASS"; 
			String aut = (new BASE64Encoder().encodeBuffer(login.getBytes())).trim(); 

			String mensaje = "Probando envio de SMS con SOAP.."; 

			// ******************* Construimos el XML ******************* 
			String xmldata = //"<?xml version="1.0" encoding="UTF-8"?>"+ 
					"<soap:Envelope " +
					"xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" " + 
					// "xmlns:xsd="http://www.w3.org/2001/XMLSchema"  " +
					// "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"" +
					">"+ 
			"<soap:Body>"+ 
			"<ns2:OPERACION xmlns:ns2="http://www.dominio.es/ruta/schemas">"+ 
			"<Version>1.0</Version>"+ 
			"<Authorization>"+aut+"</Authorization>"+ 
			"<Sender>"+driver+"</Sender>"+ 
			"<Recipients>" + 
			"<To>"+number+"</To>" + 
			"</Recipients>"+ 
			"<SMSText>"+mensaje+"</SMSText>"+ 
			"</ns2:OPERACION>"+ 
			"</soap:Body>"+ 
			"</soap:Envelope>"; 

			System.out.println("Mensaje a enviar: " + xmldata);
			// ******************* Creamos el Socket ******************* 
		
			System.setProperty("javax.net.ssl.trustStore", "trustStore.jks");
			SSLSocketFactory ssf = (SSLSocketFactory) SSLSocketFactory.getDefault();
		    Socket s = ssf.createSocket(SERVIDOR, PUERTO);
		    OutputStream outs = s.getOutputStream();
		    InputStream ins = s.getInputStream();

			// ******************* Enviamos la cabecera ******************* 
			BufferedWriter wr = new BufferedWriter(new 
					OutputStreamWriter(outs,"UTF-8")); 

			wr.write("POST /RUTA HTTP/1.1rn"); 
			wr.write("Content-Type: text/xml; charset=utf-8rn"); 
			wr.write("Accept: */*rn"); 
			//wr.write("Authorization: Basic "+aut+"rn"); 
			wr.write("User-Agent: Java/1.7rn"); 
			wr.write("Host: https://SERVIDOR:PUERTO/RUTA" + "rn"); 
			wr.write("Cache-Control: no-cachern"); 
			wr.write("Pragma: no-cachern"); 
			wr.write("SOAPAction: ''rn"); 
			wr.write("Connection: keep-alivern"); 
			wr.write("Content-Length: " + xmldata.length() + "rn"); 
			wr.write("rn"); 

			// ******************* Enviamos el XML ******************* 
			wr.write(xmldata); 
			wr.flush(); 
			
			// ******************* Esperamos respuesta y la sacamos por pantalla ******************* 
			BufferedReader rd = new BufferedReader(new InputStreamReader(ins)); 
			String line; 
			while((line = rd.readLine()) != null){
				System.out.println(line); 
			}

		} catch (Exception e) { 
			System.err.println(e.getMessage()); 
		} 
	}
	
}
Cliente Socket Web Service