Petals Getting started - day 3 - Expose a FTP Service in SOAP

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (19)

View Page History
* Petals SE RMI 1.1.1
* Petals BC SOAP 4.0.2
* Petals Webconsole 2.0.34
* Tomcat 6.0.29
* JDK 6 update 20
<ftp:connection-mode>active</ftp:connection-mode>
</jbi:provides>{code}
{code}

# Give a look at the generated _FtpService.wsdl_. You see all operations available on the service.
<wsdl:portType name="FtpInterface">

ALTERNATIVE SOLUTION:
Open the WSDL file in Studio, go on "general" tab, Clic "Helpers" on the Up-Right => Clic "Update the service end-point in the WSDL".

This is a known bug in Petals Studio 1.1.0. It should be corrected in version 1.1.1{note}
# Copy-Paste the generated _sa-FTP-FtpTutorial-provide.zip_ to Petals ESB _./install/_ folder to deploy it.
# Check that the SA deployed successfully in Petals ESB traces.


h2. Test and monitor in Webconsole

*Send test DIR Operation on root folder*
# Start the Webconsole
# Server:0 => Text panel => Send
# Submit

*Monitor services*
# In Webconsole, go to tab: Monitoring / Server Monitoring
# Check "Filter endpoint"
# Select Endpoint: FtpTutorialEndpoint
{info} You can also create filters based on Interface name, Service Name or Operation Name. This is useful for example if one service is duplicated on multiple endpoints.{info}
# Submit. FtpTutorial is now listed in exchange filters
# Activate monitoring on FtpTutorialEndpointby clicking the small icon in the "Monitoring column" to .
# Send a few test messages from the test panel
# Go in tab: Monitoring/Filter Monitoring

*Change destination folder*
# Got to [ftp://ftp.petalslink.com] in your web or ftp browser, using previous login. You see there is an "Integration" folder. Let's go there.
# Edit FtpTutorial _jbi.xml_
# Change <folder>/</folder> to <folder>Integration</folder>
# Uninstall the previous SA
# Fast export for Petals ESB

*Redeploy the component*
* Webconsole. Stop=>Shutdown=>Uninstall (alternatives if needed: "force undeploy" or "clear all")
* Autoloader: Remove the corresponding .ZIP package from _./petals-platform-xxx/installed/_
* Command Line: _hu_ or _hotundeploy_
* Command Line: _hu_ or _hotundeploy_. Ex: _"hu sa-FTP-FtpTutorial-provide.zip{_}_"_
{info}
# Go in Petals Studio => _"Fast export for Petals"_ on the FTP SU.
# Drop the newly generated _sa-FTP-FtpTutorial-provide.zip_ from Eclipse to _./petals-platform-xxx/install/_
# Check in Petals ESB traces that the new SA was deployed sucessfully
# Test by calling DIR operation ob Webconsole
{info:title=Want to go further?}Try reading the files you listed. Look at the BC-FTP Documentation and go on your own. (note that your ftp session is read-only, if you want to call writing operations, create your own ftp server){info}




h2. Expose the FTP in SOAP

Proxify the FTP operations with SOAP (15min)
Before, we used SOAP to import WSDL to create services inside Petals ESB. Meaning _Provide_ a SOAP service inside the bus.
Now we will do the contrary : A service (FTP) exists inside the bus, we want to deploy it outside. The new SOAP service will _Consume_ the existing FtpTutorial. Then the goal of SOAP-consume is to expose as SOAP outside of the bus.

*Expose a SOAP-Consume of FtpTutorial*
# Petals Studio => File => New => Service Unit Project.
# Select: Consume / SOAP / Current_SOAP_Version
# Next: SOAP Service-Unit - You have to provide the namespace
# Clic "Select a service" => "FtpTutorial implements FtpInterface @ FtpTutorialEndpoint" => OK: Fields are automatically completed.
# Next: Define the project name and location
# Next: Define the specific properties for this version of the component
## Adress: *SoapFtpTutorial* (Name you want to give to the service)
# Next: Define the CDK properties
# Finish
# Export and deploy in Petals ESB

h2. Test with SOAP UI

[Download SOAPUI|http://sourceforge.net/projects/soapui/] and install it. SOAP UI is a client to send and receive SOAP messages.

Create a SOAPUIproject with the proxified FTP (10min)
*Find the WSDL URL*
# You just deployed _sa-SOAP-FtpTutorial-consume_. Look at Petals ESB traces. Among the last messages, find one similar to the one following. And find the root URL, here "http://127.0.0.1:8084"
{code}[Petals.Container.Components.petals-bc-soap]-INFO 2010-10-06 15:26:22,032 The Axis2 service 'SoapFtpTutorial' has been registered and is available at 'http://127.0.0.1:8084/petals/services/SoapFtpTutorial'{code}
# Go to [http://127.0.0.1:8084] in your web browser
# Go to Service List
# Copy the SoapFtpTutorial WSDL URL

Test the FTP with SOAPUI (10min)
*Create a SOAP UI Project*
# Lauch SOAP UI
# File => New soapUI Project
## Project Name: PetalsFtpTutorial (or whatever name)
## Initial WSDL/WADL: \_Paste the WSDL URL previously copied. Might be: [http://127.0.0.1:8084/petals/services/SoapFtpTutorial?wsdl\_|http://127.0.0.1:8084/petals/services/SoapFtpTutorial?wsdl_]
# OK

*Test the proxified FTP DIR operation*
# PetalsFtpTutorial => FtpServiceSoapBinding => dir.
# Right clic on "Request1" => Show Request Editor: A window with a pre-generated messages appears
# Delete the optional part of the message ( <connection> node and all children)
{code:lang=xml|title=Your message looks like this}
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ver="http://petals.ow2.org/components/ftp/version-3">
<soapenv:Header/>
<soapenv:Body>
<ver:dir>
</ver:dir>
</soapenv:Body>
</soapenv:Envelope>
{code}
# Clic the green arrow to send the message. The response should list two files.
{info:title=Want to go further?} You can keep the optional elements, to change the initial BC-FTP configuration. But you need to redefine ALL properties in this case.
Try reading "HelloWorld.txt" into "Integration" folder.{info}

Webconsole technical monitoring (5min)
# Activate monitoring on Webconsole
# Send a few test message
# Check the messages monitoring

[ADD SCREENSHOT]

{info}You see the initial message was now sent by BC-SOAP to BC-FTP{info}
*DONE. Bravo \!*
Now you know how to:
* Connect Petals ESB to an FTP Server and call operations.
* Monitor service exchanges in Webconsole.
* Expose a Petals Service as external SOAP Web-service.
* Test a web-service with soapUI.

This was more "real" usecase, hum ? Difficulty goes increasing, your knowledge as well.


*Tomorrow you will create a Petals service based on a custom Java class (annotated JSR 181)*