You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Pirola Davide <da...@matrix.it> on 2007/07/11 15:19:53 UTC
Generated client to connect to a https ws
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
Re: Generated client to connect to a https ws
Posted by Willem Jiang <ni...@iona.com>.
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:dan@envoisolutions.com]
> Sent: giovedì 12 luglio 2007 21.42
> To: cxf-user@incubator.apache.org
> 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 <ni...@iona.com> 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
>>>
>>>
>>>
>>>
>
>
>
>
RE: Generated client to connect to a https ws
Posted by Pirola Davide <da...@matrix.it>.
Thanks Dan!
I've solved this issue adding "ContentType" information in http-conduit:
<http:conduit name="{http://www.google.com/api/adsense/v2}AccountService.http-conduit">
<http:client Connection="Keep-Alive"
MaxRetransmits="1"
AllowChunking="false"
ContentType="text/xml"/>
<http:tlsClientParameters/>
</http:conduit>
I don't know why without it I receive this error... in fact, the http request already contains the "text/xml" information... so shouldn't be necessary to specify it in conduit :/
Now I'm working on another issue... adding some Soap header parameters to the message.
I think that i've done it correctly:
Map<String, Object> soapHeaders = new HashMap<String, Object>();
List h1 = new ArrayList();
h1.add("myaccount@mydomain.com");
soapHeaders.put("developer_email", h1);
List h2 = new ArrayList();
h2.add("mypassword");
soapHeaders.put("developer_password", h2);
List h3 = new ArrayList();
h3.add("myclientid");
soapHeaders.put("client_id", h3);
...
...
requestContext.put(MessageContext.HTTP_REQUEST_HEADERS, soapHeaders);
but Google tell me that these values are missing :(
There are other ways to add them to soap headers (for example directly in http-conduit)?
Thanks
Davide
-----Original Message-----
From: Dan Diephouse [mailto:dan@envoisolutions.com]
Sent: giovedì 19 luglio 2007 0.07
To: cxf-user@incubator.apache.org
Subject: Re: Generated client to connect to a https ws
It looks like Google is sending you an HTML response - not XML. Are you
using the right endpoint URL for the google web service? You might want to
try using TCPMon to look at the response google is sending back and see what
their message says...
http://cwiki.apache.org/CXF20DOC/debugging.html
- Dan
On 7/18/07, Pirola Davide <da...@matrix.it> wrote:
>
> Hi all,
> I solved the problem... was my fault :(
> Now I can contact adsense web services... BUT I have another issue.
> When I call the service cxf give me this error:
> org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP version
>
> The reason is that all services give me a wrong http response (415
> Unsupported Media Type).
>
> My request:
> sun.net.www.MessageHeader@ccbab713 pairs: {POST
> /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml;
> charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction:
> ""}{developer_password: mypassword}{client_id: ignored}{Cache-Control:
> no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host:
> sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2,
> */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
>
> Google response:
> sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415 Unsupported
> Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control:
> private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38 GMT}{Server:
> GFE/1.3}
>
>
> Anyone have experience on this problem?
> Sure, Is always my fault.. but where? :D
>
> Thanks
> Davide
>
>
> -----Original Message-----
> From: Pirola Davide
> Sent: venerdì 13 luglio 2007 10.12
> To: 'cxf-user@incubator.apache.org'
> Subject: RE: Generated client to connect to a https ws
>
> 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:dan@envoisolutions.com]
> Sent: giovedì 12 luglio 2007 21.42
> To: cxf-user@incubator.apache.org
> 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 <ni...@iona.com> 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
> > >
> > >
> > >
> >
>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
Re: Generated client to connect to a https ws
Posted by Dan Diephouse <da...@envoisolutions.com>.
It looks like Google is sending you an HTML response - not XML. Are you
using the right endpoint URL for the google web service? You might want to
try using TCPMon to look at the response google is sending back and see what
their message says...
http://cwiki.apache.org/CXF20DOC/debugging.html
- Dan
On 7/18/07, Pirola Davide <da...@matrix.it> wrote:
>
> Hi all,
> I solved the problem... was my fault :(
> Now I can contact adsense web services... BUT I have another issue.
> When I call the service cxf give me this error:
> org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP version
>
> The reason is that all services give me a wrong http response (415
> Unsupported Media Type).
>
> My request:
> sun.net.www.MessageHeader@ccbab713 pairs: {POST
> /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml;
> charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction:
> ""}{developer_password: mypassword}{client_id: ignored}{Cache-Control:
> no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host:
> sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2,
> */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
>
> Google response:
> sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415 Unsupported
> Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control:
> private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38 GMT}{Server:
> GFE/1.3}
>
>
> Anyone have experience on this problem?
> Sure, Is always my fault.. but where? :D
>
> Thanks
> Davide
>
>
> -----Original Message-----
> From: Pirola Davide
> Sent: venerdì 13 luglio 2007 10.12
> To: 'cxf-user@incubator.apache.org'
> Subject: RE: Generated client to connect to a https ws
>
> 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:dan@envoisolutions.com]
> Sent: giovedì 12 luglio 2007 21.42
> To: cxf-user@incubator.apache.org
> 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 <ni...@iona.com> 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
> > >
> > >
> > >
> >
>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
Re: Generated client to connect to a https ws
Posted by Julio Arias <ju...@rbxglobal.com>.
Hi guys -
U can take a look also at https://issues.apache.org/jira/browse/CXF-922
On Aug 29, 2007, at 1:12 AM, Per Olesen wrote:
> Hi Doug,
>
> I think it was you, who left a comment on my blog about the same
> issue. I
> have left you a response there.
>
> http://techpolesen.blogspot.com/2007/08/using-ssl-with-xfirecxf-
> battling.html
>
> Basically, I think you should try with this conduit name:
>
> "{http://gov.nwcg.isuite.webservice}ConnectionAdmin"
>
> In the client config, even though you are deploying on SSL.
>
> /Per
>
> doug.anderson wrote:
>>
>> I believe I am having the same problems connecting to a https web
>> service
>> as
>> you were having. I was wondering what the solution was that
>> worked for
>> you.
>>
>> I have a simple web service and client. When I host it on Tomcat at
>> http://localhost:8080/service/services, the client connects just
>> fine, but
>> it does not work when using https://localhost:8443/service/services.
>>
>> I am using spring.
>>
>> For connection on http://localhost:8080/service/services
>>
>> here is the relevant portion of the spring config file on the server:
>>
>> <jaxws:endpoint
>> id="connectionAdmin"
>> implementor="#connectionAdminService"
>> address="/connectionAdminService" />
>>
>> here is the relevant portion of the spring file for the client:
>> <bean id="adminClient"
>> class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminServic
>> e"
>> factory-bean="adminClientFactory" factory-method="create"/>
>>
>> <bean id="adminClientFactory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> <property name="serviceClass"
>> value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminServic
>> e"/>
>> <property name="address"
>> value="http://localhost:8080/service/services/
>> connectionAdminService"/>
>> </bean>
>>
>>
>> The server page at http://localhost:8080/service/services/ returns:
>> {http://gov.nwcg.isuite.webservice}ConnectionAdmin
>>
>> When I run the client, it connects to the web service and
>> everything is
>> fine
>>
>> now I want to connect on https
>>
>> I change the spring config on the client to have an http:conduit
>> with SSL
>> and change the address of the client factory. It now reads:
>>
>> <http:conduit
>> name="{https://gov.nwcg.isuite.webservice}ConnectionAdmin.http-
>> conduit">
>> <http:tlsClientParameters secureSocketProtocol="SSL">
>> </http:tlsClientParameters>
>> </http:conduit>
>>
>> <bean id="adminClient"
>> class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminServic
>> e"
>> factory-bean="adminClientFactory" factory-method="create"/>
>>
>> <bean id="adminClientFactory"
>> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
>> <property name="serviceClass"
>> value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminServic
>> e"/>
>> <property name="address"
>> value="https://localhost:8443/service/services/
>> connectionAdminService"/>
>> </bean>
>>
>> The server page at https://localhost:8443/service/services/ returns:
>> {http://gov.nwcg.isuite.webservice}ConnectionAdmin
>>
>> When the client runs, I get the same error you were getting:
>>
>> ......
>> Caused by: java.io.IOException: Illegal Protocol https for HTTP
>> URLConnection Factory.
>> at
>> org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConn
>> ection(HttpURLConnectionFactoryImpl.java:44)
>> at
>> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:
>> 468)
>> at
>> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage
>> (MessageSenderInterceptor.java:46)
>> ... 7 more
>>
>>
>> Could you tell me what I am missing?
>>
>> Thanks for your help
>>
>>
>> Doug Anderson
>>
>>
>> Pirola Davide-2 wrote:
>>>
>>> Hi all,
>>> I solved the problem... was my fault :(
>>> Now I can contact adsense web services... BUT I have another issue.
>>> When I call the service cxf give me this error:
>>> org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP
>>> version
>>>
>>> The reason is that all services give me a wrong http response (415
>>> Unsupported Media Type).
>>>
>>> My request:
>>> sun.net.www.MessageHeader@ccbab713 pairs: {POST
>>> /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/
>>> xml;
>>> charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction:
>>> ""}{developer_password: mypassword}{client_id: ignored}{Cache-
>>> Control:
>>> no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host:
>>> sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *;
>>> q=.2,
>>> */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
>>>
>>> Google response:
>>> sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415
>>> Unsupported
>>> Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control:
>>> private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38
>>> GMT}{Server:
>>> GFE/1.3}
>>>
>>>
>>> Anyone have experience on this problem?
>>> Sure, Is always my fault.. but where? :D
>>>
>>> Thanks
>>> Davide
>>>
>>>
>>> -----Original Message-----
>>> From: Pirola Davide
>>> Sent: venerdì 13 luglio 2007 10.12
>>> To: 'cxf-user@incubator.apache.org'
>>> Subject: RE: Generated client to connect to a https ws
>>>
>>> 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:dan@envoisolutions.com]
>>> Sent: giovedì 12 luglio 2007 21.42
>>> To: cxf-user@incubator.apache.org
>>> 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 <ni...@iona.com> 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.createCo
>>>> nnect
>>>>> 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.createCo
>>>> nnect
>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Dan Diephouse
>>> Envoi Solutions
>>> http://envoisolutions.com | http://netzooid.com/blog
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Generated-client-to-connect-to-a-https-ws-
>> tf4061903.html#a12377897
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
>
>
> --
> Per Olesen @ Nordija A/S - www.nordija.com - main#: +45 70 20 25 10
> email: polesen@nordija.com - cell#: +45 23 38 95 81
Julio Arias
Java Developer
Roundbox Global : enterprise : technology : genius
---------------------------------------------------------------------
Avenida 11 y Calle 7-9, Barrio Amón, San Jose, Costa Rica
tel: 404.567.5000 ext. 2001 | cell: 011) 506.849.5981
email: julio.arias@rbxglobal.com | www.rbxglobal.com
---------------------------------------------------------------------
RE: Generated client to connect to a https ws
Posted by Per Olesen <po...@nordija.com>.
Hi Doug,
I think it was you, who left a comment on my blog about the same issue. I
have left you a response there.
http://techpolesen.blogspot.com/2007/08/using-ssl-with-xfirecxf-battling.html
Basically, I think you should try with this conduit name:
"{http://gov.nwcg.isuite.webservice}ConnectionAdmin"
In the client config, even though you are deploying on SSL.
/Per
doug.anderson wrote:
>
> I believe I am having the same problems connecting to a https web service
> as
> you were having. I was wondering what the solution was that worked for
> you.
>
> I have a simple web service and client. When I host it on Tomcat at
> http://localhost:8080/service/services, the client connects just fine, but
> it does not work when using https://localhost:8443/service/services.
>
> I am using spring.
>
> For connection on http://localhost:8080/service/services
>
> here is the relevant portion of the spring config file on the server:
>
> <jaxws:endpoint
> id="connectionAdmin"
> implementor="#connectionAdminService"
> address="/connectionAdminService" />
>
> here is the relevant portion of the spring file for the client:
> <bean id="adminClient"
> class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"
> factory-bean="adminClientFactory" factory-method="create"/>
>
> <bean id="adminClientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> <property name="serviceClass"
> value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"/>
> <property name="address"
> value="http://localhost:8080/service/services/connectionAdminService"/>
> </bean>
>
>
> The server page at http://localhost:8080/service/services/ returns:
> {http://gov.nwcg.isuite.webservice}ConnectionAdmin
>
> When I run the client, it connects to the web service and everything is
> fine
>
> now I want to connect on https
>
> I change the spring config on the client to have an http:conduit with SSL
> and change the address of the client factory. It now reads:
>
> <http:conduit
> name="{https://gov.nwcg.isuite.webservice}ConnectionAdmin.http-conduit">
> <http:tlsClientParameters secureSocketProtocol="SSL">
> </http:tlsClientParameters>
> </http:conduit>
>
> <bean id="adminClient"
> class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"
> factory-bean="adminClientFactory" factory-method="create"/>
>
> <bean id="adminClientFactory"
> class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
> <property name="serviceClass"
> value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"/>
> <property name="address"
> value="https://localhost:8443/service/services/connectionAdminService"/>
> </bean>
>
> The server page at https://localhost:8443/service/services/ returns:
> {http://gov.nwcg.isuite.webservice}ConnectionAdmin
>
> When the client runs, I get the same error you were getting:
>
> ......
> Caused by: java.io.IOException: Illegal Protocol https for HTTP
> URLConnection Factory.
> at
> org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(HttpURLConnectionFactoryImpl.java:44)
> at
> org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:468)
> at
> org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
> ... 7 more
>
>
> Could you tell me what I am missing?
>
> Thanks for your help
>
>
> Doug Anderson
>
>
> Pirola Davide-2 wrote:
>>
>> Hi all,
>> I solved the problem... was my fault :(
>> Now I can contact adsense web services... BUT I have another issue.
>> When I call the service cxf give me this error:
>> org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP
>> version
>>
>> The reason is that all services give me a wrong http response (415
>> Unsupported Media Type).
>>
>> My request:
>> sun.net.www.MessageHeader@ccbab713 pairs: {POST
>> /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml;
>> charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction:
>> ""}{developer_password: mypassword}{client_id: ignored}{Cache-Control:
>> no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host:
>> sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2,
>> */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
>>
>> Google response:
>> sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415
>> Unsupported
>> Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control:
>> private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38
>> GMT}{Server:
>> GFE/1.3}
>>
>>
>> Anyone have experience on this problem?
>> Sure, Is always my fault.. but where? :D
>>
>> Thanks
>> Davide
>>
>>
>> -----Original Message-----
>> From: Pirola Davide
>> Sent: venerdì 13 luglio 2007 10.12
>> To: 'cxf-user@incubator.apache.org'
>> Subject: RE: Generated client to connect to a https ws
>>
>> 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:dan@envoisolutions.com]
>> Sent: giovedì 12 luglio 2007 21.42
>> To: cxf-user@incubator.apache.org
>> 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 <ni...@iona.com> 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
>>> >
>>> >
>>> >
>>>
>>
>>
>>
>> --
>> Dan Diephouse
>> Envoi Solutions
>> http://envoisolutions.com | http://netzooid.com/blog
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Generated-client-to-connect-to-a-https-ws-tf4061903.html#a12377897
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>
--
Per Olesen @ Nordija A/S - www.nordija.com - main#: +45 70 20 25 10
email: polesen@nordija.com - cell#: +45 23 38 95 81
RE: Generated client to connect to a https ws
Posted by "doug.anderson" <do...@byu.net>.
I believe I am having the same problems connecting to a https web service as
you were having. I was wondering what the solution was that worked for you.
I have a simple web service and client. When I host it on Tomcat at
http://localhost:8080/service/services, the client connects just fine, but
it does not work when using https://localhost:8443/service/services.
I am using spring.
For connection on http://localhost:8080/service/services
here is the relevant portion of the spring config file on the server:
<jaxws:endpoint
id="connectionAdmin"
implementor="#connectionAdminService"
address="/connectionAdminService" />
here is the relevant portion of the spring file for the client:
<bean id="adminClient"
class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"
factory-bean="adminClientFactory" factory-method="create"/>
<bean id="adminClientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass"
value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"/>
<property name="address"
value="http://localhost:8080/service/services/connectionAdminService"/>
</bean>
The server page at http://localhost:8080/service/services/ returns:
{http://gov.nwcg.isuite.webservice}ConnectionAdmin
When I run the client, it connects to the web service and everything is fine
now I want to connect on https
I change the spring config on the client to have an http:conduit with SSL
and change the address of the client factory. It now reads:
<http:conduit
name="{https://gov.nwcg.isuite.webservice}ConnectionAdmin.http-conduit">
<http:tlsClientParameters secureSocketProtocol="SSL">
</http:tlsClientParameters>
</http:conduit>
<bean id="adminClient"
class="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"
factory-bean="adminClientFactory" factory-method="create"/>
<bean id="adminClientFactory"
class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
<property name="serviceClass"
value="gov.nwcg.isuite.service.webservice.admin.ConnectionAdminService"/>
<property name="address"
value="https://localhost:8443/service/services/connectionAdminService"/>
</bean>
The server page at https://localhost:8443/service/services/ returns:
{http://gov.nwcg.isuite.webservice}ConnectionAdmin
When the client runs, I get the same error you were getting:
......
Caused by: java.io.IOException: Illegal Protocol https for HTTP
URLConnection Factory.
at
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(HttpURLConnectionFactoryImpl.java:44)
at
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:468)
at
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
... 7 more
Could you tell me what I am missing?
Thanks for your help
Doug Anderson
Pirola Davide-2 wrote:
>
> Hi all,
> I solved the problem... was my fault :(
> Now I can contact adsense web services... BUT I have another issue.
> When I call the service cxf give me this error:
> org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP version
>
> The reason is that all services give me a wrong http response (415
> Unsupported Media Type).
>
> My request:
> sun.net.www.MessageHeader@ccbab713 pairs: {POST
> /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml;
> charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction:
> ""}{developer_password: mypassword}{client_id: ignored}{Cache-Control:
> no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host:
> sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2,
> */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
>
> Google response:
> sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415 Unsupported
> Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control:
> private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38 GMT}{Server:
> GFE/1.3}
>
>
> Anyone have experience on this problem?
> Sure, Is always my fault.. but where? :D
>
> Thanks
> Davide
>
>
> -----Original Message-----
> From: Pirola Davide
> Sent: venerdì 13 luglio 2007 10.12
> To: 'cxf-user@incubator.apache.org'
> Subject: RE: Generated client to connect to a https ws
>
> 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:dan@envoisolutions.com]
> Sent: giovedì 12 luglio 2007 21.42
> To: cxf-user@incubator.apache.org
> 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 <ni...@iona.com> 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
>> >
>> >
>> >
>>
>
>
>
> --
> Dan Diephouse
> Envoi Solutions
> http://envoisolutions.com | http://netzooid.com/blog
>
>
--
View this message in context: http://www.nabble.com/Generated-client-to-connect-to-a-https-ws-tf4061903.html#a12377897
Sent from the cxf-user mailing list archive at Nabble.com.
RE: Generated client to connect to a https ws
Posted by Pirola Davide <da...@matrix.it>.
Hi all,
I solved the problem... was my fault :(
Now I can contact adsense web services... BUT I have another issue.
When I call the service cxf give me this error:
org.apache.cxf.binding.soap.SoapFault: "null" is not a valid SOAP version
The reason is that all services give me a wrong http response (415 Unsupported Media Type).
My request:
sun.net.www.MessageHeader@ccbab713 pairs: {POST /api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml; charset=UTF-8}{developer_email: myuser@mydomain.com}{SOAPAction: ""}{developer_password: mypassword}{client_id: ignored}{Cache-Control: no-cache}{Pragma: no-cache}{User-Agent: Java/1.6.0_01}{Host: sandbox.google.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}{Transfer-Encoding: chunked}
Google response:
sun.net.www.MessageHeader@1e7ce876 pairs: {null: HTTP/1.1 415 Unsupported Media Type}{Content-Type: text/html; charset=UTF-8}{Cache-control: private}{Content-Length: 167}{Date: Tue, 17 Jul 2007 17:09:38 GMT}{Server: GFE/1.3}
Anyone have experience on this problem?
Sure, Is always my fault.. but where? :D
Thanks
Davide
-----Original Message-----
From: Pirola Davide
Sent: venerdì 13 luglio 2007 10.12
To: 'cxf-user@incubator.apache.org'
Subject: RE: Generated client to connect to a https ws
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:dan@envoisolutions.com]
Sent: giovedì 12 luglio 2007 21.42
To: cxf-user@incubator.apache.org
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 <ni...@iona.com> 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
> >
> >
> >
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
RE: Generated client to connect to a https ws
Posted by Pirola Davide <da...@matrix.it>.
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:dan@envoisolutions.com]
Sent: giovedì 12 luglio 2007 21.42
To: cxf-user@incubator.apache.org
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 <ni...@iona.com> 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
> >
> >
> >
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
Re: Generated client to connect to a https ws
Posted by Dan Diephouse <da...@envoisolutions.com>.
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 <ni...@iona.com> 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
> >
> >
> >
>
--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog
RE: Generated client to connect to a https ws
Posted by "Jiang, Ning (Willem)" <Ni...@iona.com>.
Please have a look at the hello_world_https example and [1].
You need to pass the cxf configuration to bus.
You can rename the configuration file to cxf.xml in you classpath or just set the system properity
cxf.config.file to the config file name just as the example does.
[1] http://cwiki.apache.org/CXF20DOC/client-http-transport.html
Hope these can help you :)
Willem.
-----Original Message-----
From: Pirola Davide [mailto:davide.pirola@matrix.it]
Sent: Thu 7/12/2007 19:08
To: cxf-user@incubator.apache.org
Subject: RE: Generated client to connect to a https ws
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:ning.jiang@iona.com]
Sent: giovedì 12 luglio 2007 5.13
To: cxf-user@incubator.apache.org
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
>
>
>
RE: Generated client to connect to a https ws
Posted by Pirola Davide <da...@matrix.it>.
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:ning.jiang@iona.com]
Sent: giovedì 12 luglio 2007 5.13
To: cxf-user@incubator.apache.org
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
>
>
>
Re: Generated client to connect to a https ws
Posted by Willem Jiang <ni...@iona.com>.
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
>
>
>