Hi,
Could you try the trunk version of CXF,
I test the below configuration in the trunk,
configuredConduit.getTlsClientParameters() is not null and it just is a size of
zero list.
<http:conduit
name="{http://www.google.com/api/adsense/v2}AccountServiceService.http-conduit">
<http:tlsClientParameters>
</http:tlsClientParameters>
</http:conduit>
Cheers,
Willem.
Pirola Davide wrote:
Hi Dan & Willem,
Thanks for your support!
The problem I have is in this peace of code (AbstractHTTPTransportFactory):
/**
* This static call creates a connection factory based on
* the existence of the SSL (TLS) client side configuration.
*/
static HttpURLConnectionFactory getConnectionFactory(
HTTPConduit configuredConduit
) {
HttpURLConnectionFactory fac = null;
if (configuredConduit.getTlsClientParameters() != null) {
fac = new HttpsURLConnectionFactory(
configuredConduit.getTlsClientParameters());
} else {
fac = new HttpURLConnectionFactoryImpl();
}
return fac;
}
The "configuredConduit" object seems to be ok... so I have it from the one
configured in my cxf.xml file:
<http:conduit
name="{http://www.google.com/api/adsense/v2}AccountServiceService.http-conduit">
<http:tlsClientParameters>
</http:tlsClientParameters>
</http:conduit>
BUT... the getTlsClientParameters() method return a null object :(
So... seems that the general definition of conduit is ok.. but the
http:tlsClientParameters is ingnored.
I tried to put "http:conduit" definition in my cxf.xml file, and I used the
system property to tell to cxf to load it, then I tried to put it in the cxf.xml file
contained in the cxf-2.0-incubator.jar (/META-INF/cxf/cxf.xml).. but the result is the
same.
Now I'm trying to use the API, as suggested from Dan.
Thanks
Davide
-----Original Message-----
From: Dan Diephouse [mailto:[EMAIL PROTECTED]
Sent: giovedì 12 luglio 2007 21.42
To: [email protected]
Subject: Re: Generated client to connect to a https ws
Actually if you're using the client API, this is probably easier:
YourService s = new YourService()
ServiceInterface client = s.getYourServiceSoapHttpPort
Client c = ClientProxy.getClient(client);
HTTPConduit conduit = (HTTPConduit) c.getConduit()
TLSClientParameters tlsParams = new TLSClientParameters();
conduit.setTlsClientParameters(tlsParams);
Thats equivalent to the XMLM that Willem posted. I would think that you need
to do something further with the tlsParams object (like tell it to accept
the google certificate), but I'm not sure offhand how to do that. Anyone
else around know?
- Dan
On 7/11/07, Willem Jiang <[EMAIL PROTECTED]> wrote:
Please take the hello_world_https in the samples directory as a example.
Here is the sample configuration files for you case:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sec="http://cxf.apache.org/configuration/security"
xmlns:http="http://cxf.apache.org/transports/http/configuration"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xsi:schemaLocation="
http://cxf.apache.org/configuration/security
http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<http:conduit
name="{http://www.google.com/api/adsense/v2}AccountService.http-conduit">
<http:tlsClientParameters>
</http:tlsClientParameters>
</http:conduit>
</beans>
Cheers,
Willem.
Pirola Davide wrote:
Hi,
i'm new on cxf.
I want to generate a client in order to connect to AdSense api of
google:
http://code.google.com/apis/adsense/developer/adsense_api_services.html
I'm using wsdl2java, and I run it to point to a wsdl like this one:
https://www.google.com/api/adsense/v2/AccountService?wsdl
it generate all needed classes. So it's seems pretty cool :D
But... when I try to connect to the google server I receive this error:
11-lug-2007 14.40.45 org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:48)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:206)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:204)
at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
at $Proxy28.createAdSenseAccount(Unknown Source)
at
com.google.api.adsense.v2.AccountServiceClient2.main(AccountServiceClien
t2.java:54)
Caused by: java.io.IOException: Illegal Protocol https for HTTP
URLConnection Factory.
at
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnect
ion(HttpURLConnectionFactoryImpl.java:44)
at
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:468)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:46)
... 7 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could
not send Message.
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:168)
at $Proxy28.createAdSenseAccount(Unknown Source)
at
com.google.api.adsense.v2.AccountServiceClient2.main(AccountServiceClien
t2.java:54)
Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:48)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:206)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:253)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:204)
at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 2 more
Caused by: java.io.IOException: Illegal Protocol https for HTTP
URLConnection Factory.
at
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnect
ion(HttpURLConnectionFactoryImpl.java:44)
at
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:468)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(Messag
eSenderInterceptor.java:46)
... 7 more
Seems that the generated client is not able to connect via https.
Someone have any idea about this problem?
What I miss??
Thanks
Davide