You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Patrick Stählin <ps...@futurelab.ch> on 2008/07/24 13:06:27 UTC
Specifying the server URI of Axis client
Hi!
I'm trying to access a gSOAP server (2.7.10) running on http://localhost:8081
using axis2-1.4. The Client-Stub, generated by wsdl2java, insists on
connection to localhost:80, regardless of which targetEndpoint I'm passing to
the constructor.
The WSDL I'm using was generated by gSOAP. The (imho) relevant sections are:
[...]
<definitions name="dss"
targetNamespace="http://localhost:8080/dss.wsdl"
xmlns:tns="http://localhost:8080/dss.wsdl"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:dss="urn:dss:1.0"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
[...]
<service name="dss">
<documentation>gSOAP 2.7.10 generated service definition</documentation>
<port name="dss" binding="tns:dss">
<SOAP:address location="http://localhost:8081/"/>
</port>
</service>
</definitions>
Which, in my understanding, will point the client to http://localhost:8081/.
Turning on logging in the HTTPClient showed that It's trying to connect to the
port 80:
2008/07/24 12:46:38:066 CEST [DEBUG] MultiThreadedHttpConnectionManager -
HttpConnectionManager.getConnection: config =
HostConfiguration[host=http://localhost:8081, proxyHost=http://], timeout = 0
2008/07/24 12:46:38:068 CEST [DEBUG] MultiThreadedHttpConnectionManager -
Allocating new connection,
hostConfig=HostConfiguration[host=http://localhost:8081, proxyHost=http://]
2008/07/24 12:46:38:075 CEST [DEBUG] HttpConnection - Open connection to :80
2008/07/24 12:46:38:124 CEST [DEBUG] HttpMethodDirector - Closing the
connection.
2008/07/24 12:46:38:126 CEST [INFO] HttpMethodDirector - I/O exception
(java.net.ConnectException) caught when processing request: Connection
refused
Using netcat to listen on port 80 showed that axis is indeed accessing
localhost:80:
overlord patrick # nc -l -p 80
POST http://localhost:8081/ HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: localhost:8081
Proxy-Connection: Keep-Alive
Transfer-Encoding: chunked
115
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:Authenticate
xmlns:ns2="urn:dss:1.0"><userName>admin</userName><password>nothing</password></ns2:Authenticate></soapenv:Body></soapenv:Envelope>
0
The POST line looked suspicious to me so I've changed the creation of the stub
to:
stub = new DssStub("http://wontresolve:1234/");
which resulted in the following post request:
POST http://wontresolve:1234/ HTTP/1.1
[...]
So, targetEndpoint is apparently != server URI.
Where does axis get the server URI from? Any pointers? (RTFM links most
welcome ;-)
Thanks in advance!
Patrick
--
futureLAB AG tel: +41 (0)52 260 22 22
Schwalmenackerstr. 4 fax: +41 (0)52 260 22 23
CH-8400 Winterthur e-mail: pstaehlin@futurelab.ch
Switzerland mission: delivering tomorrow's applications today
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Specifying the server URI of Axis client
Posted by Patrick Stählin <ps...@futurelab.ch>.
On Thursday 24 July 2008 13:06:27 Patrick Stählin wrote:
>
> Using netcat to listen on port 80 showed that axis is indeed accessing
> localhost:80:
>
> overlord patrick # nc -l -p 80
> POST http://localhost:8081/ HTTP/1.1
Well, this is because http.proxyHost was set to "" (empty string) and this is
regarded as a valid proxy host. I should have recognized this from the URL
specified by as the argument to POST.
Would it hurt to have the line 225 in
org/apache/axis2/transport/http/ProxyConfiguration.java changed:
//From Java Networking Properties
String sp = System.getProperty(HTTP_PROXY_HOST);
- if (param != null || obj != null || sp != null) {
+ if (param != null || obj != null || (sp != null && sp.length() != 0))
{
I wonder who added the empty "http.proxyHost". I've "fixed" this by removing
empty proxy hosts if defined:
String proxyHost = System.getProperty("http.proxyHost");
if(proxyHost != null && proxyHost.length() == 0) {
Properties props = System.getProperties();
props.remove("http.proxyHost");
System.setProperties(props);
}
Patrick
--
futureLAB AG tel: +41 (0)52 260 22 22
Schwalmenackerstr. 4 fax: +41 (0)52 260 22 23
CH-8400 Winterthur e-mail: pstaehlin@futurelab.ch
Switzerland mission: delivering tomorrow's applications today
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org