Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Uwe Vass
Simple Apache CXF web service integration
May 19, 2009 1:46 AM
Answer

Uwe Vass

Rank: New Member

Posts: 2

Join Date: September 25, 2008

Recent Posts

For those who wants to use the Apache CXF web service stack instead of Axis 1.
This guide uses the ext environment and describes how to make the remote interface of a service available as web service over Apache CXF.

If you are using the ext environment just do the following things.

1) Downlad the libraries of Apache CXF. (http://cxf.apache.org)

2) Put the following libraries into the ext-lib/portal directory:
cxf-2.2.jar
FastInfoset-1.2.2.jar
geronimo-jaxws_2.1_spec-1.0.jar
jaxb-api-2.1.jar
jaxb-impl-2.1.9.jar
jaxb-xjc-2.1.9.jar
xmlbeans-2.3.0.jar
xml-resolver-1.2.jar
XmlSchema-1.4.4.jar

3) Generate your service code with the servicebuilder. Set the remote interface to "true" in your service.xml.

4) Create a file cxf-spring.xml in ext-impl/META-INF directory with the following content:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd">

<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />

<simple:server id="pojoservice"
serviceClass="com.ext.portlet.reports.service.ReportsEntryService"
serviceBean="#com.ext.portlet.reports.service.ReportsEntryService.impl"
address="/reports">
<simple:dataBinding>
<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
</simple:dataBinding>
</simple:server>
</beans>

This file demonstrates how to export the ReportsEntryService interface as a web service.
Just change or add your interface and impl classes to the xml file.


5) Add the cxf-spring.xml to the portal-ext.properties. Copy the spring.config section from the portal.properties
and add the cxf-spring.xml entry. E.g.:

spring.configs=\
META-INF/base-spring.xml,\
\
META-INF/hibernate-spring.xml,\
META-INF/infrastructure-spring.xml,\
META-INF/management-spring.xml,\
\
META-INF/util-spring.xml,\
\
META-INF/jcr-spring.xml,\
META-INF/messaging-spring.xml,\
META-INF/scheduler-spring.xml,\
META-INF/search-spring.xml,\
\
META-INF/counter-spring.xml,\
META-INF/document-library-spring.xml,\
META-INF/lock-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/portal-spring.xml,\
META-INF/portlet-container-spring.xml,\
META-INF/wsrp-spring.xml,\
\
META-INF/mirage-spring.xml,\
\
META-INF/ext-spring.xml,\
META-INF/cxf-spring.xml


Thats it. Build and deploy your application. After deploying your web service is available under:
http://localhost:8080/services/<service_name>
In the example above : http://localhost:8080/services/reports

WSDL is available under:
http://localhost:8080/services/<service_name>?WSDL
In the example above : http://localhost:8080/services/reports?WSDL

Can someone confirm, I didn't missed something? emoticon
SZ khan
RE: Simple Apache CXF web service integration
July 1, 2010 4:16 AM
Answer

SZ khan

Rank: Regular Member

Posts: 148

Join Date: October 31, 2009

Recent Posts

Hi Uwe,
Thank you very much for your instructions.. They were really helpful. ONly you forgot to mention
the servlet mappings in web.xml

<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
SZ khan
RE: Simple Apache CXF web service integration
July 5, 2010 2:11 AM
Answer

SZ khan

Rank: Regular Member

Posts: 148

Join Date: October 31, 2009

Recent Posts

looks like friendlyURl is hindering /services/* deployment...have to check out
SZ khan
RE: Simple Apache CXF web service integration
July 13, 2010 2:35 AM
Answer

SZ khan

Rank: Regular Member

Posts: 148

Join Date: October 31, 2009

Recent Posts

Updated in portal-ext.properties and works fine

 1virtual.hosts.ignore.paths=\
 2    /c,\
 3    \
 4    /c/portal/change_password,\
 5    /c/portal/extend_session,\
 6    /c/portal/extend_session_confirm,\
 7    /c/portal/json_service,\
 8    /c/portal/layout,\
 9    /display_chart,\
10    [b]/services/[/b],\
11    /c/portal/login,\
12    /c/portal/logout,\
13    /c/portal/portlet_url,\
14    /c/portal/render_portlet,\
15    /c/portal/reverse_ajax,\
16    /c/portal/session_tree_js_click,\
17    /c/portal/status,\
18    /c/portal/update_layout,\
19    /c/portal/update_terms_of_use,\
20    /c/portal/upload_progress_poller,\
21    \
22    /c/layout_configuration/templates,\
23    /c/layout_management/update_page
Payam Shabaneh
RE: Simple Apache CXF web service integration
August 10, 2012 3:12 PM
Answer

Payam Shabaneh

Rank: New Member

Posts: 4

Join Date: February 24, 2010

Recent Posts

Has anyone had success with implementing CXF on a more recent version of Liferay? ( 6.x versions ).

Issue of primary interest - https://issues.liferay.com/browse/LPS-898
Hitoshi Ozawa
RE: Simple Apache CXF web service integration
August 10, 2012 6:52 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

Since the developer of Apache CXF is now with Mulesoft, it may be easier to use CXF via Mule because Mulesoft has documentation on setting up CXF at their site. (I think Mule ESB is included with liferay).
Michael Oliver
RE: Simple Apache CXF web service integration
March 26, 2014 10:28 PM
Answer

Michael Oliver

Rank: Junior Member

Posts: 60

Join Date: April 19, 2012

Recent Posts

Hitoshi Ozawa:
Since the developer of Apache CXF is now with Mulesoft, it may be easier to use CXF via Mule because Mulesoft has documentation on setting up CXF at their site. (I think Mule ESB is included with liferay).


When I tried to use Mule to connect to Liferay using the CXF Client when I tried to generate the classes I got...

1Rpc/encoded wsdls are not supported with CXF


Both the Liferay In Action and Mule In Action second edition do not talk about SOAP integration with Liferay and Mule.

If someone has integrated Mule with Liferay, I would sure like to know how they did it.
Michael Oliver
RE: Simple Apache CXF web service integration
May 4, 2014 6:38 PM
Answer

Michael Oliver

Rank: Junior Member

Posts: 60

Join Date: April 19, 2012

Recent Posts

Hitoshi Ozawa:
Since the developer of Apache CXF is now with Mulesoft, it may be easier to use CXF via Mule because Mulesoft has documentation on setting up CXF at their site. (I think Mule ESB is included with liferay).


That would explain the dropping of the Axis code in favor of CXF, however that's not good news here, since Liferay is RPC style SOAP and CXF doesn't do RPC style.
Seyed Mohammad Hossein Jamali
RE: Simple Apache CXF web service integration
June 15, 2014 8:33 AM
Answer

Seyed Mohammad Hossein Jamali

Rank: Junior Member

Posts: 77

Join Date: December 13, 2009

Recent Posts

Is there any complete working instruction?
How can I use CXF instead of Axis?