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:
[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.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: [EMAIL PROTECTED] - 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: [EMAIL PROTECTED] | www.rbxglobal.com
---------------------------------------------------------------------

Reply via email to