Hi Scott,
The proxy's Address is asked to the user via a dialog and the Information
are then stored as properties in a file.
the proxy-information is set to soap with something like this
st.setProxyHost(proxyHost);
st.setProxyPort(Integer.parseInt(proxyPort));
SOAPContext ctx = new SOAPContext();
ctx.setGzip(true);
Call call = new Call("urn:Bestterm",
callName,
params,
null,
Constants.NS_URI_SOAP_ENC,
ctx
);
call.setSOAPTransport(st);
...
The Dialog pops up when there is a Soap-Exception with the Message
something like this
catch (SOAPException sEx)
{
if ( sEx.getMessage().indexOf("Error opening
socket:")>-1
||sEx.getMessage().indexOf("Connection
refused:")>-1)
.... popup Dialog an get proxy infos
}//end of catch (SOAPException sEx)
In the traces I see that the Proxy-properties are set, so I suppose that
they are set.
for detail I send the class, which manages all the soap calls, as
attachment.
thanks in advance
Malte
-----Ursprungliche Nachricht-----
Von: Scott Nichol [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 4. Juni 2003 21:23
An: [EMAIL PROTECTED]
Betreff: Re: Problem with Host-connection in combination with some
Proxies
"No route to host" typically means that the host is being connected
to without using a proxy, and the firewall is blocking the connection
attempt. How does your app determine their is a proxy?
On 4 Jun 2003 at 12:18, Malte Kempff wrote:
> Hello
>
> there are some for me not understandeble Problems with Connections to the
> Host via Apache Soap while using Proxies.
> The application is a Java-Web-Start-Application. Everything is working
with
> the given Proxy, the bowser, the receiving of
> the application via Java-Web-Start. But trying to make a soap-call ends in
a
> exceptions like this, allthough the proxy-address was given.
>
> [SOAPException: faultCode=SOAP-ENV:Client; msg=Error connecting to
> 62.159.233.111:80: java.net.NoRouteToHostException: No route to host:
> connect; targetException=java.net.NoRouteToHostException: No route to
host:
> connect]
> at org.apache.soap.util.net.HTTPUtils.getSocket(Unknown Source)
> at org.apache.soap.util.net.HTTPUtils.post(Unknown Source)
> at org.apache.soap.util.net.HTTPUtils.post(Unknown Source)
> at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
> at org.apache.soap.rpc.Call.invoke(Unknown Source)
> at org.apache.soap.rpc.Call.invoke(Unknown Source)
> at
>
de.mc.etnbestterm.data.SoapCallingDataHolder.callSoaply(SoapCallingDataHolde
> r.java:75)
> at
>
de.mc.etnbestterm.data.MainDataHolder.connectServerToDB(MainDataHolder.java:
> 457)
> at de.mc.etnbestterm.data.MainDataHolder.<init>(MainDataHolder.java:61)
> at
>
de.mc.etnbestterm.data.SingletonManager.getMainDataHolder(SingletonManager.j
> ava:46)
> at de.mc.etnbestterm.gui.WillkommenPanel.jbInit(WillkommenPanel.java:62)
> at de.mc.etnbestterm.gui.WillkommenPanel.<init>(WillkommenPanel.java:52)
> at de.mc.etnbestterm.gui.MainFrame.<init>(MainFrame.java:40)
> at de.mc.etnbestterm.Bestellterminal.jbInit(Bestellterminal.java:64)
> at de.mc.etnbestterm.Bestellterminal.<init>(Bestellterminal.java:44)
> at de.mc.etnbestterm.Bestellterminal.main(Bestellterminal.java:117)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at com.sun.javaws.Launcher.executeApplication(Unknown Source)
> at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
> at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
> at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
> at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
> at com.sun.javaws.Launcher.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.net.NoRouteToHostException: No route to host: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at java.net.Socket.connect(Unknown Source)
> at java.net.Socket.<init>(Unknown Source)
> at java.net.Socket.<init>(Unknown Source)
> at org.apache.soap.util.net.SocketUtils.createSocket(Unknown Source)
> at org.apache.soap.util.net.HTTPUtils.getSocket(Unknown Source)
> at org.apache.soap.util.net.HTTPUtils.post(Unknown Source)
> at org.apache.soap.util.net.HTTPUtils.post(Unknown Source)
> at org.apache.soap.transport.http.SOAPHTTPConnection.send(Unknown Source)
> at org.apache.soap.rpc.Call.invoke(Unknown Source)
> at org.apache.soap.rpc.Call.invoke(Unknown Source)
> at
>
de.mc.etnbestterm.data.SoapCallingDataHolder.callSoaply(SoapCallingDataHolde
> r.java:75)
> at
>
de.mc.etnbestterm.data.MainDataHolder.connectServerToDB(MainDataHolder.java:
> 457)
> at de.mc.etnbestterm.data.MainDataHolder.<init>(MainDataHolder.java:61)
> at
>
de.mc.etnbestterm.data.SingletonManager.getMainDataHolder(SingletonManager.j
> ava:46)
> at de.mc.etnbestterm.gui.WillkommenPanel.jbInit(WillkommenPanel.java:62)
> at de.mc.etnbestterm.gui.WillkommenPanel.<init>(WillkommenPanel.java:52)
> at de.mc.etnbestterm.gui.MainFrame.<init>(MainFrame.java:40)
> at de.mc.etnbestterm.Bestellterminal.jbInit(Bestellterminal.java:64)
> at de.mc.etnbestterm.Bestellterminal.<init>(Bestellterminal.java:44)
> at de.mc.etnbestterm.Bestellterminal.main(Bestellterminal.java:117)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at com.sun.javaws.Launcher.executeApplication(Unknown Source)
> at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
> at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
> at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
> at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
> at com.sun.javaws.Launcher.run(Unknown Source)
> at java.lang.Thread.run(Unknown Source)
>
> Otherwise the same application works by different customers which also use
a
> proxy.
> Once when a customer changed the proxy-software the application got
timeouts
> for every soap-call
> Can it be, that some proxies have problems with apache-soap in general?
> Does it makes a difference for soap using a certian proxy-software in the
> network?
> what can be wrong?
>
> thanks for any hints in advance
>
> Malte
>
> PS: One of the customers having trouble is unsing AVM Ken as proxy-server
>
>
>
>
Scott Nichol
Do not reply directly to this e-mail address,
as it is filtered to only receive e-mail from
specific mailing lists.
package de.mc.etnbestterm.data;
import java.net.*;
import java.util.*;
import javax.swing.*;
import org.apache.soap.*;
import org.apache.soap.rpc.*;
import org.apache.soap.transport.http.*;
import de.mc.etnbestterm.util.*;
import de.mc.util.*;
import de.mc.etnbestterm.*;
abstract public class SoapCallingDataHolder
{
private MessageReceiver m_msgRec = null;
protected Object callSoaply(String callName, Vector params) throws MalformedURLException, SOAPException, Exception
{
Properties props = SingletonManager.getMainProperties();
Properties tmpProps = SingletonManager.getTempProperties();
Object retObj = null;
SOAPHTTPConnection st = new SOAPHTTPConnection();
boolean guterAufruf = false;
Response response = null;
String proxyHost = props.getProperty(GlobalConstants.PROPNAME_PROXY_HOST);
String proxyPort = props.getProperty(GlobalConstants.PROPNAME_PROXY_PORT);
if (proxyHost!=null && proxyPort!=null)
{
System.setProperty("http.proxyHost",proxyHost);
System.setProperty("http.proxyPort",proxyPort);
}
while (!guterAufruf) // oder abgebrochen wurde
{
if (proxyHost != null)
{
st.setProxyHost(proxyHost);
st.setProxyPort(Integer.parseInt(proxyPort));
}
SOAPContext ctx = new SOAPContext();
ctx.setGzip(true);
Call call = new Call("urn:Bestterm",
callName,
params,
null,
Constants.NS_URI_SOAP_ENC,
ctx
);
call.setSOAPTransport(st);
/*
call.setTargetObjectURI("urn:Bestterm");
call.setMethodName(callName);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
call.setParams(params);
*/
URL url = new URL(props.getProperty("URLSTR_SOAP_RPCROUTER",
tmpProps.getProperty("URLSTR_SOURCE_SERVER")
+GlobalConstants.SUBPATH_SOAP_RPCROUTER));
System.out.println("URL = "+url+" - Methode = "+callName);
Logger.trace(5,"URL = "+url+" - Methode = "+callName);
try
{
response = call.invoke(url,"");
guterAufruf = true;
}
catch (SOAPException sEx)
{
if ( sEx.getMessage().indexOf("Error opening socket:")>-1
||sEx.getMessage().indexOf("Connection refused:")>-1)
{
boolean parsingOK = false;
while (!parsingOK)
{
String portAdrString = JOptionPane.showInputDialog(null,
"Es ist keine Verbindung zustandegekommen.\n"
+"Vermutlich wird bei Ihnen ein Proxy verwendet.\n"
+"Bitte geben sie Proxy-Adresse und Port wie folgt an\n"
+"Proxyadresse:Portnummer",
"Proxy-Konfiguration",
JOptionPane.QUESTION_MESSAGE);
if (portAdrString!=null)
{
try
{
int colonPos = portAdrString.indexOf(":");
proxyHost = portAdrString.substring(0,colonPos);
proxyPort = portAdrString.substring(colonPos+1,portAdrString.length());
Integer.parseInt(proxyPort);
props.setProperty(GlobalConstants.PROPNAME_PROXY_HOST, proxyHost);
props.setProperty(GlobalConstants.PROPNAME_PROXY_PORT, proxyPort);
parsingOK = true;
System.setProperty("http.proxyHost",proxyHost);
System.setProperty("http.proxyPort",proxyPort);
System.out.println("proxyHost"+proxyHost);
System.out.println("proxyPort"+proxyPort);
}
catch (Exception ex)
{
}
}
else
{
System.exit(1);
}
}
}
else
{
throw sEx;
}
}//end of catch (SOAPException sEx)
}// end of while ((!abgebrochen) && (!guterAufruf))
if (response.generatedFault())
{
Fault fault = response.getFault();
System.err.println("SOAP-RPC-Fehler:");
System.err.println("SOAP-RPC:"+fault.toString());
System.err.println("Fault Code="+fault.getFaultCode());
System.err.println("SOAP-RPC-Fehler:"+fault.getFaultString());
throw new Exception(fault.getFaultString());
}
else
{
Parameter retValue = response.getReturnValue();
retObj = retValue == null ? null : retValue.getValue();
}
return retObj;
}// end of callSouply(String, Vector)
public void setMessageReceiver(MessageReceiver msgRec)
{
m_msgRec = msgRec;
}
public MessageReceiver getMessgageReceiver()
{
return m_msgRec;
}
}