on 12-18-2014 10:54 AM
Is hybris is supporting Apache CXF for creating webservices?Please help
Add the apache cxf libs to your project.
Then change the web.xml and integrate the cxf servlet.
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
...
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
Next adapt yourt *-web-spring.xml file as follows
add the name spaces to the beans tag.
xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
And to the xsi:schemaLocation add
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
Furthermore import following resources
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
Now you are ready to define the beans which are used to process soap.
<bean id="aSoapServiceService" class="your.package.AServiceImplementation" />
<jaxws:endpoint id="aSoapService" implementor="#aSoapServiceService"
address="/aSoapService">
<jaxws:properties>
<entry
key="org.apache.cxf.interceptor.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD"
value="TRUE"></entry>
</jaxws:properties>
</jaxws:endpoint>
For the service implementation you can use the DSL or as we did generate the classes from a provided WSDL.
To generate the classes from WSDL the buildcallbacks.xml has to be adapted
<macrodef name="yourext_before_build">
<sequential>
<echo message="mkdir gensrc" />
<mkdir dir="${ext.yourext.path}/gensrc" />
<!-- generate WSDL stubs -->
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-server" />
<arg value="-p" />
<arg value="your.package" />
<arg value="-d" />
<arg value="${ext.yourext.path}/gensrc" />
<arg value="-frontend"/>
<arg value="jaxws21"/>
<arg value="${ext.yourext.path}/resources/wsdl/webserivce.wsdl" />
<classpath>
<path refid="cxf.classpath" />
</classpath>
</java>
</macrodef>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm getting this issue: INFO [Thread-1] [HybrisContextFactory] Initializing <> Spring ApplicationContext took: (15.04 s) error notifying tenant listener : ListableBeanFactory must not be null during server startup. I have followed the same steps mentioned here. Could someone help me with this?
I'm getting this issue: INFO [Thread-1] [HybrisContextFactory] Initializing Spring ApplicationContext took: (15.04 s) error notifying tenant listener : ListableBeanFactory must not be null during server startup. I have followed the same steps mentioned here. Could someone help me with this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes you can use cxf for creating webservices with spring (http://cxf.apache.org/docs/writing-a-service-with-spring.html).
When you creating REST webservices you may stick to the approach using springmvc controllers and @ResponseBody annotation as done by hybris in their ycommercewebservices extension (https://wiki.hybris.com/display/release5/ycommercewebservices+Extension+-+Technical+Guide)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.