Return to Jive Software

712 Views 9 Replies Last post: Nov 14, 2008 6:37 AM by Todd West RSS
Atul Kshatriya Novice 157 posts since
Jun 30, 2008
Currently Being Moderated

Nov 4, 2008 9:06 AM

error calling webservice over ssl

Hi,

We are attempting to make webservice calls using ssl (https) and getting the following error:

 

Caused by: org.apache.cxf.interceptor.Fault: Could not send Message.
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:48)
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:207)
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:254)
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:205)
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
... 67 more
Caused by: java.io.IOException: Illegal Protocol https for HTTP URLConnection Factory.
org.apache.cxf.transport.http.HttpURLConnectionFactoryImpl.createConnection(HttpURLConnectionFactoryImpl.java:44)
org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:474)
org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
... 72 more

 

If we change to http everything works fine. We are using Clearspace 2.0.3 (custom). Do we need to do anything specific for https? All the Clearspace webservice documentation (for version 2.0.x) has examples using https (see link below)

 

http://www.jivesoftware.com/builds/docs/clearspace/latest_2.0/ClearspaceWebServicesDevGuide.html#APIExamples

 

Your prompt response appreciated.

 

Thank you,

 

Atul

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
Nov 5, 2008 7:57 AM in response to: Atul Kshatriya
Re: error calling webservice over ssl

Hi Atul,

 

What code are you using that throws this error? Are you using the client Jars or did you generate your own client?

 

-Todd

aaronk@adaptiveplanning.com Novice 52 posts since
Jun 24, 2008
Currently Being Moderated
Nov 5, 2008 8:21 AM in response to: Todd West
Re: error calling webservice over ssl

Hi Todd,

 

I am working with Atul on this problem.  We have our own application that is calling Clearspace web services using the client jars provided with Clearspace.  Specifically Jive built us a jar called jive-clearspace_community-webservices.jar, we are using that jar as well as its dependent jars.  We are trying to follow the examples given at

http://www.jivesoftware.com/builds/docs/clearspace/latest_2.0/ClearspaceWebServicesDevGuide.html#APIExamples.

 

Specifically our code looks something like this:

 

  ServiceLocator locator = new ServiceLocator(getCollaborationURL(), COLLABORATION_LOGIN, COLLABORATION_PASSWORD);
  UserService userService = locator.getUserService();

  WSUser clearspaceUser = userService.getUser(getClearspaceUserId());
  clearspaceUser.setEmail(getEmail());
  clearspaceUser.setName(getFullName());
  userService.updateUser(clearspaceUser);

 

getCollaborationURL() either returns https://ourserver/ or http://ourserver.  This works fine with http and we get the exception with https.

 

Thanks,

Aaron

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
Nov 5, 2008 8:33 AM in response to: aaronk@adaptiveplanning.com
Re: error calling webservice over ssl

Does your server have HTTPS support enabled? I believe that if your application server does not have support for HTTPS enabled then webservices will not be able to authenticate and it will revert to HTTP. If you are running tomcat here are instructions to set this up:

 

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

 

 

Please let me know if that works for you. Thanks.

 

-Todd

aaronk@adaptiveplanning.com Novice 52 posts since
Jun 24, 2008
Currently Being Moderated
Nov 6, 2008 9:38 AM in response to: Todd West
Re: error calling webservice over ssl

Thanks for the suggestion, but the server is already configured to support HTTPS.  I can log in (as an admin or standard user) and use the site over HTTPS without problems.  It is only when connecting through webservice that we have a problem.

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
Nov 7, 2008 11:23 AM in response to: aaronk@adaptiveplanning.com
Re: error calling webservice over ssl

Hi,

 

Well I haven't been able to get this to work either so what I would suggest is building your own client jars instead of using the ones that come bundled with the application. In fact, we do not provide client jars any more and it is the responsibility of the developer to generate the code themselves. You can do this automatically with tools like WSDL 2 Java and you can find more information about this here:

 

http://www.jivesoftware.com/builds/docs/clearspace/latest/ClearspaceWebServicesDevGuide.html

 

Thanks.

 

-Todd

aaronk@adaptiveplanning.com Novice 52 posts since
Jun 24, 2008
Currently Being Moderated
Nov 7, 2008 3:16 PM in response to: Todd West
Re: error calling webservice over ssl

Hi Todd,

 

I am not sure I quite understand your response.  Are you suggesting that I need to upgrade to 2.5, or that I should be able to generate the necessary client jars for 2.0.3 myself using WSDL 2 Java? I am a little surprised that you were also not able to get the webservice to work over SSL, as the documentation suggests that it should work and that it is actually the recommended and default behavior.  I will attempt to build my own client jars and see how that goes, probably on Monday.  Can you provide any more concrete examples of this than the link above? I am new to WSDL2Java tools, so any time you can save me with more specific instruction would be valuable.

 

Thanks,

Aaron

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
Nov 13, 2008 4:19 PM in response to: aaronk@adaptiveplanning.com
Re: error calling webservice over ssl

Hi Aaron,

 

I apogize for the late reply. Were you able to test out WSDL2Java at all this week? I am hoping to get more time to test out these webservices over SSL again. I was unable to get it to work initially after quite a lot of testing but I think there is a setting or piece of code that I am missing somewhere. I hope to hear back from you soon. Thanks Aaron.

 

-Todd

aaronk@adaptiveplanning.com Novice 52 posts since
Jun 24, 2008
Currently Being Moderated
Nov 13, 2008 4:41 PM in response to: Todd West
Re: error calling webservice over ssl

Hi Todd,

 

I did a bunch of experiments and finally did get things working.  Building my own client jar did not work for me, as the client code generated did not match the signiture of the bundled client jar.  Switching over would have required me to rewrite a large amount of my own application code.

 

I went back to using the bundled client jar and started playing with my invocations.  The following code (simplified) was enough to get it working over SSL:

 

// webServiceURL looks like either "http://server/clearspace" or "https://server/clearspace"

ServiceLocator locator = new ServiceLocator(webServiceURL, login, password);

 

CommunityService service = locator.getCommunityService();

 

if (webServiceURL.toUpperCase().startsWith("HTTPS")) {
  Client cxfClient = ClientProxy.getClient(service);
  HTTPConduit http = (HTTPConduit)cxfClient.getConduit();
  TLSClientParameters tlsParams = new TLSClientParameters();
  tlsParams.setSecureSocketProtocol("SSL");
  http.setTlsClientParameters(tlsParams);
}

 

I still do not know why I had to do this, given the documentation indicated that it should work out of the box.  However, it all seems to be working just fine for me with this code.

 

-Aaron

Todd West Jive Employee 15,918 posts since
Jul 14, 2008
Currently Being Moderated
Nov 14, 2008 6:37 AM in response to: aaronk@adaptiveplanning.com
Re: error calling webservice over ssl

Hi Aaron,

 

Thank you for your reply. I am not sure why this was not working out of the box as well. I will do some further investigation on my end to see if there is anything that we need to fix here. Thanks again.

 

-Todd

More Like This

  • Retrieving data ...

Bookmarked By (0)

To better serve our customers we have included functionality to automatically follow up on a case after it has been idle for more than 5 days, and then auto close after an additional 3 days of inactivity. Choose No to acknowledge that this case will remain idle for longer than 5 days.
Making cases public allows other customers to learn from the solution of the case. It can also be used to gain feedback from others in the community. Ask our Support Engineers for more info, but we encourage you to make your cases public.