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 <[EMAIL PROTECTED]> 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:
[EMAIL PROTECTED] pairs: {POST
/api/adsense/v2/AccountService HTTP/1.1: null}{Content-Type: text/xml;
charset=UTF-8}{developer_email: [EMAIL PROTECTED]:
""}{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:
[EMAIL PROTECTED] 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:[EMAIL PROTECTED]
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 <[EMAIL PROTECTED]> wrote:
>
> Please take the hello_world_https in the samples directory as a example.
>
> Here is the sample configuration files for you case:
>
> <beans xmlns="http://www.springframework.org/schema/beans";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>   xmlns:sec="http://cxf.apache.org/configuration/security";
>   xmlns:http="http://cxf.apache.org/transports/http/configuration";
>   xmlns:jaxws="http://java.sun.com/xml/ns/jaxws";
>   xsi:schemaLocation="
>            http://cxf.apache.org/configuration/security
>            http://cxf.apache.org/schemas/configuration/security.xsd
>            http://cxf.apache.org/transports/http/configuration
>            http://cxf.apache.org/schemas/configuration/http-conf.xsd
>            http://www.springframework.org/schema/beans
>            http://www.springframework.org/schema/beans/spring-beans.xsd
">
>
>   <http:conduit
> name="{http://www.google.com/api/adsense/v2}AccountService.http-conduit
">
>     <http:tlsClientParameters>
>     </http:tlsClientParameters>
>    </http:conduit>
> </beans>
>
> Cheers,
>
> Willem.
>
> Pirola Davide wrote:
> > Hi,
> >
> > i'm new on cxf.
> >
> > I want to generate a client in order to connect to AdSense api of
> > google:
> >
> >
http://code.google.com/apis/adsense/developer/adsense_api_services.html
> >
> >
> >
> > I'm using wsdl2java, and I run it to point to a wsdl like this one:
> >
> > https://www.google.com/api/adsense/v2/AccountService?wsdl
> >
> >
> >
> > it generate all needed classes. So it's seems pretty cool :D
> >
> > But... when I try to connect to the google server I receive this
error:
> >
> >
> >
> > 11-lug-2007 14.40.45 org.apache.cxf.phase.PhaseInterceptorChain
> > doIntercept
> >
> > INFO: Interceptor has thrown exception, unwinding now
> >
> > org.apache.cxf.interceptor.Fault: Could not send Message.
> >
> >        at
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage
(Messag
> > eSenderInterceptor.java:48)
> >
> >        at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept
(PhaseInterceptorC
> > hain.java:206)
> >
> >        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java
:253)
> >
> >        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java
:204)
> >
> >        at
> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> >
> >        at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java
:134)
> >
> >        at $Proxy28.createAdSenseAccount(Unknown Source)
> >
> >        at
> > com.google.api.adsense.v2.AccountServiceClient2.main
(AccountServiceClien
> > t2.java:54)
> >
> > Caused by: java.io.IOException: Illegal Protocol https for HTTP
> > URLConnection Factory.
> >
> >        at
> >
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnect
> > ion(HttpURLConnectionFactoryImpl.java:44)
> >
> >        at
> > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java
:468)
> >
> >        at
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage
(Messag
> > eSenderInterceptor.java:46)
> >
> >        ... 7 more
> >
> > Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could
> > not send Message.
> >
> >        at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java
:168)
> >
> >        at $Proxy28.createAdSenseAccount(Unknown Source)
> >
> >        at
> > com.google.api.adsense.v2.AccountServiceClient2.main
(AccountServiceClien
> > t2.java:54)
> >
> > Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
> >
> >        at
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage
(Messag
> > eSenderInterceptor.java:48)
> >
> >        at
> > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept
(PhaseInterceptorC
> > hain.java:206)
> >
> >        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java
:253)
> >
> >        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java
:204)
> >
> >        at
> > org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
> >
> >        at
> > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java
:134)
> >
> >        ... 2 more
> >
> > Caused by: java.io.IOException: Illegal Protocol https for HTTP
> > URLConnection Factory.
> >
> >        at
> >
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnect
> > ion(HttpURLConnectionFactoryImpl.java:44)
> >
> >        at
> > org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java
:468)
> >
> >        at
> > org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage
(Messag
> > eSenderInterceptor.java:46)
> >
> >        ... 7 more
> >
> >
> >
> > Seems that the generated client is not able to connect via https.
> >
> > Someone have any idea about this problem?
> >
> > What I miss??
> >
> >
> >
> > Thanks
> >
> > Davide
> >
> >
> >
>



--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog




--
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Reply via email to