Hi Willem,
I tried your solution, but I still receive the same error :(
I have debugged with cxf source, and the problem is in
"HttpURLConnectionFactoryImpl":
/**
* This call creates an URLConnection for an HTTP url.
* @throws IOException if the url protocol is not "http".
*/
public HttpURLConnection createConnection(Proxy proxy, URL url)
throws IOException {
if (!url.getProtocol().equals(HTTP_URL_PROTOCOL_ID)) {
throw new IOException("Illegal Protocol "
+ url.getProtocol()
+ " for HTTP URLConnection Factory.");
}
if (proxy != null) {
return (HttpURLConnection) url.openConnection(proxy);
} else {
return (HttpURLConnection) url.openConnection();
}
}
The URL of the service, in Google WSDL, is:
<wsdl:service name="AccountServiceService">
<wsdl:port binding="impl:AccountServiceSoapBinding" name="AccountService">
<wsdlsoap:address
location="https://sandbox.google.com/api/adsense/v2/AccountService"/>
</wsdl:port>
</wsdl:service>
The protocol is HTTPS... so when the code over is reached, an exception is
thrown.
You have any other suggestions?
Thank in advance,
Davide
-----Original Message-----
From: Willem Jiang [mailto:[EMAIL PROTECTED]
Sent: giovedì 12 luglio 2007 5.13
To: [email protected]
Subject: Re: Generated client to connect to a https ws
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
>
>
>