I am trying to call a Soap Webservice from my Java application as follows:
public String getLoginServiciosGeneral() throws Exception { String idSesion = ""; try{ ProxySelector.setDefault(new MyProxySelector()); //LoginServiciosGeneralService service = new LoginServiciosGeneralService(new URL("https://XXXXXX.es/services/ws/LoginServiciosGeneral?wsdl")); LoginServiciosGeneralService service = new LoginServiciosGeneralService(); LoginServiciosGeneralPortType port = service.getLoginServiciosGeneral(); System.out.println("vamos a ver si hemos llegado hasta aqui"); System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); System.setProperty("sun.net.client.defaultReadTimeout", "30000"); String xmlRespuesta = port.loginServiciosGeneral(construirCData()); idSesion = recupearIdSesionFromXML(xmlRespuesta); System.out.println("hasta aca"); } catch (Exception e) { log.error("Exception. Problemas en la llamada al servicio loginServiciosGeneral, motivo: " + e.getMessage()); e.printStackTrace(); } return idSesion; }
Where MyProxySelector is
public class MyProxySelector extends ProxySelector { @Override public List<Proxy> select(URI uri) { // TODO Apéndice de método generado automáticamente System.out.println("Conectarse a " + uri.toString()); //Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("XXXX.es", 443)); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("http://proxy.XXXX.es", 8080)); ArrayList<Proxy> listProxy = new ArrayList<Proxy>(); listProxy.add(proxy); return listProxy; } @Override public void connectFailed(URI uri, SocketAddress sa, IOException ioe) { // TODO Apéndice de método generado automáticamente System.err.println("Fallo en conectarse a " + uri.toString()); System.err.println("Motivo: " + ioe.getMessage()); }}
When executing on the line String xmlRespuesta = port.loginServiciosGeneral(construirCData() the following error occurs:
[27/03/24 10:08:34:170 CET] 000000c8 SystemErr Rjavax.xml.ws.soap.SOAPFaultException: java.net.ConnectException:Connection timed out: no further information [27/03/24 10:08:34:172CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.createSystemException(MethodMarshallerUtils.java:1363)[27/03/24 10:08:34:174 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils.demarshalFaultResponse(MethodMarshallerUtils.java:1089)[27/03/24 10:08:34:175 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.marshaller.impl.alt.DocLitBareMethodMarshaller.demarshalFaultResponse(DocLitBareMethodMarshaller.java:417)[27/03/24 10:08:34:175 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.getFaultResponse(JAXWSProxyHandler.java:632)[27/03/24 10:08:34:175 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.createResponse(JAXWSProxyHandler.java:566)[27/03/24 10:08:34:176 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invokeSEIMethod(JAXWSProxyHandler.java:432)[27/03/24 10:08:34:176 CET] 000000c8 SystemErr R atorg.apache.axis2.jaxws.client.proxy.JAXWSProxyHandler.invoke(JAXWSProxyHandler.java:213)[27/03/24 10:08:34:176 CET] 000000c8 SystemErr R atcom.sun.proxy.$Proxy103.loginServiciosGeneral(Unknown Source)
These are the data to access SOAP services:
Proxy href: "http://proxy.XXXX.es:8080/" Request HeadersContent-Type: text/xml; charset=utf-8 User-Agent:PostmanRuntime/7.34.0 Accept: / Cache-Control: no-cachePostman-Token: f01d4340-b382-457f-9369-a34c45c9968d Host: XXXX.esAccept-Encoding: gzip, deflate, br Connection: keep-aliveContent-Length: 12983
Can anybody help me?
Thank you so much