You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Arul Dhesiaseelan <ar...@fluxcorp.com> on 2008/07/21 17:19:41 UTC
CXF ssl sample using CXF APIs
Hello,
I was trying to use CXF APIs to configure SSL on the service. But, I am
getting an illegal state exception: Port 9001 is configured with wrong
protocol "http" for "https://localhost:9001/hello"
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
sf.setServiceClass(HelloWorld.class);
sf.getServiceFactory().setWrapped(true);
QName name = new QName("http://test.com", "ws", "");
sf.setServiceName(name);
sf.setAddress("https://localhost:9001/hello");
HelloWorld helloService = new HelloWorldImpl();
sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
//org.apache.cxf.endpoint.Server server = sf.create();
JettyHTTPServerEngineFactory factory =
sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
TLSServerParameters tlsParams = new TLSServerParameters();
JettyHTTPServerEngine engine = null;
try {
engine = factory.createJettyHTTPServerEngine(9001, "https");
KeyStore keyStore = KeyStore.getInstance("JKS");
String trustpass = "password";
File truststore = new
File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
keyStore.load(new FileInputStream(truststore),
trustpass.toCharArray());
KeyManagerFactory keyFactory =
KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
keyFactory.init(keyStore, trustpass.toCharArray());
KeyManager[] km = keyFactory.getKeyManagers();
tlsParams.setKeyManagers(km);
truststore = new
File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
keyStore.load(new FileInputStream(truststore),
trustpass.toCharArray());
TrustManagerFactory trustFactory =
TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustFactory.init(keyStore);
TrustManager[] tm = trustFactory.getTrustManagers();
tlsParams.setTrustManagers(tm);
FiltersType filter = new FiltersType();
filter.getInclude().add(".*_EXPORT_.*");
filter.getInclude().add(".*_EXPORT1024_.*");
filter.getInclude().add(".*_WITH_DES_.*");
filter.getInclude().add(".*_WITH_NULL_.*");
filter.getExclude().add(".*_DH_anon_.*");
tlsParams.setCipherSuitesFilter(filter);
ClientAuthentication ca = new ClientAuthentication();
ca.setRequired(true);
ca.setWant(true);
tlsParams.setClientAuthentication(ca);
tlsParams.setSecureSocketProtocol("SSL");
if (engine != null) {
engine.setTlsServerParameters(tlsParams);
}
} catch (KeyStoreException kse) {
} catch (NoSuchAlgorithmException nsa) {
} catch (FileNotFoundException fnfe) {
} catch (UnrecoverableKeyException uke) {
} catch (CertificateException ce) {
} catch (GeneralSecurityException gse) {
} catch (IOException ioe) {
}
List<JettyHTTPServerEngine> engines = new
ArrayList<JettyHTTPServerEngine>();
if (engine != null)
engines.add(engine);
factory.setEnginesList(engines);
org.apache.cxf.endpoint.Server server = sf.create();
((JettyHTTPServerEngine) ((JettyHTTPDestination)
server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
String endpoint = server.getEndpoint().getEndpointInfo().getAddress();
System.out.println("Server started at " + endpoint);
But when I start the service, I get the below error:
Jul 21, 2008 9:15:10 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://test.com}ws from class
com.test.cxf.HelloWorld
Exception in thread "main" java.lang.IllegalStateException: Port 9001 is
configured with wrong protocol "http" for "https://localhost:9001/hello"
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
at
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
at
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
at
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
at
org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
at com.test.cxf.Server.main(Server.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Any thoughts on this issue?
Thank you,
-Arul
RE: Generating special annotations to WSDL2Java generated java objects!
Posted by Kugaprakash Visagamani <kv...@infoblox.com>.
Hi,
First, thank you for helping with a suggestion.
I thought of doing so, but since there are too many objects, thought of checking the possibility of having custom annotations if possible to generate using WSDL.
Can anyone please let me know if it is possible to generate custom annotations?
Thanks
Kuga
-----Original Message-----
From: Pawel Lipka [mailto:p.lipka@amg.net.pl]
Sent: Tuesday, July 29, 2008 3:22 PM
To: users@cxf.apache.org
Subject: RE: Generating special annotations to WSDL2Java generated java objects!
Kuga,
My advice is to go the other way round:
1) Forget about custom attribudes in the XSD
2) Write your foo/bar/Content.java file manually
3) Annotate them with SomeAnnotation as you wish
4) Annotate them with JAXB annotations
5) Create ObjectFactory.java and package-info.java files manually for the
foo.bar package
6) Configure wsdl2java to ignore the XML namespace to which your Content xml
type is bound
Cheers,
--
Pawel Lipka
IT Architect
________________________________
AMG.net businesstechnology consulting
http://www.amg.net.pl
Łąkowa 11, 90-554 Lodz, tel/fax (42) 296 11 32
Tresc niniejszej wiadomosci moze byc poufna. Jezeli nie jestescie Panstwo
jej adresatem, to rozprowadzanie lub wykorzystywanie zawartych tu
informacji jest zabronione.
-----Original Message-----
From: Kugaprakash Visagamani [mailto:kvisagamani@infoblox.com]
Sent: Tuesday, July 29, 2008 8:28 PM
To: users@cxf.apache.org
Subject: Generating special annotations to WSDL2Java generated java objects!
Hi,
Can some please help me with the following questions?
For instance I have a table of contents with each row is of type "Content",
and the ability of the column to sort/filter comes is defined in the XSD as
part of the XSD definition given below:
<complexType: name="Content">
<complexContent>
<sequence>
<element name="slNo" type="int" isSortable="true"/>
<element name="content" type="string"
isFilterable="true" isSortable="true"/>
<element name="pageNo" type="int"/>
</sequence>
</complexContent>
</complexType>
Note that there are two additional special attributes (custom
attributes) for element ("isFilterable" and "isSortable") in the XSD.
Q1: These additional attributes can they be defined, if so can you please
let me know how?
Q2: Intention for these additional attribute is that, would like to have
them as annotations in wsdlToJava generated objects, sample expected result
is given below:
Public class Content{
@SomeAnnotation(isFilterable="true")
Private int slNo;
@SomeAnnotation(isFilterable="true", isSortable="true")
Private String content
Private int pageNo;
.........
}
Is this possible to be able to generate our own annotations
(@SomeAnnotation)? Is so, please help me with a sample.
Q3: During the process of wsdltojava, can I try to create additional helper
methods? Like for the example above, I may need the following
API:
Public List<String> getFilterableAttributes()
Public List<String> getSortableAttributes()
Is it possible to be able generate additional helper methods?
Any help is highly appreciated.
Thanks
Kuga
RE: Generating special annotations to WSDL2Java generated java objects!
Posted by Pawel Lipka <p....@amg.net.pl>.
Kuga,
My advice is to go the other way round:
1) Forget about custom attribudes in the XSD
2) Write your foo/bar/Content.java file manually
3) Annotate them with SomeAnnotation as you wish
4) Annotate them with JAXB annotations
5) Create ObjectFactory.java and package-info.java files manually for the
foo.bar package
6) Configure wsdl2java to ignore the XML namespace to which your Content xml
type is bound
Cheers,
--
Pawel Lipka
IT Architect
________________________________
AMG.net businesstechnology consulting
http://www.amg.net.pl
Łąkowa 11, 90-554 Lodz, tel/fax (42) 296 11 32
Tresc niniejszej wiadomosci moze byc poufna. Jezeli nie jestescie Panstwo
jej adresatem, to rozprowadzanie lub wykorzystywanie zawartych tu
informacji jest zabronione.
-----Original Message-----
From: Kugaprakash Visagamani [mailto:kvisagamani@infoblox.com]
Sent: Tuesday, July 29, 2008 8:28 PM
To: users@cxf.apache.org
Subject: Generating special annotations to WSDL2Java generated java objects!
Hi,
Can some please help me with the following questions?
For instance I have a table of contents with each row is of type "Content",
and the ability of the column to sort/filter comes is defined in the XSD as
part of the XSD definition given below:
<complexType: name="Content">
<complexContent>
<sequence>
<element name="slNo" type="int" isSortable="true"/>
<element name="content" type="string"
isFilterable="true" isSortable="true"/>
<element name="pageNo" type="int"/>
</sequence>
</complexContent>
</complexType>
Note that there are two additional special attributes (custom
attributes) for element ("isFilterable" and "isSortable") in the XSD.
Q1: These additional attributes can they be defined, if so can you please
let me know how?
Q2: Intention for these additional attribute is that, would like to have
them as annotations in wsdlToJava generated objects, sample expected result
is given below:
Public class Content{
@SomeAnnotation(isFilterable="true")
Private int slNo;
@SomeAnnotation(isFilterable="true", isSortable="true")
Private String content
Private int pageNo;
.........
}
Is this possible to be able to generate our own annotations
(@SomeAnnotation)? Is so, please help me with a sample.
Q3: During the process of wsdltojava, can I try to create additional helper
methods? Like for the example above, I may need the following
API:
Public List<String> getFilterableAttributes()
Public List<String> getSortableAttributes()
Is it possible to be able generate additional helper methods?
Any help is highly appreciated.
Thanks
Kuga
Re: Generating special annotations to WSDL2Java generated java objects!
Posted by Daniel Kulp <dk...@apache.org>.
I THINK you can do this with XJC plugins to the schema compiler. Not
really sure though. The XJC plugins can manipulate the generated
code, but I'm not sure the complete set of manipulations they can do.
This is really a JAXB question that might be best posted to the JAXB
lists.
Dan
On Jul 29, 2008, at 2:28 PM, Kugaprakash Visagamani wrote:
> Hi,
>
> Can some please help me with the following questions?
>
> For instance I have a table of contents with each row is of type
> "Content", and the ability of the column to sort/filter comes is
> defined
> in the XSD as part of the XSD definition given below:
>
>
>
> <complexType: name="Content">
>
> <complexContent>
>
> <sequence>
>
> <element name="slNo" type="int" isSortable="true"/>
>
> <element name="content" type="string"
> isFilterable="true" isSortable="true"/>
>
> <element name="pageNo" type="int"/>
>
> </sequence>
>
> </complexContent>
>
> </complexType>
>
>
>
> Note that there are two additional special attributes (custom
> attributes) for element ("isFilterable" and "isSortable") in the XSD.
>
> Q1: These additional attributes can they be defined, if so can you
> please let me know how?
>
> Q2: Intention for these additional attribute is that, would like to
> have
> them as annotations in wsdlToJava generated objects, sample expected
> result is given below:
>
>
>
> Public class Content{
>
> @SomeAnnotation(isFilterable="true")
>
> Private int slNo;
>
> @SomeAnnotation(isFilterable="true", isSortable="true")
>
> Private String content
>
> Private int pageNo;
>
> .........
>
> }
>
>
>
> Is this possible to be able to generate our own annotations
> (@SomeAnnotation)? Is so, please help me with a sample.
>
>
>
> Q3: During the process of wsdltojava, can I try to create additional
> helper methods? Like for the example above, I may need the following
> API:
>
> Public List<String> getFilterableAttributes()
>
> Public List<String> getSortableAttributes()
>
> Is it possible to be able generate additional helper methods?
>
>
>
> Any help is highly appreciated.
>
> Thanks
>
> Kuga
>
>
>
>
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Generating special annotations to WSDL2Java generated java objects!
Posted by Kugaprakash Visagamani <kv...@infoblox.com>.
Hi,
Can some please help me with the following questions?
For instance I have a table of contents with each row is of type
"Content", and the ability of the column to sort/filter comes is defined
in the XSD as part of the XSD definition given below:
<complexType: name="Content">
<complexContent>
<sequence>
<element name="slNo" type="int" isSortable="true"/>
<element name="content" type="string"
isFilterable="true" isSortable="true"/>
<element name="pageNo" type="int"/>
</sequence>
</complexContent>
</complexType>
Note that there are two additional special attributes (custom
attributes) for element ("isFilterable" and "isSortable") in the XSD.
Q1: These additional attributes can they be defined, if so can you
please let me know how?
Q2: Intention for these additional attribute is that, would like to have
them as annotations in wsdlToJava generated objects, sample expected
result is given below:
Public class Content{
@SomeAnnotation(isFilterable="true")
Private int slNo;
@SomeAnnotation(isFilterable="true", isSortable="true")
Private String content
Private int pageNo;
.........
}
Is this possible to be able to generate our own annotations
(@SomeAnnotation)? Is so, please help me with a sample.
Q3: During the process of wsdltojava, can I try to create additional
helper methods? Like for the example above, I may need the following
API:
Public List<String> getFilterableAttributes()
Public List<String> getSortableAttributes()
Is it possible to be able generate additional helper methods?
Any help is highly appreciated.
Thanks
Kuga
Re: Specifying my own collection for Marshalling/Unmarshalling!
Posted by Daniel Kulp <dk...@apache.org>.
On Jul 22, 2008, at 10:41 PM, Kugaprakash Visagamani wrote:
> Hi Dan,
> Thanks a lot for the helpful suggestions.
> I was thinking only in terms of interceptor, and breaking my head...
> Anyways,
> "MyList" is not an implementation of java.util.List, however, I can
> try
> to convert it to implement java.util.List, so, question is, If I just
> define "MyList" the following way:
> Public interface MyList extends java.util.List{}
You MAY will need the generics in there as well:
public interface MyList<T> extends java.util.List<T> {....}
so JAXB can then determine what it is a list of.
> Is that sufficient, or will there be any kind of ClassCastException
> (like when the CXF unmarshal/marshal, would expect an
> ArrayList/Vector/..)
No. THat should be fine. As long as it implements "List" and the
appropriate "List<Item> getItem()" call is there, it should be fine.
There is actually a JAXB customization that allows you to tell the
code generator to use a different List implementation than ArrayList
(the default). Thus, the runtime cannot rely on it as that
customization wouldn't work.
> Can I request your recommendations in terms of performance, which
> approach would be better, weather to extend MyList to List, and then
> annotate it, or use XmlJavaTypeAdapter?
Definitely the List approach. The TypeAdapter stuff requires you to
write code to map your data into a List and back again. Thus, you
end up copying stuff from List to List and constructing additional
objects, etc.... If your list is just a List, it can use it as is.
Dan
> Thanks Again,
> Best Regards
> Kuga
>
> -----Original Message-----
> From: Daniel Kulp [mailto:dkulp@apache.org]
> Sent: Tuesday, July 22, 2008 6:11 PM
> To: users@cxf.apache.org; Kugaprakash Visagamani
> Subject: Re: Specifying my own collection for Marshalling/
> Unmarshalling!
>
>
> If "MyList" is a List, the easiest is to jst add a method:
> public List<Item> getItems() {
> return items;
> }
> and move the JAXB annotations onto it instead of the field. The
> runtime will use that method to get the list. It will use that to
> call list.add(..) to populate it or the iterator to write it. You
> could actually return an object that implements List that wrappers
> your real object.
>
> If it DOESN'T implement the list, you'll need to write an
> XmlJavaTypeAdapter that maps your type to/from the appropriate List.
> The java_frist_jaxws sample shows one of those for mapping Maps.
>
>
> Dan
>
>
>
> On Jul 22, 2008, at 4:19 PM, Kugaprakash Visagamani wrote:
>
>> Hi,
>> In the WSDL definition, I have a list of items as given below:
>> Wsdl2Java converted java object sample is given below:
>>
>> Public class Order {
>> Private List<Item> items;
>>
>> }
>>
>> But my actual model class definition is:
>> Public class Order{
>> Private MyList items; //MyList is my own implementation of List,
>> or may be it may not even be extending from the java.util.List, is
>> rather kind of implementation of list
>> }
>>
>> Note: I am not planning to use the Wsdl2Java generated java objects,
>> instead I am placing my actual model class "Order" in the same
>> package
>> as the Wsdl2Java generated java objects would be, so that during
>> searialization/de-serialization process, it actually pick my actual
>> model class. It all works fine, except for this kind of scenarios,
>> where
>> I have my own implementation of List.
>>
>> Can I add some interceptor or define somewhere in the xml's that
>> during
>> the marshall/unmarshall if it encounter's List, use my implementation
>> instead.
>>
>> Any sample code would be HIGHLY Appreciated.
>>
>> Thanks in advance.
>> Best Regards,
>> Kuga
>
> ---
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
>
>
>
>
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
RE: Specifying my own collection for Marshalling/Unmarshalling!
Posted by Kugaprakash Visagamani <kv...@infoblox.com>.
Hi Dan,
Thanks a lot for the helpful suggestions.
I was thinking only in terms of interceptor, and breaking my head...
Anyways,
"MyList" is not an implementation of java.util.List, however, I can try
to convert it to implement java.util.List, so, question is, If I just
define "MyList" the following way:
Public interface MyList extends java.util.List{}
Is that sufficient, or will there be any kind of ClassCastException
(like when the CXF unmarshal/marshal, would expect an
ArrayList/Vector/..)
Can I request your recommendations in terms of performance, which
approach would be better, weather to extend MyList to List, and then
annotate it, or use XmlJavaTypeAdapter?
Thanks Again,
Best Regards
Kuga
-----Original Message-----
From: Daniel Kulp [mailto:dkulp@apache.org]
Sent: Tuesday, July 22, 2008 6:11 PM
To: users@cxf.apache.org; Kugaprakash Visagamani
Subject: Re: Specifying my own collection for Marshalling/Unmarshalling!
If "MyList" is a List, the easiest is to jst add a method:
public List<Item> getItems() {
return items;
}
and move the JAXB annotations onto it instead of the field. The
runtime will use that method to get the list. It will use that to
call list.add(..) to populate it or the iterator to write it. You
could actually return an object that implements List that wrappers
your real object.
If it DOESN'T implement the list, you'll need to write an
XmlJavaTypeAdapter that maps your type to/from the appropriate List.
The java_frist_jaxws sample shows one of those for mapping Maps.
Dan
On Jul 22, 2008, at 4:19 PM, Kugaprakash Visagamani wrote:
> Hi,
> In the WSDL definition, I have a list of items as given below:
> Wsdl2Java converted java object sample is given below:
>
> Public class Order {
> Private List<Item> items;
>
> }
>
> But my actual model class definition is:
> Public class Order{
> Private MyList items; //MyList is my own implementation of List,
> or may be it may not even be extending from the java.util.List, is
> rather kind of implementation of list
> }
>
> Note: I am not planning to use the Wsdl2Java generated java objects,
> instead I am placing my actual model class "Order" in the same package
> as the Wsdl2Java generated java objects would be, so that during
> searialization/de-serialization process, it actually pick my actual
> model class. It all works fine, except for this kind of scenarios,
> where
> I have my own implementation of List.
>
> Can I add some interceptor or define somewhere in the xml's that
> during
> the marshall/unmarshall if it encounter's List, use my implementation
> instead.
>
> Any sample code would be HIGHLY Appreciated.
>
> Thanks in advance.
> Best Regards,
> Kuga
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Re: Specifying my own collection for Marshalling/Unmarshalling!
Posted by Daniel Kulp <dk...@apache.org>.
If "MyList" is a List, the easiest is to jst add a method:
public List<Item> getItems() {
return items;
}
and move the JAXB annotations onto it instead of the field. The
runtime will use that method to get the list. It will use that to
call list.add(..) to populate it or the iterator to write it. You
could actually return an object that implements List that wrappers
your real object.
If it DOESN'T implement the list, you'll need to write an
XmlJavaTypeAdapter that maps your type to/from the appropriate List.
The java_frist_jaxws sample shows one of those for mapping Maps.
Dan
On Jul 22, 2008, at 4:19 PM, Kugaprakash Visagamani wrote:
> Hi,
> In the WSDL definition, I have a list of items as given below:
> Wsdl2Java converted java object sample is given below:
>
> Public class Order {
> Private List<Item> items;
>
> }
>
> But my actual model class definition is:
> Public class Order{
> Private MyList items; //MyList is my own implementation of List,
> or may be it may not even be extending from the java.util.List, is
> rather kind of implementation of list
> }
>
> Note: I am not planning to use the Wsdl2Java generated java objects,
> instead I am placing my actual model class "Order" in the same package
> as the Wsdl2Java generated java objects would be, so that during
> searialization/de-serialization process, it actually pick my actual
> model class. It all works fine, except for this kind of scenarios,
> where
> I have my own implementation of List.
>
> Can I add some interceptor or define somewhere in the xml's that
> during
> the marshall/unmarshall if it encounter's List, use my implementation
> instead.
>
> Any sample code would be HIGHLY Appreciated.
>
> Thanks in advance.
> Best Regards,
> Kuga
---
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog
Specifying my own collection for Marshalling/Unmarshalling!
Posted by Kugaprakash Visagamani <kv...@infoblox.com>.
Hi,
In the WSDL definition, I have a list of items as given below:
Wsdl2Java converted java object sample is given below:
Public class Order {
Private List<Item> items;
}
But my actual model class definition is:
Public class Order{
Private MyList items; //MyList is my own implementation of List,
or may be it may not even be extending from the java.util.List, is
rather kind of implementation of list
}
Note: I am not planning to use the Wsdl2Java generated java objects,
instead I am placing my actual model class "Order" in the same package
as the Wsdl2Java generated java objects would be, so that during
searialization/de-serialization process, it actually pick my actual
model class. It all works fine, except for this kind of scenarios, where
I have my own implementation of List.
Can I add some interceptor or define somewhere in the xml's that during
the marshall/unmarshall if it encounter's List, use my implementation
instead.
Any sample code would be HIGHLY Appreciated.
Thanks in advance.
Best Regards,
Kuga
Re: Resolved: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
Cool. I added it to our articles page:
http://cxf.apache.org/resources-and-articles.html.
It should appear in a few hours, once the site refreshes.
Glen
Arul Dhesiaseelan wrote:
>
> I blogged recently about configuring SSL for Jetty based CXF services
> using Java APIs here.
> http://aruld.info/programming-ssl-for-jetty-based-cxf-services/
>
> The sample is all Apache licensed. So, feel free to use.
>
> -Arul
>
> _____
>
> From: Arul Dhesiaseelan [mailto:arul@fluxcorp.com]
> To: users@cxf.apache.org
> Sent: Wed, 23 Jul 2008 13:40:25 -0600
> Subject: Re: CXF ssl sample using CXF APIs
>
> Glen,
>
> Created a JIRA report for this issue
> (https://issues.apache.org/jira/browse/CXF-1718).
>
> Thanks!
> Arul
>
> Glen Mazza wrote:
> > Good to hear. About the Java API issue, feel free to type up a JIRA
> report
> > on it. Attach this thread to it:
> > http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tt18570914.html
> >
> > Glen
> >
> >
> > Arul Dhesiaseelan wrote:
> >
> >> Glen,
> >>
> >> Thanks for all your help. I appreciate your inputs.
> >>
> >> I did a quick test using the spring-configs and embedded Jetty server
> >> (JaxWsServerFactoryBean). It worked like a charm. CXF uses Jetty SSL
> >> connector to support SSL (CXFJettySslSocketConnector).
> >>
> >> My only gut feeling says if embedded Jetty supports SSL using
> >> spring-config, it should support Java APIs as well.
> >>
> >> -Arul
> >>
> >> Glen Mazza wrote:
> >>
> >>> Actually, we may not be able to support SSL with embedded Jetty
> >>> anyway--look
> >>> at this thread, as well as a J2SE 6.0 based alternative solution:
> >>>
> >>>
> http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tt17761832.html
> >>>
> >>> HTH,
> >>> Glen
> >>>
> >>>
> >>> Glen Mazza wrote:
> >>>
> >>>
> >>>> While I hope others can help you with your problem, if you want to
> use
> >>>> SSL, I suspect you'd be better off with a standalone container[1]
> >>>> anyway--WAR file, web.xml, all that good stuff--this way at least
> you
> >>>> know
> >>>> what you're coding on top of. I just haven't researched SSL over
> >>>> embedded
> >>>> Jetty containers.
> >>>>
> >>>> Glen
> >>>>
> >>>> [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
> >>>>
> >>>>
> >>>> Arul Dhesiaseelan wrote:
> >>>>
> >>>>
> >>>>> Can someone look into this pls?
> >>>>>
> >>>>> I am close to making this work. But, figuring out what could be
> wrong
> >>>>> is
> >>>>> still a puzzle to me.
> >>>>>
> >>>>> Thank you,
> >>>>> Arul
> >>>>>
> >>>>> Arul Dhesiaseelan wrote:
> >>>>>
> >>>>>
> >>>>>> Hello,
> >>>>>>
> >>>>>> I did some debugging using CXF 2.1.1 sources. I see the problem
> in
> >>>>>> line 201 in
> JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
> >>>>>> where it makes a call to ref.finalizeConfig().
> >>>>>>
> >>>>>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
> >>>>>> retrieveListenerFactory(). In this method the
> "tlsServerParameters" is
> >>>>>> null so the protocol is defaulted to "http" and finally throws
> the
> >>>>>> exception.
> >>>>>>
> >>>>>> This tells me that I am not correctly setting the
> TLSServerParameters
> >>>>>> to the JettyHTTPServerEngine in my code in the correct order. Or,
> I am
> >>>>>> not creating the JettyHTTPServerEngine instance properly.
> >>>>>>
> >>>>>> Does some one help me if I am missing something here?
> >>>>>>
> >>>>>> Appreciate your help.
> >>>>>>
> >>>>>> -Arul
> >>>>>>
> >>>>>> Arul Dhesiaseelan wrote:
> >>>>>>
> >>>>>>
> >>>>>>> Hello,
> >>>>>>>
> >>>>>>> I was trying to use CXF APIs to configure SSL on the service.
> But, I
> >>>>>>> am getting an illegal state exception: Port 9001 is configured
> with
> >>>>>>> wrong protocol "http" for "https://localhost:9001/hello"
> >>>>>>>
> >>>>>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
> >>>>>>> sf.setServiceClass(HelloWorld.class);
> >>>>>>> sf.getServiceFactory().setWrapped(true);
> >>>>>>>
> >>>>>>> QName name = new QName("http://test.com", "ws", "");
> >>>>>>> sf.setServiceName(name);
> >>>>>>> sf.setAddress("https://localhost:9001/hello");
> >>>>>>>
> >>>>>>> HelloWorld helloService = new HelloWorldImpl();
> >>>>>>>
> >>>>>>> sf.getServiceFactory().setInvoker(new
> BeanInvoker(helloService));
> >>>>>>> //org.apache.cxf.endpoint.Server server = sf.create();
> >>>>>>>
> >>>>>>> JettyHTTPServerEngineFactory factory =
> >>>>>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
> >>>>>>>
> >>>>>>> TLSServerParameters tlsParams = new TLSServerParameters();
> >>>>>>> JettyHTTPServerEngine engine = null;
> >>>>>>> try {
> >>>>>>> engine = factory.createJettyHTTPServerEngine(9001,
> "https");
> >>>>>>> KeyStore keyStore = KeyStore.getInstance("JKS");
> >>>>>>> String trustpass = "password";
> >>>>>>> File truststore = new
> >>>>>>>
> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
> >>>>>>>
> >>>>>>> keyStore.load(new FileInputStream(truststore),
> >>>>>>> trustpass.toCharArray());
> >>>>>>> KeyManagerFactory keyFactory =
> >>>>>>>
> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
> >>>>>>> keyFactory.init(keyStore, trustpass.toCharArray());
> >>>>>>> KeyManager[] km = keyFactory.getKeyManagers();
> >>>>>>> tlsParams.setKeyManagers(km);
> >>>>>>>
> >>>>>>> truststore = new
> >>>>>>>
> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
> >>>>>>>
> >>>>>>> keyStore.load(new FileInputStream(truststore),
> >>>>>>> trustpass.toCharArray());
> >>>>>>> TrustManagerFactory trustFactory =
> >>>>>>>
> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
> >>>>>>>
> >>>>>>> trustFactory.init(keyStore);
> >>>>>>> TrustManager[] tm = trustFactory.getTrustManagers();
> >>>>>>> tlsParams.setTrustManagers(tm);
> >>>>>>> FiltersType filter = new FiltersType();
> >>>>>>> filter.getInclude().add(".*_EXPORT_.*");
> >>>>>>> filter.getInclude().add(".*_EXPORT1024_.*");
> >>>>>>> filter.getInclude().add(".*_WITH_DES_.*");
> >>>>>>> filter.getInclude().add(".*_WITH_NULL_.*");
> >>>>>>> filter.getExclude().add(".*_DH_anon_.*");
> >>>>>>> tlsParams.setCipherSuitesFilter(filter);
> >>>>>>> ClientAuthentication ca = new ClientAuthentication();
> >>>>>>> ca.setRequired(true);
> >>>>>>> ca.setWant(true);
> >>>>>>> tlsParams.setClientAuthentication(ca);
> >>>>>>> tlsParams.setSecureSocketProtocol("SSL");
> >>>>>>> if (engine != null) {
> >>>>>>> engine.setTlsServerParameters(tlsParams);
> >>>>>>> }
> >>>>>>> } catch (KeyStoreException kse) {
> >>>>>>> } catch (NoSuchAlgorithmException nsa) {
> >>>>>>> } catch (FileNotFoundException fnfe) {
> >>>>>>> } catch (UnrecoverableKeyException uke) {
> >>>>>>> } catch (CertificateException ce) {
> >>>>>>> } catch (GeneralSecurityException gse) {
> >>>>>>> } catch (IOException ioe) {
> >>>>>>> }
> >>>>>>>
> >>>>>>> List<JettyHTTPServerEngine> engines = new
> >>>>>>> ArrayList<JettyHTTPServerEngine>();
> >>>>>>> if (engine != null)
> >>>>>>> engines.add(engine);
> >>>>>>> factory.setEnginesList(engines);
> >>>>>>> org.apache.cxf.endpoint.Server server = sf.create();
> >>>>>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
> >>>>>>>
> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
> >>>>>>>
> >>>>>>>
> >>>>>>> String endpoint =
> >>>>>>> server.getEndpoint().getEndpointInfo().getAddress();
> >>>>>>> System.out.println("Server started at " + endpoint);
> >>>>>>>
> >>>>>>>
> >>>>>>> But when I start the service, I get the below error:
> >>>>>>>
> >>>>>>> Jul 21, 2008 9:15:10 AM
> >>>>>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> >>>>>>> buildServiceFromClass
> >>>>>>> INFO: Creating Service {http://test.com}ws from class
> >>>>>>> com.test.cxf.HelloWorld
> >>>>>>> Exception in thread "main" java.lang.IllegalStateException: Port
> 9001
> >>>>>>> is configured with wrong protocol "http" for
> >>>>>>> "https://localhost:9001/hello"
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
> >>>>>>> at
> org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
> >>>>>>>
> >>>>>>> at com.test.cxf.Server.main(Server.java:104)
> >>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
> >>>>>>> at
> >>>>>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> >>>>>>>
> >>>>>>> at
> >>>>>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> >>>>>>>
> >>>>>>> at java.lang.reflect.Method.invoke(Method.java:585)
> >>>>>>> at
> >>>>>>>
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> >>>>>>>
> >>>>>>>
> >>>>>>> Any thoughts on this issue?
> >>>>>>>
> >>>>>>> Thank you,
> >>>>>>> -Arul
> >>>>>>>
> >>>>>>>
> >>>>>>> ______________________________
> >>>>>>>
> >>>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
>
>
> ________________________________
> Scanned by MessageLabs for Flux
> ________________________________
>
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18671409.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF ssl sample using CXF APIs
Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
Glen,
Created a JIRA report for this issue
(https://issues.apache.org/jira/browse/CXF-1718).
Thanks!
Arul
Glen Mazza wrote:
> Good to hear. About the Java API issue, feel free to type up a JIRA report
> on it. Attach this thread to it:
> http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tt18570914.html
>
> Glen
>
>
> Arul Dhesiaseelan wrote:
>
>> Glen,
>>
>> Thanks for all your help. I appreciate your inputs.
>>
>> I did a quick test using the spring-configs and embedded Jetty server
>> (JaxWsServerFactoryBean). It worked like a charm. CXF uses Jetty SSL
>> connector to support SSL (CXFJettySslSocketConnector).
>>
>> My only gut feeling says if embedded Jetty supports SSL using
>> spring-config, it should support Java APIs as well.
>>
>> -Arul
>>
>> Glen Mazza wrote:
>>
>>> Actually, we may not be able to support SSL with embedded Jetty
>>> anyway--look
>>> at this thread, as well as a J2SE 6.0 based alternative solution:
>>>
>>> http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tt17761832.html
>>>
>>> HTH,
>>> Glen
>>>
>>>
>>> Glen Mazza wrote:
>>>
>>>
>>>> While I hope others can help you with your problem, if you want to use
>>>> SSL, I suspect you'd be better off with a standalone container[1]
>>>> anyway--WAR file, web.xml, all that good stuff--this way at least you
>>>> know
>>>> what you're coding on top of. I just haven't researched SSL over
>>>> embedded
>>>> Jetty containers.
>>>>
>>>> Glen
>>>>
>>>> [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
>>>>
>>>>
>>>> Arul Dhesiaseelan wrote:
>>>>
>>>>
>>>>> Can someone look into this pls?
>>>>>
>>>>> I am close to making this work. But, figuring out what could be wrong
>>>>> is
>>>>> still a puzzle to me.
>>>>>
>>>>> Thank you,
>>>>> Arul
>>>>>
>>>>> Arul Dhesiaseelan wrote:
>>>>>
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I did some debugging using CXF 2.1.1 sources. I see the problem in
>>>>>> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
>>>>>> where it makes a call to ref.finalizeConfig().
>>>>>>
>>>>>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
>>>>>> retrieveListenerFactory(). In this method the "tlsServerParameters" is
>>>>>> null so the protocol is defaulted to "http" and finally throws the
>>>>>> exception.
>>>>>>
>>>>>> This tells me that I am not correctly setting the TLSServerParameters
>>>>>> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
>>>>>> not creating the JettyHTTPServerEngine instance properly.
>>>>>>
>>>>>> Does some one help me if I am missing something here?
>>>>>>
>>>>>> Appreciate your help.
>>>>>>
>>>>>> -Arul
>>>>>>
>>>>>> Arul Dhesiaseelan wrote:
>>>>>>
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I was trying to use CXF APIs to configure SSL on the service. But, I
>>>>>>> am getting an illegal state exception: Port 9001 is configured with
>>>>>>> wrong protocol "http" for "https://localhost:9001/hello"
>>>>>>>
>>>>>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>>>>>>> sf.setServiceClass(HelloWorld.class);
>>>>>>> sf.getServiceFactory().setWrapped(true);
>>>>>>>
>>>>>>> QName name = new QName("http://test.com", "ws", "");
>>>>>>> sf.setServiceName(name);
>>>>>>> sf.setAddress("https://localhost:9001/hello");
>>>>>>>
>>>>>>> HelloWorld helloService = new HelloWorldImpl();
>>>>>>>
>>>>>>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>>>>>>> //org.apache.cxf.endpoint.Server server = sf.create();
>>>>>>>
>>>>>>> JettyHTTPServerEngineFactory factory =
>>>>>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>>>>>>
>>>>>>> TLSServerParameters tlsParams = new TLSServerParameters();
>>>>>>> JettyHTTPServerEngine engine = null;
>>>>>>> try {
>>>>>>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>>>>>>> KeyStore keyStore = KeyStore.getInstance("JKS");
>>>>>>> String trustpass = "password";
>>>>>>> File truststore = new
>>>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>>>>>>
>>>>>>> keyStore.load(new FileInputStream(truststore),
>>>>>>> trustpass.toCharArray());
>>>>>>> KeyManagerFactory keyFactory =
>>>>>>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>>>>>>> keyFactory.init(keyStore, trustpass.toCharArray());
>>>>>>> KeyManager[] km = keyFactory.getKeyManagers();
>>>>>>> tlsParams.setKeyManagers(km);
>>>>>>>
>>>>>>> truststore = new
>>>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>>>>>>
>>>>>>> keyStore.load(new FileInputStream(truststore),
>>>>>>> trustpass.toCharArray());
>>>>>>> TrustManagerFactory trustFactory =
>>>>>>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>>>>>>
>>>>>>> trustFactory.init(keyStore);
>>>>>>> TrustManager[] tm = trustFactory.getTrustManagers();
>>>>>>> tlsParams.setTrustManagers(tm);
>>>>>>> FiltersType filter = new FiltersType();
>>>>>>> filter.getInclude().add(".*_EXPORT_.*");
>>>>>>> filter.getInclude().add(".*_EXPORT1024_.*");
>>>>>>> filter.getInclude().add(".*_WITH_DES_.*");
>>>>>>> filter.getInclude().add(".*_WITH_NULL_.*");
>>>>>>> filter.getExclude().add(".*_DH_anon_.*");
>>>>>>> tlsParams.setCipherSuitesFilter(filter);
>>>>>>> ClientAuthentication ca = new ClientAuthentication();
>>>>>>> ca.setRequired(true);
>>>>>>> ca.setWant(true);
>>>>>>> tlsParams.setClientAuthentication(ca);
>>>>>>> tlsParams.setSecureSocketProtocol("SSL");
>>>>>>> if (engine != null) {
>>>>>>> engine.setTlsServerParameters(tlsParams);
>>>>>>> }
>>>>>>> } catch (KeyStoreException kse) {
>>>>>>> } catch (NoSuchAlgorithmException nsa) {
>>>>>>> } catch (FileNotFoundException fnfe) {
>>>>>>> } catch (UnrecoverableKeyException uke) {
>>>>>>> } catch (CertificateException ce) {
>>>>>>> } catch (GeneralSecurityException gse) {
>>>>>>> } catch (IOException ioe) {
>>>>>>> }
>>>>>>>
>>>>>>> List<JettyHTTPServerEngine> engines = new
>>>>>>> ArrayList<JettyHTTPServerEngine>();
>>>>>>> if (engine != null)
>>>>>>> engines.add(engine);
>>>>>>> factory.setEnginesList(engines);
>>>>>>> org.apache.cxf.endpoint.Server server = sf.create();
>>>>>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>>>>>>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>>>>>>
>>>>>>>
>>>>>>> String endpoint =
>>>>>>> server.getEndpoint().getEndpointInfo().getAddress();
>>>>>>> System.out.println("Server started at " + endpoint);
>>>>>>>
>>>>>>>
>>>>>>> But when I start the service, I get the below error:
>>>>>>>
>>>>>>> Jul 21, 2008 9:15:10 AM
>>>>>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>>>>>> buildServiceFromClass
>>>>>>> INFO: Creating Service {http://test.com}ws from class
>>>>>>> com.test.cxf.HelloWorld
>>>>>>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>>>>>>> is configured with wrong protocol "http" for
>>>>>>> "https://localhost:9001/hello"
>>>>>>> at
>>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>>>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>>>>>> at
>>>>>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>>>>>>
>>>>>>> at
>>>>>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>>>>>>
>>>>>>> at com.test.cxf.Server.main(Server.java:104)
>>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>>> at
>>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>>
>>>>>>> at
>>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>>
>>>>>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>>>>> at
>>>>>>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>>>>>
>>>>>>>
>>>>>>> Any thoughts on this issue?
>>>>>>>
>>>>>>> Thank you,
>>>>>>> -Arul
>>>>>>>
>>>>>>>
>>>>>>> ______________________________
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Re: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
Good to hear. About the Java API issue, feel free to type up a JIRA report
on it. Attach this thread to it:
http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tt18570914.html
Glen
Arul Dhesiaseelan wrote:
>
> Glen,
>
> Thanks for all your help. I appreciate your inputs.
>
> I did a quick test using the spring-configs and embedded Jetty server
> (JaxWsServerFactoryBean). It worked like a charm. CXF uses Jetty SSL
> connector to support SSL (CXFJettySslSocketConnector).
>
> My only gut feeling says if embedded Jetty supports SSL using
> spring-config, it should support Java APIs as well.
>
> -Arul
>
> Glen Mazza wrote:
>> Actually, we may not be able to support SSL with embedded Jetty
>> anyway--look
>> at this thread, as well as a J2SE 6.0 based alternative solution:
>>
>> http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tt17761832.html
>>
>> HTH,
>> Glen
>>
>>
>> Glen Mazza wrote:
>>
>>> While I hope others can help you with your problem, if you want to use
>>> SSL, I suspect you'd be better off with a standalone container[1]
>>> anyway--WAR file, web.xml, all that good stuff--this way at least you
>>> know
>>> what you're coding on top of. I just haven't researched SSL over
>>> embedded
>>> Jetty containers.
>>>
>>> Glen
>>>
>>> [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
>>>
>>>
>>> Arul Dhesiaseelan wrote:
>>>
>>>> Can someone look into this pls?
>>>>
>>>> I am close to making this work. But, figuring out what could be wrong
>>>> is
>>>> still a puzzle to me.
>>>>
>>>> Thank you,
>>>> Arul
>>>>
>>>> Arul Dhesiaseelan wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I did some debugging using CXF 2.1.1 sources. I see the problem in
>>>>> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
>>>>> where it makes a call to ref.finalizeConfig().
>>>>>
>>>>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
>>>>> retrieveListenerFactory(). In this method the "tlsServerParameters" is
>>>>> null so the protocol is defaulted to "http" and finally throws the
>>>>> exception.
>>>>>
>>>>> This tells me that I am not correctly setting the TLSServerParameters
>>>>> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
>>>>> not creating the JettyHTTPServerEngine instance properly.
>>>>>
>>>>> Does some one help me if I am missing something here?
>>>>>
>>>>> Appreciate your help.
>>>>>
>>>>> -Arul
>>>>>
>>>>> Arul Dhesiaseelan wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I was trying to use CXF APIs to configure SSL on the service. But, I
>>>>>> am getting an illegal state exception: Port 9001 is configured with
>>>>>> wrong protocol "http" for "https://localhost:9001/hello"
>>>>>>
>>>>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>>>>>> sf.setServiceClass(HelloWorld.class);
>>>>>> sf.getServiceFactory().setWrapped(true);
>>>>>>
>>>>>> QName name = new QName("http://test.com", "ws", "");
>>>>>> sf.setServiceName(name);
>>>>>> sf.setAddress("https://localhost:9001/hello");
>>>>>>
>>>>>> HelloWorld helloService = new HelloWorldImpl();
>>>>>>
>>>>>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>>>>>> //org.apache.cxf.endpoint.Server server = sf.create();
>>>>>>
>>>>>> JettyHTTPServerEngineFactory factory =
>>>>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>>>>>
>>>>>> TLSServerParameters tlsParams = new TLSServerParameters();
>>>>>> JettyHTTPServerEngine engine = null;
>>>>>> try {
>>>>>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>>>>>> KeyStore keyStore = KeyStore.getInstance("JKS");
>>>>>> String trustpass = "password";
>>>>>> File truststore = new
>>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>>>>>
>>>>>> keyStore.load(new FileInputStream(truststore),
>>>>>> trustpass.toCharArray());
>>>>>> KeyManagerFactory keyFactory =
>>>>>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>>>>>> keyFactory.init(keyStore, trustpass.toCharArray());
>>>>>> KeyManager[] km = keyFactory.getKeyManagers();
>>>>>> tlsParams.setKeyManagers(km);
>>>>>>
>>>>>> truststore = new
>>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>>>>>
>>>>>> keyStore.load(new FileInputStream(truststore),
>>>>>> trustpass.toCharArray());
>>>>>> TrustManagerFactory trustFactory =
>>>>>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>>>>>
>>>>>> trustFactory.init(keyStore);
>>>>>> TrustManager[] tm = trustFactory.getTrustManagers();
>>>>>> tlsParams.setTrustManagers(tm);
>>>>>> FiltersType filter = new FiltersType();
>>>>>> filter.getInclude().add(".*_EXPORT_.*");
>>>>>> filter.getInclude().add(".*_EXPORT1024_.*");
>>>>>> filter.getInclude().add(".*_WITH_DES_.*");
>>>>>> filter.getInclude().add(".*_WITH_NULL_.*");
>>>>>> filter.getExclude().add(".*_DH_anon_.*");
>>>>>> tlsParams.setCipherSuitesFilter(filter);
>>>>>> ClientAuthentication ca = new ClientAuthentication();
>>>>>> ca.setRequired(true);
>>>>>> ca.setWant(true);
>>>>>> tlsParams.setClientAuthentication(ca);
>>>>>> tlsParams.setSecureSocketProtocol("SSL");
>>>>>> if (engine != null) {
>>>>>> engine.setTlsServerParameters(tlsParams);
>>>>>> }
>>>>>> } catch (KeyStoreException kse) {
>>>>>> } catch (NoSuchAlgorithmException nsa) {
>>>>>> } catch (FileNotFoundException fnfe) {
>>>>>> } catch (UnrecoverableKeyException uke) {
>>>>>> } catch (CertificateException ce) {
>>>>>> } catch (GeneralSecurityException gse) {
>>>>>> } catch (IOException ioe) {
>>>>>> }
>>>>>>
>>>>>> List<JettyHTTPServerEngine> engines = new
>>>>>> ArrayList<JettyHTTPServerEngine>();
>>>>>> if (engine != null)
>>>>>> engines.add(engine);
>>>>>> factory.setEnginesList(engines);
>>>>>> org.apache.cxf.endpoint.Server server = sf.create();
>>>>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>>>>>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>>>>>
>>>>>>
>>>>>> String endpoint =
>>>>>> server.getEndpoint().getEndpointInfo().getAddress();
>>>>>> System.out.println("Server started at " + endpoint);
>>>>>>
>>>>>>
>>>>>> But when I start the service, I get the below error:
>>>>>>
>>>>>> Jul 21, 2008 9:15:10 AM
>>>>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>>>>> buildServiceFromClass
>>>>>> INFO: Creating Service {http://test.com}ws from class
>>>>>> com.test.cxf.HelloWorld
>>>>>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>>>>>> is configured with wrong protocol "http" for
>>>>>> "https://localhost:9001/hello"
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>>>>>
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>>>>>
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>>>>>
>>>>>> at
>>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>>>>>
>>>>>> at
>>>>>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>>>>> at
>>>>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>>>>>
>>>>>> at
>>>>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>>>>>
>>>>>> at com.test.cxf.Server.main(Server.java:104)
>>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>> at
>>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>>
>>>>>> at
>>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>>
>>>>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>>>> at
>>>>>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>>>>
>>>>>>
>>>>>> Any thoughts on this issue?
>>>>>>
>>>>>> Thank you,
>>>>>> -Arul
>>>>>>
>>>>>>
>>>>>> ______________________________
>>>>>>
>>>>
>>>>
>>>
>>
>>
>
>
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18594995.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF ssl sample using CXF APIs
Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
Glen,
Thanks for all your help. I appreciate your inputs.
I did a quick test using the spring-configs and embedded Jetty server
(JaxWsServerFactoryBean). It worked like a charm. CXF uses Jetty SSL
connector to support SSL (CXFJettySslSocketConnector).
My only gut feeling says if embedded Jetty supports SSL using
spring-config, it should support Java APIs as well.
-Arul
Glen Mazza wrote:
> Actually, we may not be able to support SSL with embedded Jetty anyway--look
> at this thread, as well as a J2SE 6.0 based alternative solution:
>
> http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tt17761832.html
>
> HTH,
> Glen
>
>
> Glen Mazza wrote:
>
>> While I hope others can help you with your problem, if you want to use
>> SSL, I suspect you'd be better off with a standalone container[1]
>> anyway--WAR file, web.xml, all that good stuff--this way at least you know
>> what you're coding on top of. I just haven't researched SSL over embedded
>> Jetty containers.
>>
>> Glen
>>
>> [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
>>
>>
>> Arul Dhesiaseelan wrote:
>>
>>> Can someone look into this pls?
>>>
>>> I am close to making this work. But, figuring out what could be wrong is
>>> still a puzzle to me.
>>>
>>> Thank you,
>>> Arul
>>>
>>> Arul Dhesiaseelan wrote:
>>>
>>>> Hello,
>>>>
>>>> I did some debugging using CXF 2.1.1 sources. I see the problem in
>>>> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
>>>> where it makes a call to ref.finalizeConfig().
>>>>
>>>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
>>>> retrieveListenerFactory(). In this method the "tlsServerParameters" is
>>>> null so the protocol is defaulted to "http" and finally throws the
>>>> exception.
>>>>
>>>> This tells me that I am not correctly setting the TLSServerParameters
>>>> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
>>>> not creating the JettyHTTPServerEngine instance properly.
>>>>
>>>> Does some one help me if I am missing something here?
>>>>
>>>> Appreciate your help.
>>>>
>>>> -Arul
>>>>
>>>> Arul Dhesiaseelan wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I was trying to use CXF APIs to configure SSL on the service. But, I
>>>>> am getting an illegal state exception: Port 9001 is configured with
>>>>> wrong protocol "http" for "https://localhost:9001/hello"
>>>>>
>>>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>>>>> sf.setServiceClass(HelloWorld.class);
>>>>> sf.getServiceFactory().setWrapped(true);
>>>>>
>>>>> QName name = new QName("http://test.com", "ws", "");
>>>>> sf.setServiceName(name);
>>>>> sf.setAddress("https://localhost:9001/hello");
>>>>>
>>>>> HelloWorld helloService = new HelloWorldImpl();
>>>>>
>>>>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>>>>> //org.apache.cxf.endpoint.Server server = sf.create();
>>>>>
>>>>> JettyHTTPServerEngineFactory factory =
>>>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>>>>
>>>>> TLSServerParameters tlsParams = new TLSServerParameters();
>>>>> JettyHTTPServerEngine engine = null;
>>>>> try {
>>>>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>>>>> KeyStore keyStore = KeyStore.getInstance("JKS");
>>>>> String trustpass = "password";
>>>>> File truststore = new
>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>>>>
>>>>> keyStore.load(new FileInputStream(truststore),
>>>>> trustpass.toCharArray());
>>>>> KeyManagerFactory keyFactory =
>>>>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>>>>> keyFactory.init(keyStore, trustpass.toCharArray());
>>>>> KeyManager[] km = keyFactory.getKeyManagers();
>>>>> tlsParams.setKeyManagers(km);
>>>>>
>>>>> truststore = new
>>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>>>>
>>>>> keyStore.load(new FileInputStream(truststore),
>>>>> trustpass.toCharArray());
>>>>> TrustManagerFactory trustFactory =
>>>>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>>>>
>>>>> trustFactory.init(keyStore);
>>>>> TrustManager[] tm = trustFactory.getTrustManagers();
>>>>> tlsParams.setTrustManagers(tm);
>>>>> FiltersType filter = new FiltersType();
>>>>> filter.getInclude().add(".*_EXPORT_.*");
>>>>> filter.getInclude().add(".*_EXPORT1024_.*");
>>>>> filter.getInclude().add(".*_WITH_DES_.*");
>>>>> filter.getInclude().add(".*_WITH_NULL_.*");
>>>>> filter.getExclude().add(".*_DH_anon_.*");
>>>>> tlsParams.setCipherSuitesFilter(filter);
>>>>> ClientAuthentication ca = new ClientAuthentication();
>>>>> ca.setRequired(true);
>>>>> ca.setWant(true);
>>>>> tlsParams.setClientAuthentication(ca);
>>>>> tlsParams.setSecureSocketProtocol("SSL");
>>>>> if (engine != null) {
>>>>> engine.setTlsServerParameters(tlsParams);
>>>>> }
>>>>> } catch (KeyStoreException kse) {
>>>>> } catch (NoSuchAlgorithmException nsa) {
>>>>> } catch (FileNotFoundException fnfe) {
>>>>> } catch (UnrecoverableKeyException uke) {
>>>>> } catch (CertificateException ce) {
>>>>> } catch (GeneralSecurityException gse) {
>>>>> } catch (IOException ioe) {
>>>>> }
>>>>>
>>>>> List<JettyHTTPServerEngine> engines = new
>>>>> ArrayList<JettyHTTPServerEngine>();
>>>>> if (engine != null)
>>>>> engines.add(engine);
>>>>> factory.setEnginesList(engines);
>>>>> org.apache.cxf.endpoint.Server server = sf.create();
>>>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>>>>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>>>>
>>>>>
>>>>> String endpoint =
>>>>> server.getEndpoint().getEndpointInfo().getAddress();
>>>>> System.out.println("Server started at " + endpoint);
>>>>>
>>>>>
>>>>> But when I start the service, I get the below error:
>>>>>
>>>>> Jul 21, 2008 9:15:10 AM
>>>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>>>> buildServiceFromClass
>>>>> INFO: Creating Service {http://test.com}ws from class
>>>>> com.test.cxf.HelloWorld
>>>>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>>>>> is configured with wrong protocol "http" for
>>>>> "https://localhost:9001/hello"
>>>>> at
>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>>>>
>>>>> at
>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>>>>
>>>>> at
>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>>>>
>>>>> at
>>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>>>>
>>>>> at
>>>>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>>>> at
>>>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>>>>
>>>>> at
>>>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>>>>
>>>>> at com.test.cxf.Server.main(Server.java:104)
>>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>> at
>>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>>
>>>>> at
>>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>>
>>>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>>> at
>>>>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>>>
>>>>>
>>>>> Any thoughts on this issue?
>>>>>
>>>>> Thank you,
>>>>> -Arul
>>>>>
>>>>>
>>>>> ______________________________
>>>>>
>>>
>>>
>>
>
>
Re: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
Actually, we may not be able to support SSL with embedded Jetty anyway--look
at this thread, as well as a J2SE 6.0 based alternative solution:
http://www.nabble.com/Help-needed-for-SSL-and-Basic-authentication-tt17761832.html
HTH,
Glen
Glen Mazza wrote:
>
> While I hope others can help you with your problem, if you want to use
> SSL, I suspect you'd be better off with a standalone container[1]
> anyway--WAR file, web.xml, all that good stuff--this way at least you know
> what you're coding on top of. I just haven't researched SSL over embedded
> Jetty containers.
>
> Glen
>
> [1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
>
>
> Arul Dhesiaseelan wrote:
>>
>> Can someone look into this pls?
>>
>> I am close to making this work. But, figuring out what could be wrong is
>> still a puzzle to me.
>>
>> Thank you,
>> Arul
>>
>> Arul Dhesiaseelan wrote:
>>> Hello,
>>>
>>> I did some debugging using CXF 2.1.1 sources. I see the problem in
>>> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
>>> where it makes a call to ref.finalizeConfig().
>>>
>>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
>>> retrieveListenerFactory(). In this method the "tlsServerParameters" is
>>> null so the protocol is defaulted to "http" and finally throws the
>>> exception.
>>>
>>> This tells me that I am not correctly setting the TLSServerParameters
>>> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
>>> not creating the JettyHTTPServerEngine instance properly.
>>>
>>> Does some one help me if I am missing something here?
>>>
>>> Appreciate your help.
>>>
>>> -Arul
>>>
>>> Arul Dhesiaseelan wrote:
>>>> Hello,
>>>>
>>>> I was trying to use CXF APIs to configure SSL on the service. But, I
>>>> am getting an illegal state exception: Port 9001 is configured with
>>>> wrong protocol "http" for "https://localhost:9001/hello"
>>>>
>>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>>>> sf.setServiceClass(HelloWorld.class);
>>>> sf.getServiceFactory().setWrapped(true);
>>>>
>>>> QName name = new QName("http://test.com", "ws", "");
>>>> sf.setServiceName(name);
>>>> sf.setAddress("https://localhost:9001/hello");
>>>>
>>>> HelloWorld helloService = new HelloWorldImpl();
>>>>
>>>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>>>> //org.apache.cxf.endpoint.Server server = sf.create();
>>>>
>>>> JettyHTTPServerEngineFactory factory =
>>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>>>
>>>> TLSServerParameters tlsParams = new TLSServerParameters();
>>>> JettyHTTPServerEngine engine = null;
>>>> try {
>>>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>>>> KeyStore keyStore = KeyStore.getInstance("JKS");
>>>> String trustpass = "password";
>>>> File truststore = new
>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>>>
>>>> keyStore.load(new FileInputStream(truststore),
>>>> trustpass.toCharArray());
>>>> KeyManagerFactory keyFactory =
>>>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>>>> keyFactory.init(keyStore, trustpass.toCharArray());
>>>> KeyManager[] km = keyFactory.getKeyManagers();
>>>> tlsParams.setKeyManagers(km);
>>>>
>>>> truststore = new
>>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>>>
>>>> keyStore.load(new FileInputStream(truststore),
>>>> trustpass.toCharArray());
>>>> TrustManagerFactory trustFactory =
>>>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>>>
>>>> trustFactory.init(keyStore);
>>>> TrustManager[] tm = trustFactory.getTrustManagers();
>>>> tlsParams.setTrustManagers(tm);
>>>> FiltersType filter = new FiltersType();
>>>> filter.getInclude().add(".*_EXPORT_.*");
>>>> filter.getInclude().add(".*_EXPORT1024_.*");
>>>> filter.getInclude().add(".*_WITH_DES_.*");
>>>> filter.getInclude().add(".*_WITH_NULL_.*");
>>>> filter.getExclude().add(".*_DH_anon_.*");
>>>> tlsParams.setCipherSuitesFilter(filter);
>>>> ClientAuthentication ca = new ClientAuthentication();
>>>> ca.setRequired(true);
>>>> ca.setWant(true);
>>>> tlsParams.setClientAuthentication(ca);
>>>> tlsParams.setSecureSocketProtocol("SSL");
>>>> if (engine != null) {
>>>> engine.setTlsServerParameters(tlsParams);
>>>> }
>>>> } catch (KeyStoreException kse) {
>>>> } catch (NoSuchAlgorithmException nsa) {
>>>> } catch (FileNotFoundException fnfe) {
>>>> } catch (UnrecoverableKeyException uke) {
>>>> } catch (CertificateException ce) {
>>>> } catch (GeneralSecurityException gse) {
>>>> } catch (IOException ioe) {
>>>> }
>>>>
>>>> List<JettyHTTPServerEngine> engines = new
>>>> ArrayList<JettyHTTPServerEngine>();
>>>> if (engine != null)
>>>> engines.add(engine);
>>>> factory.setEnginesList(engines);
>>>> org.apache.cxf.endpoint.Server server = sf.create();
>>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>>>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>>>
>>>>
>>>> String endpoint =
>>>> server.getEndpoint().getEndpointInfo().getAddress();
>>>> System.out.println("Server started at " + endpoint);
>>>>
>>>>
>>>> But when I start the service, I get the below error:
>>>>
>>>> Jul 21, 2008 9:15:10 AM
>>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>>> buildServiceFromClass
>>>> INFO: Creating Service {http://test.com}ws from class
>>>> com.test.cxf.HelloWorld
>>>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>>>> is configured with wrong protocol "http" for
>>>> "https://localhost:9001/hello"
>>>> at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>>>
>>>> at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>>>
>>>> at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>>>
>>>> at
>>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>>>
>>>> at
>>>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>>> at
>>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>>>
>>>> at
>>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>>>
>>>> at com.test.cxf.Server.main(Server.java:104)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>
>>>> at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>
>>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>>> at
>>>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>>
>>>>
>>>> Any thoughts on this issue?
>>>>
>>>> Thank you,
>>>> -Arul
>>>>
>>>>
>>>> ______________________________
>>>
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18592620.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
While I hope others can help you with your problem, if you want to use SSL, I
suspect you'd be better off with a standalone container[1] anyway--WAR file,
web.xml, all that good stuff--this way at least you know what you're coding
on top of. I just haven't researched SSL over embedded Jetty containers.
Glen
[1] http://www.jroller.com/gmazza/entry/setting_up_ssl_and_basic
Arul Dhesiaseelan wrote:
>
> Can someone look into this pls?
>
> I am close to making this work. But, figuring out what could be wrong is
> still a puzzle to me.
>
> Thank you,
> Arul
>
> Arul Dhesiaseelan wrote:
>> Hello,
>>
>> I did some debugging using CXF 2.1.1 sources. I see the problem in
>> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
>> where it makes a call to ref.finalizeConfig().
>>
>> In JettyHTTPServerEngine.finalizeConfig(), it calls method
>> retrieveListenerFactory(). In this method the "tlsServerParameters" is
>> null so the protocol is defaulted to "http" and finally throws the
>> exception.
>>
>> This tells me that I am not correctly setting the TLSServerParameters
>> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
>> not creating the JettyHTTPServerEngine instance properly.
>>
>> Does some one help me if I am missing something here?
>>
>> Appreciate your help.
>>
>> -Arul
>>
>> Arul Dhesiaseelan wrote:
>>> Hello,
>>>
>>> I was trying to use CXF APIs to configure SSL on the service. But, I
>>> am getting an illegal state exception: Port 9001 is configured with
>>> wrong protocol "http" for "https://localhost:9001/hello"
>>>
>>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>>> sf.setServiceClass(HelloWorld.class);
>>> sf.getServiceFactory().setWrapped(true);
>>>
>>> QName name = new QName("http://test.com", "ws", "");
>>> sf.setServiceName(name);
>>> sf.setAddress("https://localhost:9001/hello");
>>>
>>> HelloWorld helloService = new HelloWorldImpl();
>>>
>>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>>> //org.apache.cxf.endpoint.Server server = sf.create();
>>>
>>> JettyHTTPServerEngineFactory factory =
>>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>>
>>> TLSServerParameters tlsParams = new TLSServerParameters();
>>> JettyHTTPServerEngine engine = null;
>>> try {
>>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>>> KeyStore keyStore = KeyStore.getInstance("JKS");
>>> String trustpass = "password";
>>> File truststore = new
>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>>
>>> keyStore.load(new FileInputStream(truststore),
>>> trustpass.toCharArray());
>>> KeyManagerFactory keyFactory =
>>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>>> keyFactory.init(keyStore, trustpass.toCharArray());
>>> KeyManager[] km = keyFactory.getKeyManagers();
>>> tlsParams.setKeyManagers(km);
>>>
>>> truststore = new
>>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>>
>>> keyStore.load(new FileInputStream(truststore),
>>> trustpass.toCharArray());
>>> TrustManagerFactory trustFactory =
>>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>>
>>> trustFactory.init(keyStore);
>>> TrustManager[] tm = trustFactory.getTrustManagers();
>>> tlsParams.setTrustManagers(tm);
>>> FiltersType filter = new FiltersType();
>>> filter.getInclude().add(".*_EXPORT_.*");
>>> filter.getInclude().add(".*_EXPORT1024_.*");
>>> filter.getInclude().add(".*_WITH_DES_.*");
>>> filter.getInclude().add(".*_WITH_NULL_.*");
>>> filter.getExclude().add(".*_DH_anon_.*");
>>> tlsParams.setCipherSuitesFilter(filter);
>>> ClientAuthentication ca = new ClientAuthentication();
>>> ca.setRequired(true);
>>> ca.setWant(true);
>>> tlsParams.setClientAuthentication(ca);
>>> tlsParams.setSecureSocketProtocol("SSL");
>>> if (engine != null) {
>>> engine.setTlsServerParameters(tlsParams);
>>> }
>>> } catch (KeyStoreException kse) {
>>> } catch (NoSuchAlgorithmException nsa) {
>>> } catch (FileNotFoundException fnfe) {
>>> } catch (UnrecoverableKeyException uke) {
>>> } catch (CertificateException ce) {
>>> } catch (GeneralSecurityException gse) {
>>> } catch (IOException ioe) {
>>> }
>>>
>>> List<JettyHTTPServerEngine> engines = new
>>> ArrayList<JettyHTTPServerEngine>();
>>> if (engine != null)
>>> engines.add(engine);
>>> factory.setEnginesList(engines);
>>> org.apache.cxf.endpoint.Server server = sf.create();
>>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>>
>>>
>>> String endpoint =
>>> server.getEndpoint().getEndpointInfo().getAddress();
>>> System.out.println("Server started at " + endpoint);
>>>
>>>
>>> But when I start the service, I get the below error:
>>>
>>> Jul 21, 2008 9:15:10 AM
>>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>>> buildServiceFromClass
>>> INFO: Creating Service {http://test.com}ws from class
>>> com.test.cxf.HelloWorld
>>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>>> is configured with wrong protocol "http" for
>>> "https://localhost:9001/hello"
>>> at
>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>>
>>> at
>>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>>
>>> at
>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>>
>>> at
>>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>>
>>> at
>>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>>> at
>>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>>
>>> at
>>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>>
>>> at com.test.cxf.Server.main(Server.java:104)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>> at java.lang.reflect.Method.invoke(Method.java:585)
>>> at
>>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>>
>>>
>>> Any thoughts on this issue?
>>>
>>> Thank you,
>>> -Arul
>>>
>>>
>>> ______________________________
>>
>
>
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18592456.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF ssl sample using CXF APIs
Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
Can someone look into this pls?
I am close to making this work. But, figuring out what could be wrong is
still a puzzle to me.
Thank you,
Arul
Arul Dhesiaseelan wrote:
> Hello,
>
> I did some debugging using CXF 2.1.1 sources. I see the problem in
> line 201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine()
> where it makes a call to ref.finalizeConfig().
>
> In JettyHTTPServerEngine.finalizeConfig(), it calls method
> retrieveListenerFactory(). In this method the "tlsServerParameters" is
> null so the protocol is defaulted to "http" and finally throws the
> exception.
>
> This tells me that I am not correctly setting the TLSServerParameters
> to the JettyHTTPServerEngine in my code in the correct order. Or, I am
> not creating the JettyHTTPServerEngine instance properly.
>
> Does some one help me if I am missing something here?
>
> Appreciate your help.
>
> -Arul
>
> Arul Dhesiaseelan wrote:
>> Hello,
>>
>> I was trying to use CXF APIs to configure SSL on the service. But, I
>> am getting an illegal state exception: Port 9001 is configured with
>> wrong protocol "http" for "https://localhost:9001/hello"
>>
>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>> sf.setServiceClass(HelloWorld.class);
>> sf.getServiceFactory().setWrapped(true);
>>
>> QName name = new QName("http://test.com", "ws", "");
>> sf.setServiceName(name);
>> sf.setAddress("https://localhost:9001/hello");
>>
>> HelloWorld helloService = new HelloWorldImpl();
>>
>> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
>> //org.apache.cxf.endpoint.Server server = sf.create();
>>
>> JettyHTTPServerEngineFactory factory =
>> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>>
>> TLSServerParameters tlsParams = new TLSServerParameters();
>> JettyHTTPServerEngine engine = null;
>> try {
>> engine = factory.createJettyHTTPServerEngine(9001, "https");
>> KeyStore keyStore = KeyStore.getInstance("JKS");
>> String trustpass = "password";
>> File truststore = new
>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>>
>> keyStore.load(new FileInputStream(truststore),
>> trustpass.toCharArray());
>> KeyManagerFactory keyFactory =
>> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
>> keyFactory.init(keyStore, trustpass.toCharArray());
>> KeyManager[] km = keyFactory.getKeyManagers();
>> tlsParams.setKeyManagers(km);
>>
>> truststore = new
>> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>>
>> keyStore.load(new FileInputStream(truststore),
>> trustpass.toCharArray());
>> TrustManagerFactory trustFactory =
>> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>>
>> trustFactory.init(keyStore);
>> TrustManager[] tm = trustFactory.getTrustManagers();
>> tlsParams.setTrustManagers(tm);
>> FiltersType filter = new FiltersType();
>> filter.getInclude().add(".*_EXPORT_.*");
>> filter.getInclude().add(".*_EXPORT1024_.*");
>> filter.getInclude().add(".*_WITH_DES_.*");
>> filter.getInclude().add(".*_WITH_NULL_.*");
>> filter.getExclude().add(".*_DH_anon_.*");
>> tlsParams.setCipherSuitesFilter(filter);
>> ClientAuthentication ca = new ClientAuthentication();
>> ca.setRequired(true);
>> ca.setWant(true);
>> tlsParams.setClientAuthentication(ca);
>> tlsParams.setSecureSocketProtocol("SSL");
>> if (engine != null) {
>> engine.setTlsServerParameters(tlsParams);
>> }
>> } catch (KeyStoreException kse) {
>> } catch (NoSuchAlgorithmException nsa) {
>> } catch (FileNotFoundException fnfe) {
>> } catch (UnrecoverableKeyException uke) {
>> } catch (CertificateException ce) {
>> } catch (GeneralSecurityException gse) {
>> } catch (IOException ioe) {
>> }
>>
>> List<JettyHTTPServerEngine> engines = new
>> ArrayList<JettyHTTPServerEngine>();
>> if (engine != null)
>> engines.add(engine);
>> factory.setEnginesList(engines);
>> org.apache.cxf.endpoint.Server server = sf.create();
>> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
>> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>>
>>
>> String endpoint =
>> server.getEndpoint().getEndpointInfo().getAddress();
>> System.out.println("Server started at " + endpoint);
>>
>>
>> But when I start the service, I get the below error:
>>
>> Jul 21, 2008 9:15:10 AM
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
>> buildServiceFromClass
>> INFO: Creating Service {http://test.com}ws from class
>> com.test.cxf.HelloWorld
>> Exception in thread "main" java.lang.IllegalStateException: Port 9001
>> is configured with wrong protocol "http" for
>> "https://localhost:9001/hello"
>> at
>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>>
>> at
>> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>>
>> at
>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>>
>> at
>> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>>
>> at
>> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
>> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
>> at
>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>>
>> at
>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>>
>> at com.test.cxf.Server.main(Server.java:104)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>>
>>
>> Any thoughts on this issue?
>>
>> Thank you,
>> -Arul
>>
>>
>> ______________________________
>
Re: CXF ssl sample using CXF APIs
Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
Hello,
I did some debugging using CXF 2.1.1 sources. I see the problem in line
201 in JettyHTTPServerEngineFactory.createJettyHTTPServerEngine() where
it makes a call to ref.finalizeConfig().
In JettyHTTPServerEngine.finalizeConfig(), it calls method
retrieveListenerFactory(). In this method the "tlsServerParameters" is
null so the protocol is defaulted to "http" and finally throws the
exception.
This tells me that I am not correctly setting the TLSServerParameters to
the JettyHTTPServerEngine in my code in the correct order. Or, I am not
creating the JettyHTTPServerEngine instance properly.
Does some one help me if I am missing something here?
Appreciate your help.
-Arul
Arul Dhesiaseelan wrote:
> Hello,
>
> I was trying to use CXF APIs to configure SSL on the service. But, I
> am getting an illegal state exception: Port 9001 is configured with
> wrong protocol "http" for "https://localhost:9001/hello"
>
> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
> sf.setServiceClass(HelloWorld.class);
> sf.getServiceFactory().setWrapped(true);
>
> QName name = new QName("http://test.com", "ws", "");
> sf.setServiceName(name);
> sf.setAddress("https://localhost:9001/hello");
>
> HelloWorld helloService = new HelloWorldImpl();
>
> sf.getServiceFactory().setInvoker(new BeanInvoker(helloService));
> //org.apache.cxf.endpoint.Server server = sf.create();
>
> JettyHTTPServerEngineFactory factory =
> sf.getBus().getExtension(JettyHTTPServerEngineFactory.class);
>
> TLSServerParameters tlsParams = new TLSServerParameters();
> JettyHTTPServerEngine engine = null;
> try {
> engine = factory.createJettyHTTPServerEngine(9001, "https");
> KeyStore keyStore = KeyStore.getInstance("JKS");
> String trustpass = "password";
> File truststore = new
> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\cherry.jks");
>
> keyStore.load(new FileInputStream(truststore),
> trustpass.toCharArray());
> KeyManagerFactory keyFactory =
> KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
> keyFactory.init(keyStore, trustpass.toCharArray());
> KeyManager[] km = keyFactory.getKeyManagers();
> tlsParams.setKeyManagers(km);
>
> truststore = new
> File("C:\\apache-cxf-2.1.1\\samples\\wsdl_first_https\\certs\\truststore.jks");
>
> keyStore.load(new FileInputStream(truststore),
> trustpass.toCharArray());
> TrustManagerFactory trustFactory =
> TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
>
> trustFactory.init(keyStore);
> TrustManager[] tm = trustFactory.getTrustManagers();
> tlsParams.setTrustManagers(tm);
> FiltersType filter = new FiltersType();
> filter.getInclude().add(".*_EXPORT_.*");
> filter.getInclude().add(".*_EXPORT1024_.*");
> filter.getInclude().add(".*_WITH_DES_.*");
> filter.getInclude().add(".*_WITH_NULL_.*");
> filter.getExclude().add(".*_DH_anon_.*");
> tlsParams.setCipherSuitesFilter(filter);
> ClientAuthentication ca = new ClientAuthentication();
> ca.setRequired(true);
> ca.setWant(true);
> tlsParams.setClientAuthentication(ca);
> tlsParams.setSecureSocketProtocol("SSL");
> if (engine != null) {
> engine.setTlsServerParameters(tlsParams);
> }
> } catch (KeyStoreException kse) {
> } catch (NoSuchAlgorithmException nsa) {
> } catch (FileNotFoundException fnfe) {
> } catch (UnrecoverableKeyException uke) {
> } catch (CertificateException ce) {
> } catch (GeneralSecurityException gse) {
> } catch (IOException ioe) {
> }
>
> List<JettyHTTPServerEngine> engines = new
> ArrayList<JettyHTTPServerEngine>();
> if (engine != null)
> engines.add(engine);
> factory.setEnginesList(engines);
> org.apache.cxf.endpoint.Server server = sf.create();
> ((JettyHTTPServerEngine) ((JettyHTTPDestination)
> server.getDestination()).getEngine()).setJettyHTTPServerEngineFactory(factory);
>
>
> String endpoint = server.getEndpoint().getEndpointInfo().getAddress();
> System.out.println("Server started at " + endpoint);
>
>
> But when I start the service, I get the below error:
>
> Jul 21, 2008 9:15:10 AM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromClass
> INFO: Creating Service {http://test.com}ws from class
> com.test.cxf.HelloWorld
> Exception in thread "main" java.lang.IllegalStateException: Port 9001
> is configured with wrong protocol "http" for
> "https://localhost:9001/hello"
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.retrieveEngine(JettyHTTPDestination.java:115)
>
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPDestination.finalizeConfig(JettyHTTPDestination.java:134)
>
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:123)
>
> at
> org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:103)
>
> at
> org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
> at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:115)
>
> at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:164)
>
> at com.test.cxf.Server.main(Server.java:104)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:585)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
>
>
> Any thoughts on this issue?
>
> Thank you,
> -Arul
>
>
> ________________________________
> Scanned by MessageLabs for Flux
> ________________________________
Re: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
Sorry, I'm not sure.
Arul Dhesiaseelan wrote:
>
> Hi Glen,
>
> I am not using Spring in my service as all my web services are creating
> dynamically using JaxWsServerFactoryBean.
>
> Is it possible to use Spring configuration only for using SSL on the CXF
> service and do the service creation using CXF APIs (without spring
> config)?
>
> My HelloWorld interface just has single hello method. It does not refer
> to any WSDL.
>
> Thanks,
> Arul
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18575240.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: CXF ssl sample using CXF APIs
Posted by Arul Dhesiaseelan <ar...@fluxcorp.com>.
Hi Glen,
I am not using Spring in my service as all my web services are creating
dynamically using JaxWsServerFactoryBean.
Is it possible to use Spring configuration only for using SSL on the CXF
service and do the service creation using CXF APIs (without spring config)?
My HelloWorld interface just has single hello method. It does not refer
to any WSDL.
Thanks,
Arul
Glen Mazza wrote:
> Hi Arul--does that service class HelloWorld.class have a hardcoded WSDL URL
> in it that uses http:// instead of https:// ?
>
> CXF normally returns that error (perhaps its a bug) when you switch
> programmaticaly between http:// and https://. If you can modify your
> HelloWorld.class to have a hardcoded URL with the https:// protocol, that
> error message *might* go away.
>
> BTW, programmatic configuration as you're doing can be hard to read and
> maintain. CXF has the ability to do that via Spring configuration instead:
> http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html
>
> HTH,
> Glen
>
>
> Arul Dhesiaseelan wrote:
>
>> Hello,
>>
>> I was trying to use CXF APIs to configure SSL on the service. But, I am
>> getting an illegal state exception: Port 9001 is configured with wrong
>> protocol "http" for "https://localhost:9001/hello"
>>
>> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
>> sf.setServiceClass(HelloWorld.class);
>> sf.getServiceFactory().setWrapped(true);
>>
>> QName name = new QName("http://test.com", "ws", "");
>> sf.setServiceName(name);
>> sf.setAddress("https://localhost:9001/hello");
>>
>> HelloWorld helloService = new HelloWorldImpl();
>>
>>
>>
>
>
Re: CXF ssl sample using CXF APIs
Posted by Glen Mazza <gl...@gmail.com>.
Hi Arul--does that service class HelloWorld.class have a hardcoded WSDL URL
in it that uses http:// instead of https:// ?
CXF normally returns that error (perhaps its a bug) when you switch
programmaticaly between http:// and https://. If you can modify your
HelloWorld.class to have a hardcoded URL with the https:// protocol, that
error message *might* go away.
BTW, programmatic configuration as you're doing can be hard to read and
maintain. CXF has the ability to do that via Spring configuration instead:
http://cwiki.apache.org/CXF20DOC/client-http-transport-including-ssl-support.html
HTH,
Glen
Arul Dhesiaseelan wrote:
>
> Hello,
>
> I was trying to use CXF APIs to configure SSL on the service. But, I am
> getting an illegal state exception: Port 9001 is configured with wrong
> protocol "http" for "https://localhost:9001/hello"
>
> JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
> sf.setServiceClass(HelloWorld.class);
> sf.getServiceFactory().setWrapped(true);
>
> QName name = new QName("http://test.com", "ws", "");
> sf.setServiceName(name);
> sf.setAddress("https://localhost:9001/hello");
>
> HelloWorld helloService = new HelloWorldImpl();
>
>
--
View this message in context: http://www.nabble.com/CXF-ssl-sample-using-CXF-APIs-tp18570914p18573232.html
Sent from the cxf-user mailing list archive at Nabble.com.