Hello to all,
I have a similar problem with a generated client ( it's included in mtom
samples from Apache CXF 2.0 distribution) when I am behind of the corporate
firewall. I can't pass the proxy server and I have the error : "Server
returned HTTP response code: 407 for URL ... "
TestMtomService tms = new TestMtomService(wsdlURL, SERVICE_NAME);
TestMtom port = (TestMtom) tms.getPort(PORT_NAME, TestMtom.class);
Binding binding = ((BindingProvider)port).getBinding();
((SOAPBinding)binding).setMTOMEnabled(true);
Client clt = ClientProxy.getClient(port);
and I tried many posibilities included the code like Alex.
More , a created a cxf.xml file that is loaded (it seems) by method call <<
new TestMtomService(wsdlURL, SERVICE_NAME) >>. I let these settings in it :
<http-conf:conduit
name="{http://cxf.apache.org/mime}TestMtomPort.http-conduit">
<http-conf:client Connection="Keep-Alive"
MaxRetransmits="1"
AllowChunking="false"
ProxyServer="1.1.1.1"
ProxyServerPort="2222" />
<http-conf:basicAuthSupplier class="demo.mtom.client.ClientAuthent"/>
<http-conf:authorization />
<http-conf:proxyAuthorization />
</http-conf:conduit>
Also I created a class named ClientAuthent which extends
HttpBasicAuthSupplier and override getPreemptiveUserPass
public UserPass getPreemptiveUserPass(
String conduitName,
URL currentURL,
Message message)
{
return createUserPass( "myuser" ,"mypassword");
}
I don't know what other settings have to do for reading all informations for
ProxyServer, ProxyPort, ProxyUser and ProxyPassword.
Also, I didn't find out others attributes for <http-conf:authorization />
and <http-conf:proxyAuthorization />.
Maybe this will solve the problem.
Can somebody help me ?
Thank in advance for help,
Petrica
==================================================================
Willem Jiang-2 wrote:
>
> Hi Axel,
>
> I checked the HTTPConduit code, your way to set the http basic
> authentication is right.
>
> Can you use tcpmon to check the authentication informantion has been set
> into the http headers?
>
> If not, I think it must be the CXF's bug.
>
>
> Willem.
>
> Axel Becker wrote:
>> Hi,
>>
>> i generated the client code with the wsdl2java from an existing wsdl.
>>
>> now i want to connect to this service (it is an axis 1 webservice). the
>> service ist protected with a http basic authentication. i use the
>> following
>> code, but it doesnt work :-(
>>
>> INFOServiceService ss = new INFOServiceService(SERVICE_URL,
>> SERVICE_NAME);
>>
>> Client client = ClientProxy.getClient(ss.getINFOService());
>> HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
>>
>> httpConduit.getAuthorization().setUserName("username1");
>> httpConduit.getProxyAuthorization().setUserName("username1");
>>
>> INFOService service = ss.getINFOService();
>> //do somthing with service
>>
>> Where is the mistake?
>>
>> Thanks for your help!
>> Axel
>>
>>
>> PS: the serverside (axis1) code to get the auth parameter is:
>> String username = MessageContext.getCurrentContext().getUsername();
>>
>>
>>
>
>
--
View this message in context:
http://www.nabble.com/HTTP-Basic-Auth-with-wsdl2java-generated-Client-tf4148070.html#a11968274
Sent from the cxf-user mailing list archive at Nabble.com.