thanks for your answer

my problem is actually that the properties I set as in this doc are never
read... either I did not understand the docs and missed something important
in it, or it really does not work...

Did anybody succeed with this already?


audry

2007/2/13, Kleineikenscheidt Stefan (CI/AFA3) <
[EMAIL PROTECTED]>:


Have a look here:  http://docs.codehaus.org/display/XFIRE/HTTP+Transport

Hth,
-Stefan

 ------------------------------
*From:* Audry Chanel [mailto:[EMAIL PROTECTED]
*Sent:* Dienstag, 13. Februar 2007 13:46
*To:* [email protected]; [email protected]
*Subject:* [xfire-user] [xfire] pb with proxy authentication !!! I need
help !

Hi everybody,

I'm desperatly trying to use webservices with xfire 1.2.4, but my network
requires proxy authentication to access external resources. I may believe
that XFire 1.2.4 is not able to do that authentication !

I tried :

import org.codehaus.xfire.client.Client;
> import com.ibm.wsdl.xml.WSDLReaderImpl;
> ...
> Client client = new Client( new
> WSDLReaderImpl().readWSDL("tmp/currencyconvertor.wsdl", null);
>     // tmp/currencyconvertor.wsdl is a file where I copied the wsdl
> (because new Client(url) requires auhtentication too)
>     // wsdl's url is : http://www.webservicex.net/CurrencyConvertor.asmx?wsdl
>
> client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_HOST, host);
> client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_PORT, port);
> client.setProperty(CommonsHttpMessageSender.HTTP_PROXY_USER, user);
> client.setProperty (CommonsHttpMessageSender.HTTP_PROXY_PASS, pass);
>
> client.addInHandler(new DOMInHandler());
> client.addInHandler(new LoggingHandler());
> AegisBindingProvider provider =
> (AegisBindingProvider)client.getService().getBindingProvider();
> TypeMapping tm = provider.getTypeMappingRegistry
> ().getDefaultTypeMapping();
>
> Object[] results = client.invoke("ConversionRate", new Object[] {"EUR",
> "VND"});
>

it returns "connection timeout" error (a wrong proxy is beeing tried).


I tried (hazardously) to write (before client creation) :

System.setProperty (CommonsHttpMessageSender.HTTP_PROXY_HOST, host);
> System.setProperty(CommonsHttpMessageSender.HTTP_PROXY_PORT, port);
>

but this time the error is :

ERROR: [http.HttpChannel] sendViaClient(HttpChannel.java:129) Server
> returned error code = 407 for URI :
> http://www.webservicex.net/CurrencyConvertor.asmx. Check server logs for
> details
> org.codehaus.xfire.fault.XFireFault: Server returned error code = 407
> for URI : http://www.webservicex.net/CurrencyConvertor.asmx . Check
> server logs for details
>     at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java
> :89)
>     at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
>     at org.codehaus.xfire.client.Client.invoke(Client.java:335)
>     at org.codehaus.xfire.client.Client.invoke(Client.java:349)
>     at BookDynamicClient.main(BookDynamicClient.java:101)
> Caused by: org.codehaus.xfire.XFireRuntimeException: Server returned
> error code = 407 for URI :
> http://www.webservicex.net/CurrencyConvertor.asmx. Check server logs for
> details
>     at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(
> HttpChannel.java :130)
>     at org.codehaus.xfire.transport.http.HttpChannel.send(
> HttpChannel.java:48)
>     at org.codehaus.xfire.handler.OutMessageSender.invoke(
> OutMessageSender.java:26)
>     at org.codehaus.xfire.handler.HandlerPipeline.invoke (
> HandlerPipeline.java:131)
>     at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
>     ... 3 more
>


So I read sources files available at
http://svn.xfire.codehaus.org/browse/xfire/trunk/xfire/xfire-core/src/main/org/codehaus/xfire/...
 , and it appears to me that XFire never look for authentication :
basically, it seems that when invoking method, the client looks for proxy
properties in a MessageContext that is created by Invocation, which
doesn't care about these properties. When no proxy prop are found in this
messagecontext, CommonsHttpMessageSender looks for proxy and port in
system properties (that's why the 407 error), but it won't read neither
username nor password...

Is it possible to modify the messageContext to set my proxy properties in
it and how?

If not, I think that small change in code would help (like reading client
properties - or even system properties - to set proxycredentials in
CommonsHttpMessageSender)...


thanks all !



Reply via email to