create custom carbon component - osgi

I read this and tried to create my own component. I got the student-manager sample, but I don't know how I can create the project from scratch? I also try to develop a osgi bundle using this and install this bundle into AS, and start/stop the bundle. My thought is that, how can I then write a method and expose it as web service? then generate the stub, and write the UI component? is there a doc about this? what about carbon-p2-plugin? thanks in advance.

Q1: How to expose a web service?
Yes, the student-manager sample [1] has a sample web service implementation. This has been done using Axis2. What you need to do is to define a services.xml file at component/src/main/resources/META-INF/ folder and specify the service implementation class in it:
<serviceGroup>
<service name="StudentManager" scope="transportsession">
<transports>
<transport>https</transport>
</transports>
<parameter name="ServiceClass">org.wso2.carbon.student.mgt.StudentManager</parameter>
</service>
<parameter name="adminService" locked="true">true</parameter>
<parameter name="hiddenService" locked="true">true</parameter>
<parameter name="AuthorizationAction" locked="true">/permission/admin/protected</parameter>
</serviceGroup>
Q2: How to generate the client service stub?
Once you are ready with your web service, deploy the component in a Carbon server and start the server. Then access the WSDL and use WSDL2Java tool to generate the client service stub.
Q3: How to write a Carbon UI component?
Please refer articles [2] & [3] for implementing Carbon UI components.
Q4: What does P2-Plugin do?
Equinox-p2 has added provisioning (install/update/uninstall) features for OSGi bundles [4]. This is a value added feature for managing carbon features in a more user friendly manner.
[1] http://wso2.com/premium/webinars/creating-your-own-wso2-carbon-components
[2] http://wso2.com/library/tutorials/build-ui-component-wso2-carbon-platform-part-1
[3] http://docs.wso2.org/display/DVS320/Creating+Carbon+Projects#CreatingCarbonProjects-CarbonUIBundleProject
[4] http://wso2.com/projects/carbon/provisioning-wso2-carbon-with-equinox-p2/

Related

DIfference between Application and Integration service in IIB

Could anyone please explain the difference between application and integration service in IIB. I have referred through documentation but it was not clear. For example, if I have to create a service based on wsdl which has some 3 operations.Should I create it as integration service or application.Please suggest
So with an Application it's roll your own in that you have to build everything.
With an Integration Service you can import a WSDL and the framework of your flow will be generated for you.
So if you are being given WSDL's for the services you want to build then using an IS may be the way to go.
Personally I don't like some of the aspects of the generated code but that's me. I'm currently working on a project that uses REST API's and am using the REST API project option for my projects and it generates code.

Create a web service client in Hybris

Im new in Hybris and I need to build a web service client that consumes a web service rest.
Someone have an example? or something that give me an idea, I dont know if is the same like build a web service client in spring.
Thank you.
For REST you can use the default Spring framework for rest client. See this tutorial. here You can create a new extension or use one of yours. See below for more info.
I used Apache Axis2 for consuming the WSDL (the web service). There are a lot of examples and tutorials on the internet for this. It can easily be integrated in Hybris.
The clearest solution is to create another extension using extgen
. Some tips here . You have to modify other the
extensioninfo.xml file of the other extension, where you want to use
the client. (more info in the link above).
The easiest solution is to just add the axis2 lib to the extension
you want to handle the client and use it there. If you want to play
around and test it as a prove of concept, you can do that. Later you
can move it to a separate extension.

how to create a soap based web services in liferay

I am new to liferay.
I want to know how to create SOAP based web-services in liferay6.2.
Please post the all steps to create a SOAP based web-services in liferay6.2.
Thanks and regard :
Manoj Kumar
Create a portlet plugin project
Add a service builder configuration (service.xml)
Run Service Builder
Deploy
You might want to consider:
Services (SOAP and REST) created by using Liferay's Service builder are mainly useful for persisting data in the Liferay database
Liferay 6.2's SOAP impl. is based on Axis 2, an archaic version that only supports some deprecated SOAP style (document/literal or rpc/literal or some other combination)
Anyway, Service Builder is the Liferay keyword to further explore this topic.

How to Replace Web Service Binding - Tuscany SCA with Spring from scratch

I have had some experience of developing web services (standalone) which are called via angularjs single page apps. But, I now have a Java EE task which involves the following:
1. Removing a Tuscany SCA web service binding from some business components e.g. Customer, Accounts. The components are exposed as web services
2. Replacing the Tuscany Binding with a Spring Injection web service binding.
NOTE: The decision to replace Tuscany SCA with Spring is already made.
But, as a developer with experience of developing web service without any knowledge of the binding frameworks. I need some understanding of what these frameworks are, how I can wire this framework to my web service from scratch.
I don't just want to copy and paste and do try and error on a commercial project.
I am afraid, there was no KT, hence I am learning this the hard way!
Please, can someone help me in understanding this underlying framework or binding.
What are this binding or binding frameworks?
Why do we need them?
How is Tuscany SCA different from Spring?
Any help good, practical, code sample, online references etc will be appreciated.
Thanks.
You are not clear with concept of SOA, SCA and Tuscany.
First understand which type of webservice is written in your project whether RESTFul or SOAP. And then understand how SCA + Tuscany service is written for for RESTFul/SOAP service and then try to remove Tuscany from it.
Reference docs:
http://tuscany.apache.org/documentation-2x/sca-java-bindingrest.html
http://www.springsource.org/spring-integration

OSGI Embedded Equinox - Bundle to access pojos not instantiated in osgi framework

I have a server side application and want to embed an osgi framework into for dynamic bundle loading.
Suppose I want to expose a QuoteImpl implementing IQuote(instantiated as part of the server container bootstrap/Spring) to be used by different Bundles.
Q1. Is there a clean way of exposing server-application instances to Bundles ? (btw because of legacy it is not possible to make server code into bundle :) and donot want to make entire application osgi'ed.
Tried exposing via a service and bundle to cast into an IQuote. Not sure I am doing it well but fails with unresolved compilation problems as IQuote resides in the core app projects as opposed to the bundle project. any ideas?
Yes the way to do this is with a service. The "host" application would publish the service and the bundles inside OSGi would consume the service in the normal way.
The key to get this working is that the service API (i.e. the package containing IQuote) must be exported by the host application through the system bundle exports. You can control this by setting the org.osgi.framework.system.packages.extra property when you create the embedded OSGi framework. I wrote a blog post on this subject that should help you get started (look for the heading "Exposing Application Packages").
You state that you have compilation problems. To fix those it's necessary to know how you have structured your projects and build system.
This is how I embedded Equinox OSGi runtime in my Java class. I suppose you could do the same. https://github.com/sarxos/equinox-launcher/blob/master/src/main/java/com/github/sarxos/equinox/Launcher.java

Resources