axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Mazzucco <Michele.Mazzu...@ncl.ac.uk>
Subject Re: AW: AW: AW: AW: AW: AW: [Axis2] Trouble with WS routing through proxy server
Date Fri, 01 Dec 2006 09:24:51 GMT
Hi Pete,

the call
this("http://192.168.200.194:8080/axis2/services/binarytest");

resolves to
//To populate AxisService
populateAxisService();
populateFaults();
_serviceClient = new
org.apache.axis2.client.ServiceClient(configurationContext, _service);
configurationContext =
_serviceClient.getServiceContext().getConfigurationContext();
_serviceClient.getOptions().setTo(new
org.apache.axis2.addressing.EndpointReference(
                 targetEndpoint));

(third constructor), then you have:


Options options = new Options();
HttpTransportProperties.ProxyProperties proxyProperties =
new HttpTransportProperties.ProxyProperties();

proxyProperties.setProxyName("my.proxy.de");
proxyProperties.setDomain("anonymous");
proxyProperties.setUserName("anonymous");
proxyProperties.setPassWord("anonymous");
proxyProperties.setProxyPort(80);
options.setProperty(HTTPConstants.PROXY, proxyProperties);

options.setTo(new EndpointReference(
   "http://192.168.200.194:8080/axis2/services/binarytest"));

_serviceClient.getOptions().setProperty(HTTPConstants.PROXY,
proxyProperties);

_serviceClient.setOptions(options);



try to move the proxy settings into the third constructor.


Michele




Peter Neu wrote:
> Hi Michele,
> 
> I'm using the default constructor in my client class. Call looks
> like this  BinarytestStub stub = new BinarytestStub();. This is the
> constructor below.  
> 
> In the BinarytestStub I included the code into the default constructor. It
> looks like this now:
> 
> public BinarytestStub() throws org.apache.axis2.AxisFault {
>         
>         this("http://192.168.200.194:8080/axis2/services/binarytest");
>         Options options = new Options();
>         HttpTransportProperties.ProxyProperties proxyProperties = 
>         new HttpTransportProperties.ProxyProperties();
>         
>         proxyProperties.setProxyName("my.proxy.de");
>         proxyProperties.setDomain("anonymous");
>         proxyProperties.setUserName("anonymous");
>         proxyProperties.setPassWord("anonymous");
>         proxyProperties.setProxyPort(80);
>         options.setProperty(HTTPConstants.PROXY, proxyProperties);
>         
>         options.setTo(new EndpointReference(
>         "http://192.168.200.194:8080/axis2/services/binarytest"));
>         
>         _serviceClient.getOptions().setProperty(HTTPConstants.PROXY,
> proxyProperties);
>         
>         _serviceClient.setOptions(options);
>     }
> 
> 
> Still I get the same error message. 
> 
> I checked the access log of my proxy server and see this line:
> "POST http://192.168.200.194:8080/axis2/services/binarytest HTTP/1.1" 413
> 1705 "-" "Axis2"
> 
> The client definitely tries to connect through the url above. Which is plain
> wrong because the proxy can't understand it. It must be
> http://my.proxy.de/axis2/services/binarytest because only like this the
> mod_jk module will know the request needs to be passed on to the tomcat
> server. 
> 
> Another strange thing I get this error message in the mod_jk.log :
> [jk_ajp_common.c (1032)]: Error sending request try another pooled
> connection
> worker2 192.168.200.194 31.929102   
> 
> 
> I can't piece this puzzle together. :o(
> 
> Cheers,
> Pete
> 
> 
>> -----Ursprüngliche Nachricht-----
>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>> Gesendet: Donnerstag, 30. November 2006 18:15
>> An: axis-user@ws.apache.org
>> Betreff: Re: AW: AW: AW: AW: AW: [Axis2] Trouble with WS routing through
>> proxy server
>>
>> Hi Pete,
>>
>> so, if I'm right, you are suing one of the 2 constructors you
>> mentioned in you previous email.
>> The call to 'this' fixes the EPR, but I think you don't set the proxy
>> options, do you?
>>
>> Where is the chunk of code about the proxy settings?, you should call
>> somewhere
>>
>> _serviceClient.getOptions.setProperty(HTTPConstants.PROXY,
>> proxyProperties);
>>
>>
>> Michele
>>
>> On 30 Nov 2006, at 11:15, Peter Neu wrote:
>>
>>> OK. The third constructor looks like this:
>>>
>>> public BinarytestStub(org.apache.axis2.context.ConfigurationContext
>>> configurationContext,
>>>        java.lang.String targetEndpoint)
>>>        throws org.apache.axis2.AxisFault {
>>>         //To populate AxisService
>>>         populateAxisService();
>>>         populateFaults();
>>>         _serviceClient = new
>>> org.apache.axis2.client.ServiceClient(configurationContext, _service);
>>>         configurationContext =
>>> _serviceClient.getServiceContext().getConfigurationContext();
>>>         _serviceClient.getOptions().setTo(new
>>> org.apache.axis2.addressing.EndpointReference(
>>>                 targetEndpoint));
>>>     }
>>>
>>> When I set the Endpoint like you said I get a
>>> java.net.SocketTimeoutException for "my.proxy.de"  and a
>>> java.net.UnknownHostException when I put "http://my.proxy.de"
>>> I don't understand why the host is not found because
>>> if I try with my web browser I can contact the host all right.
>>>
>>> I browsed through the online resources but it didn't say what is
>>> wrong in my
>>> case.
>>>
>>> Cheers,
>>> Pete
>>>
>>> P.S. I can send the three files for the client by mail if appropriate.
>>>
>>>
>>>
>>>
>>>
>>>
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>>> Gesendet: Donnerstag, 30. November 2006 11:37
>>>> An: axis-user@ws.apache.org
>>>> Betreff: Re: AW: AW: AW: AW: [Axis2] Trouble with WS routing
>>>> through proxy
>>>> server
>>>>
>>>> Pete,
>>>>
>>>>
>>>> On 30 Nov 2006, at 10:03, Peter Neu wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> the client comes with two constructors. The default one is now with
>>>>> the
>>>>> corrected code.
>>>>>
>>>>> public BinarytestStub() throws org.apache.axis2.AxisFault {
>>>>>
>>>>>         this("http://192.168.200.194:8080/axis2/services/
>>>>> binarytest");
>>>>>         Options options = new Options();
>>>>>         HttpTransportProperties.ProxyProperties proxyProperties =
>>>>> new
>>>>> HttpTransportProperties.ProxyProperties();
>>>>>         proxyProperties.setProxyName("my.proxy.de");
>>>>>         proxyProperties.setProxyPort(80);
>>>>>         options.setProperty(HTTPConstants.PROXY, proxyProperties);
>>>>>        _serviceClient.setOptions(options);
>>>>>     }
>>>>>
>>>>> The other constructor looks like this. Simply set the endpoint,
>>>>>
>>>>> public BinarytestStub(java.lang.String targetEndpoint) throws
>>>>> org.apache.axis2.AxisFault {
>>>>>         this(null, targetEndpoint);
>>>>>     }
>>>>
>>>> And what about the third one?
>>>>
>>>> you have this(String) in the default constructor and this(something,
>>>> String) in the second one, so you have a third constructor as well.
>>>>
>>>>> Now with the setOptions call I get this error message. At least
>>>>> tells me the
>>>>> options thing worked out but something seems to be still missing.
>>>>
>>>>
>>>>
>>>> you need to set the target EPR in you options:
>>>> options.setTo(new EndpointReference("http://192.168.200.194:8080/
>>>> axis2/services/binarytest"));
>>>>
>>>> Please have a look here:
>>>> http://www.wso2.net/articles/axis2/java/2006/08/01/client-api-
>>>> parameters
>>>>
>>>>> org.apache.axis2.AxisFault: No address information in EPR, cannot
>>>>> infer
>>>>> transport
>>>>> at
>>>>> org.apache.axis2.description.ClientUtils.inferOutTransport
>>>>> (ClientUtils.java:
>>>>> 57)
>>>>> at
>>>>> org.apache.axis2.description.OutInAxisOperationClient.execute
>>>>> (OutInAxisOpera
>>>>> tion.java:246)
>>>>> at binary.BinarytestStub.getFile(BinarytestStub.java:137)
>>>>> at binary.BinaryClient.main(BinaryClient.java:39)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>>> (NativeMethodAccessorImpl.java:39
>>>>> )
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>>> (DelegatingMethodAccessorImpl
>>>>> .java:25)
>>>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>>> at com.intellij.rt.execution.application.AppMain.main
>>>>> (AppMain.java:90)
>>>>>
>>>>> cheers,
>>>>> Pete
>>>>>
>>>> Michele
>>>>>
>>>>>> -----Ursprüngliche Nachricht-----
>>>>>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>>>>> Gesendet: Donnerstag, 30. November 2006 09:55
>>>>>> An: axis-user@ws.apache.org
>>>>>> Betreff: Re: AW: AW: AW: [Axis2] Trouble with WS routing through
>>>>>> proxy
>>>>>> server
>>>>>>
>>>>>> Pete,
>>>>>>
>>>>>> before sending the message, you have to call the setOptions()
>>>>>> method on
>>>>>> the ServiceClient object (or the OperationClient or
>>>>>> RPCServiceClient,
>>>>>> whatever you are using). I can't see this call in the chunk of
>>>>>> code you
>>>>>> provided us.
>>>>>> I'm not practice about stub (I use the AXIOM api), but what does
>>>>>> the
>>>>>> this(String) constructor do?
>>>>>>
>>>>>>
>>>>>> Michele
>>>>>>
>>>>>> Peter Neu wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> I'm sorry but this whole proxy stuff still does not work for
me.
>>>>>>> In the client stub I put the changes into the default constructor
>>>>>>>
>>>>>>> public BinarytestStub() throws org.apache.axis2.AxisFault {
>>>>>>>
>>>>>>>         this("http://192.168.200.194:8080/axis2/services/
>>>>>>> binarytest");
>>>>>>>         Options options = new Options();
>>>>>>>         HttpTransportProperties.ProxyProperties proxyProperties
=
>>>>>>> new
>>>>>>> HttpTransportProperties.ProxyProperties();
>>>>>>>         proxyProperties.setProxyName("my.proxy.de");
>>>>>>>         proxyProperties.setProxyPort(80);
>>>>>>>         options.setProperty(HTTPConstants.PROXY, proxyProperties);
>>>>>>>     }
>>>>>>>
>>>>>>> But the client still connects through the endpoint fed to
>>>>>>> constructor
>>>>>>> through the 'this' call.
>>>>>>>
>>>>>>> Please note I included the org.apache.axis2.transport.http
>>>>>>> package which
>>>>>>> only has the setProxyName method rather than setProxyHostName
so
>>>>>>> this
>>>>>> does
>>>>>>> not correspond to the documentation example. By the way do I
>>>>>>> have to
>>>>>> write
>>>>>>> simply my.proxy.de or rather http://my.proxy.de?
>>>>>>>
>>>>>>> cheers,
>>>>>>> Pete
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>>>>>>> Gesendet: Dienstag, 28. November 2006 18:27
>>>>>>>> An: axis-user@ws.apache.org
>>>>>>>> Betreff: Re: AW: AW: [Axis2] Trouble with WS routing through
>>>>>>>> proxy
>>>>>> server
>>>>>>>>
>>>>>>>> On 28 Nov 2006, at 14:20, Peter Neu wrote:
>>>>>>>>
>>>>>>>>> Hm, I tried the runtime approach but my IDE tells me
that there
>>>>>>>>> is no
>>>>>>>>> method setProxyHostName in the
>>>>>>>>> HttpTransportProperties.ProxyProperties
>>>>>>>>> object. Neither is there the constant PROXY in HttpConstants.
>>>>>>>> The HttpConstants class is the one in the
>>>>>>>> org.apache.axis2.transport.http package. There you'll find
the
>>>>>>>> PROXY
>>>>>>>> constant.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> How can I do
>>>>>>>>> this then?
>>>>>>>> This way:
>>>>>>>>
>>>>>>>> Options options = new Options();
>>>>>>>> //....
>>>>>>>> HttpTransportProperties.ProxyProperties proxy = new
>>>>>>>> HttpTransportProperties.ProxyProperties();
>>>>>>>> proxy.setProxyName("proxy");
>>>>>>>> proxy.setProxyPort(8080);
>>>>>>>> options.setProperty
>>>>>>>> (org.apache.axis2.transport.http.HTTPConstants.PROXY, proxy);
>>>>>>>>
>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Pete
>>>>>>>> Regards,
>>>>>>>> Michele
>>>>>>>>
>>>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>>>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>>>>>>>>> Gesendet: Dienstag, 28. November 2006 14:55
>>>>>>>>>> An: axis-user@ws.apache.org
>>>>>>>>>> Betreff: Re: AW: [Axis2] Trouble with WS routing
through proxy
>>>>>>>>>> server
>>>>>>>>>>
>>>>>>>>>> Hi Pete,
>>>>>>>>>>
>>>>>>>>>> please see my comments inline.
>>>>>>>>>>
>>>>>>>>>> Peter Neu wrote:
>>>>>>>>>>> Hello,
>>>>>>>>>>>
>>>>>>>>>>> didn't knew I would need this. So I looked here:
>>>>>>>>>>>
>>>>>>>>>>> http://ws.apache.org/axis2/1_1/http-transport.html#auth
>>>>>>>>>>>
>>>>>>>>>>> If I get this right, I use the original server
and port
>>>>>>>>>>> address
>>>>>>>>>>> (not the
>>>>>>>>>> one
>>>>>>>>>>> of the proxy) in stub and paste this code into
the stub,
>>>>>>>>>>> right? But
>>>>>>>>>> where
>>>>>>>>>>> does this code go?
>>>>>>>>>>>
>>>>>>>>>>> Options options = new Options();
>>>>>>>>>>> HttpTransportProperties.ProxyProperties proxyProperties
= new
>>>>>>>>>>> HttpTransportProperties.new ProxyProperties();
>>>>>>>>>>> proxyProperties.setProxyHostName(xxx.xxx.xxx.xxx);
>>>>>>>>>>> proxyProperties.setProxyPort(80);
>>>>>>>>>>> options.setProperty(HttpConstants.PROXY, proxyProperties);
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> In the axis2.xml on the tomcat server I have
to make these
>>>>>>>>>>> changes,
>>>>>>>>>> right?
>>>>>>>>>>> <transportSender name=""
>>>>>>>>>>> class="org.apache.axis2.transport.http.CommonsHTTPTransportSen
>>>>>>>>>>> de
>>>>>>>>>>> r">
>>>>>>>>>>>         <parameter name="PROTOCOL" locked="false">HTTP/1.1</
>>>>>>>>>>> parameter>
>>>>>>>>>>>         <parameter name="PROXY" proxy_host="proxy_host_name"
>>>>>>>>>>> proxy_port="proxy_host_port"
>>>>>>>>>>> locked="true>anonymous:anonymous:anonymous</parameter>
>>>>>>>>>>> </transportSender>
>>>>>>>>>>>
>>>>>>>>>>> This means I can't no longer connect directly
to the server
>>>>>>>>>>> but
>>>>>>>>>>> have to
>>>>>>>>>>> always go through the proxy, right?
>>>>>>>>>>>
>>>>>>>>>> For what I can understand from the documentation,
it looks like
>>>>>>>>>> you have
>>>>>>>>>> 2 choices:
>>>>>>>>>> 1 - deployment time: you customize the axis2.xml
config
>>>>>>>>>> file, or
>>>>>>>>>> 2 - runtime: you set the custom properties into the
options
>>>>>>>>>> object
>>>>>>>>>>
>>>>>>>>>> Please note that this is what happens for custom
modules as
>>>>>>>>>> well.
>>>>>>>>>> If you change the configuration file you won't need
to set
>>>>>>>>>> custom
>>>>>>>>>> options in order to use the proxy. Vice versa, if
only
>>>>>>>>>> sometimes you
>>>>>>>>>> want to go through the proxy, just use options #2
>>>>>>>>>>
>>>>>>>>>> Hope this helps,
>>>>>>>>>> Michele
>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>> Pete
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>> -----Ursprüngliche Nachricht-----
>>>>>>>>>>>> Von: Michele Mazzucco [mailto:Michele.Mazzucco@ncl.ac.uk]
>>>>>>>>>>>> Gesendet: Montag, 27. November 2006 16:55
>>>>>>>>>>>> An: axis-user@ws.apache.org
>>>>>>>>>>>> Betreff: Re: [Axis2] Trouble with WS routing
through proxy
>>>>>>>>>>>> server
>>>>>>>>>>>>
>>>>>>>>>>>> Hi Pete,
>>>>>>>>>>>>
>>>>>>>>>>>> have you set up the proxy settings in your
axis2 client
>>>>>>>>>>>> (HttpTransportProperties.ProxyProperties)?
>>>>>>>>>>>>
>>>>>>>>>>>> Michele
>>>>>>>>>>>>
>>>>>>>>>>>> On 27 Nov 2006, at 10:30, Peter Neu wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hello,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I got some problems with a proxy server
setup. The tomcat
>>>>>>>>>>>>> server
>>>>>>>>>>>>> (5.5.9)
>>>>>>>>>>>>> running axis2 sits behind a proxy server
which is apache
>>>>>>>>>>>>> httpd
>>>>>>>>>>>>> 2.0.49
>>>>>>>>>>>>> normally this works well but in case
of web services the
>>>>>>>>>>>>> client
>>>>>>>>>>>>> cannot
>>>>>>>>>>>>> connect to the axis service through
>>>>>>>>>>>>> httpd. I get the usual java.net timeout
exception :
>>>>>>>>>>>>> java.net.SocketTimeoutException: Read
timed out
>>>>>>>>>>>>>
>>>>>>>>>>>>> In the httpd access log I only see this
line:
>>>>>>>>>>>>>
>>>>>>>>>>>>> 192.168.200.188 - - [27/Nov/2006:11:33:26
+0100] "POST
>>>>>>>>>>>>> /axis2/services/binarytest HTTP/1.1"
413 1703 "-" "Axis2"
>>>>>>>>>>>>>
>>>>>>>>>>>>> No further hints to what might be going
wrong.
>>>>>>>>>>>>>
>>>>>>>>>>>>> My Web Service is transmitting small
documents ~300kb.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Any ideas what could be wrong?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Cheers,
>>>>>>>>>>>>> Pete
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ------------------------------------------------------------
>>>>>>>>>>>>> --
>>>>>>>>>>>>> ----
>>>>>>>>>>>>> ---
>>>>>>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: axis-user-
>>>>>>>>>>>>> help@ws.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>> -------------------------------------------------------------
>>>>>>>>>>>> --
>>>>>>>>>>>> ----
>>>>>>>>>>>> --
>>>>>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>>>>>
>>>>>>>>>>> --------------------------------------------------------------
>>>>>>>>>>> --
>>>>>>>>>>> ----
>>>>>>>>>>> -
>>>>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------
>>>>>>>>>> --
>>>>>>>>>> ----
>>>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>>>
>>>>>>>>> ----------------------------------------------------------------
>>>>>>>>> --
>>>>>>>>> ---
>>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>>>
>>>>>>>> -----------------------------------------------------------------
>>>>>>>> --
>>>>>>>> --
>>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------
>>>>>>> --
>>>>>>> -
>>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>>>
>>>>>> -------------------------------------------------------------------
>>>>>> --
>>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> -
>>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message