Doorgaan naar hoofdcontent

Oracle DBAdapter

Deze blog laat zien hoe je eenvoudig een Oracle DB Adapter ge-exposed als een web service kunt maken met BEA Workspace Studio. Dit maakt gebruik van Apache Beehive.

* Maak een new Project aan en kies in de project wizard voor een Web Service Project. Klik Next.

* Geef als project naam, bijv DbAdapter, en klik Next


* In dit scherm kun je zogenaamde Facets aangeven. In dit geval de Annotation Processors die gebruikt gaan worden. We gebruiken de JAX-WS annotaties en de extended Beehive annotaties. Accepteer hier de Defaults.
en klik Next.

* Accepteer in dit scherm de defaults en klik Next.

* Het volgende scherm gaat over de Beehive Controls. Je kunt hier aangeven of je wilt verwijzen naar een Beehive library (eerste optie) of de JARs wilt copieren naar je WEB-INF/lib directory. Je kiest voor het eeste geval als de library vaker gebruikt wordt (of gaat worden), je kiest voor de tweede optie als je per applicatie wilt kunnen aangeven welke jars je precies wilt gebruiken.
Let op!
Als je voor de eerste (default) optie kiest, moet je er bij het deployen (en runnen) rekening mee houden dat de library wel gedeployed is in je weblogic server. Anders kan de webservice niet gedeployed worden. Dit is de fout die in een eerdere blog beschreven is.

Accepteer de default en klik Next.

* Bij Weblogic Controls, accepteer default en klik Next.
* Bij WebLogic Integrated Commons Logging accepteer default en klik Finish.

* Maak een nieuw services Package aan voor de classes


* Klik met rechtermuisknop op services en kies New > JDBC Control
* Geef als naam op DbAdapter en klik Next
* In het volgende scherm kies je de database source. Hier vul je de JNDI van de data source in.

En klik Finish.

* Nu wordt er direct al wat code voor je gemaakt:


* Nu kun je dmv annotaties van Beehive Sql queries uitvoeren op de data source waarnaar je zojuist gerefereerd hebt met z'n JNDI naam.
Bijvoorbeeld:


* Nu gaan we deze adapter exposen als een web service. Ga op services package staan, rechtermuisknop en kies New > WebLogic Web Service. Geef de service als naam DbAdapterService en klik Finish.

* Weer is er alvast wat code ingevuld. We gaan nu de JAXWS annotaties gebruiken om de DbAdapter te exposen als een WebService.


Voordat we gaan deployen vanuit WorkSpace Studio, gaan we eerst een koppeling maken met de server.
* Ga op DbAdapter project staan, rechtermuisknop en kies New > Server
* Vul hostname in (in ons geval localhost)
* Kies juiste BEA WebLogic Server versie (in ons geval 10.0), klik Next.
* Browse naar het juiste Domain en klik Next.
* Klik op je DbAdapter en klik Add, en daarna klik Finish
Bij de servers is nu je server toegevoegd met je project:


Nu kunnen we deployen.
* Klik rechtermuisknop op server en kies Publish.

Als je nu vervolgens inlogt op de admin server console van de server waarop je de service hebt gepublished zul je het volgende zien bij Deployments:


Nu kunnen we de service testen.
* Klik _workshop_auto_generated_ear_ open (+ tekentje)
* Klik bij Web Services op services.DbAdapterService
* Kies Testing tab
* Klik op (+) bij services.DbAdapterService
* Klik op Test Client
Nu krijg je een mooi gegenereerd test scherm voor je kiezen, vul wat waarden in en klik op Insert.


Kijk vervolgens in de database of de data is toegevoegd.

Reacties

Populaire posts van deze blog

Microservices mindmap

"The tree" - See also   my photo page When you are fairly new within the Microservices land, there are a lot of terms fired at you. So also for my own understanding i have made a mindmap. I think it has a good status now, so that i can share it with you. As always feedback is very welcome ! You can download the mindmap here .

Cloud to Cloud Application Integration

A lot of applications have integration possibilities, so do cloud applications. The question I got from a customer is whether to have a point-to-point integration with Cloud applications or to go through their ESB solution. This blog describes some considerations. Context The customer has a HRM application in which job vacancies are managed. Furthermore that system also handles the full applicant process flow. They also have another cloud application that handles the job vacancies. This application posts the jobs to social sites and other channels to promote the vacancies. Furthermore this application has some intelligence for job seekers to advice some new vacancies based on previous visits or profiles. The job vacancies need to be sent to the Vacancies application and applicant information needs to be sent to the HRM application, when a job seeker actually applies for a job. Furthermore status information about the job application is als...

OSB 10gR3 and SWA and MTOM

This blog is about using soap with attachments and the use of MTOM within the OSB (10gR3). A service is created that accepts a soap with attachment (DocumentService) and translates it to a service that accepts a binary element. MTOM is used for performance reasons for the second. Some notes: * For the use of attachments you need RPC-style document instead of the usual document-style. This due to the fact that the document-style limits a message to a single . * A service can not have both SWA and MTOM within OSB. First a WSDL is setup for the DocumentService: The $attachments variable holds the attachments and the body holds the attachment data. Also other data is stored within the attachment element (see h...