Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Webservice client trough HTTP Proxy on Websphere 6.0

 
Mieza del Val
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are stucked trying to connect to a Webservice trough a HTTP Proxy.
We are deploying the application on Websphere 6.0 and we are using this
code:

package es.stl.gpm.request.soap;

import java.util.Properties;

import javax.naming.InitialContext;
import javax.xml.rpc.Stub;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;

import com.ibm.etools.j2ee.common.QName; import com.ibm.ws.webservices.engine.client.Service;

import com.ibm.wsspi.webservices.Constants;

public class ConexionSOAPThread extends Thread{

/**
* Atributo que representa la conexi�n.
*/
private SOAPConnection _connection;

private SOAPMessage peticion;

/**
* Direcci�n del destino
*/
private String _endpoint;

private SOAPMessage respuesta;

protected void setEndpoint(String _endpoint) {
this._endpoint = _endpoint;
}

protected void setPeticion(SOAPMessage peticion) {
this.peticion = peticion;
}

// This method is called when the thread runs
public void run()
{
try {

System.out.println("Before call");

((Stub)_connection)._setProperty(Constants.HTTP_PROXYHOST_PROPERTY,"proxyhost");


((Stub)_connection)._setProperty(Constants.HTTP_PROXYPORT_PROPERTY,"8080");


((Stub)_connection)._setProperty(Constants.HTTPS_PROXYHOST_PROPERTY,"proxyhost");


((Stub)_connection)._setProperty(Constants.HTTPS_PROXYPORT_PROPERTY,"8080");


respuesta = _connection.call(peticion,_endpoint);
System.out.println("After call");

} catch (SOAPException e) {
e.printStackTrace();
}
catch (Throwable e) {
e.printStackTrace();
};


}

public void setConnection(SOAPConnection _connection) {
this._connection = _connection;
}

public SOAPMessage getRespuesta() {
return respuesta;
}

}

We can't use anymore System.properties to set the proxy and the port due a customer petition.

Same code without the stub._setProperty work correctly setting the same HttpProxy and port values on System.properties.

Thanks in advance for your help!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic