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

Hi again Petals Padawan. Glad you're on board !
For your 3rd day, you will connect Petals ESB to an FTP server, and expose the created FTP service as a SOAP web-service, outside Petals ESB.

Last tested with

This Tutorial uses:

  • Petals Studio
  • Petals ESB
  • Petals SE RMI
  • Petals BC SOAP
  • Petals Web console
  • Tomcat
  • Petals BC FTP (new)
  • soapUI (new)

Deploy a FTP Service Unit

Install and Deploy BC-FTP:

  1. Download Petals-BC-FTP .
  2. Deploy BC-FTP in Petals ESB.

Configure and deploy a FTP Service-Unit for [ftp.petalslink.com]:

  1. Start Petals ESB.
  2. Launch Petals Studio.
  3. Go to File > New > Service Unit Project.
  4. Select Provide > FTP > Your_Current_Version.
  5. Click Next. It displays the window "FTP Service-Unit - Defines the JBI properties of the service to import."
    1. Service Name: FtpTutorial
  6. Click Next > Next. It displays the window "FTP Service-Unit - Define the specific properties for this version of the component."
    <folder> attribute is written as optionnal in Studio, but it is not. It will be optional in BC-FTP v3, so as soon as it is published, you will not need to specify the folder attribute for the tutorial.
    1. Server: ftp.petalslink.com
    2. Port: 21
    3. User: petals
    4. Password: demo
    5. Folder: /
  7. Click Finish.
  8. Look the source of generated jbi.xml, which defines component configuration. The provide section should look like:
    jbi.xml
         <jbi:provides         
                interface-name="generatedNs:FtpInterface"
                service-name="generatedNs:FtpTutorial"
                endpoint-name="FtpTutorialEndpoint">
        
                <!-- CDK specific elements -->
                <petalsCDK:timeout>30000</petalsCDK:timeout>
                <petalsCDK:validate-wsdl>true</petalsCDK:validate-wsdl>
                <petalsCDK:forward-security-subject>false</petalsCDK:forward-security-subject>
                <petalsCDK:forward-message-properties>false</petalsCDK:forward-message-properties>
                <petalsCDK:forward-attachments>false</petalsCDK:forward-attachments>
                <petalsCDK:wsdl>FtpService.wsdl</petalsCDK:wsdl>
            
                <!-- Component specific elements -->    
                <ftp:server>ftp.petalslink.com</ftp:server>
                <ftp:port>21</ftp:port>
                <ftp:user>petals</ftp:user>
                <ftp:password>demo</ftp:password>
                <ftp:folder>/</ftp:folder>
                <ftp:filename>auto</ftp:filename>
                <ftp:transfer-type>auto</ftp:transfer-type>
                <ftp:connection-mode>active</ftp:connection-mode>
                <ftp:delete-processed-files>false</ftp:delete-processed-files>
                <ftp:overwrite>false</ftp:overwrite>            
            </jbi:provides>
  1. Just look the generated FtpService.wsdl sources. Operations available are described here.
  2. Right click on su-FtpTutorial-provide folder, which is in Service-Unit Project section on the left Petals projects tree.
  3. Select Petals > Fast Export for Petals.
  4. Drop (or Copy-Paste) the generated file sa-FTP-FtpTutorial-provide.zip to ./petals-platform-xxx/install/ folder to deploy it.
  5. Check Petals ESB traces to be sure the SA was deployed successfully. (Note: BC-FTP needs to be deployed before deploying your Service-Unit)

Test and monitor in Webconsole

Send test DIR Operation on root folder:

  1. Start the Webconsole.
  2. Go to Webconsole > Server:0 > Test > Send.
  3. Click Refresh Domain.
  4. Select:
    1. Endpoint: FtpTutorialEndpoint
    2. Operation: dir
    3. MEP: InOut
  5. Click Submit.
    You should get a response message, listing files on the Ftp.

Monitor services:

  1. Go to Webconsole > Server: 0 > Monitoring > Server Monitoring.
  2. Check Filter endpoint.
  3. Select Endpoint "FtpTutorialEndpoint"
    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.
  4. Click Submit. "FtpTutorial" is now visible in exchange filters list.
  5. In the exchange filters list, Click the small icon in "Monitoring" column, to activate monitoring for "FtpTutorialEndpoint".
  6. Go to Test > Send panel.
  7. Send a few test messages.
  8. Go to Monitoring > Filter Monitoring.
  9. Click the chart icon in Charts column.

    Message exchange monitoring page
  10. Go back to previous page in your browser.
  11. Click the "+" button in front of "FtpTutorialEndpoint". You get message exchange details.
  12. In Exchange IDs list, Click the magnifier icon in Details column, for the first exchange ID.
  13. It displays Exchange global view page. Just give it a look and try to understand.

Change destination folder:

  1. Go to ftp://ftp.petalslink.com in your web browser or ftp client, using previous login. You see there is an "Integration" folder. Let's go there.
  2. Go to Petals Studio.
  3. Edit FtpTutorial's jbi.xml.
  4. Replace "<folder>/</folder>" with "<folder>Integration</folder>"
  5. Save.

Redeploy the component:

  1. Go to Webconsole > Server: 0 > Administration > Service-Assemblies.
  2. Click Stop then Shutdown then Uninstall to uninstall previous "FtpTutorial" SA.
    As for installing, you can use three methods:
    • from Webconsole: Click alternatively Stop, Shutdown and Uninstall (Alternatives: "force undeploy" or "clear all")
    • from Autoloader: Remove the corresponding .ZIP package from ./petals-platform-xxx/installed/
    • from Command Line: Type hu or hotundeploy. Ex: "hu sa-FTP-FtpTutorial-provide.zip".
  3. Well, Click Clear all. That's better. Service-Units from day-2 won't be useful anymore, let us clean.
  4. Go to Petals Studio.
  5. Fast-export the FTP Service-Unit.
  6. Drag&Drop the newly generated sa-FTP-FtpTutorial-provide.zip from Eclipse to ./petals-platform-xxx/install/
  7. Check in Petals ESB traces that the new SA was deployed sucessfully.
  8. Go to Webconsole > Server: 0 > Test > Send.
  9. Click Refresh Domain.
  10. Send a message to FtpTutorialEndpoint, with DIR operation.
  11. You should see the file "HelloWorld.txt", along with some other files.
    Want to go further?
    Try reading "HelloWorld.txt" using BC-FTP. Look at the BC-FTP Documentation and go on your own. (note that ftp.petalslink.com is read-only. If you want to call writing operations, create your own ftp server).

Expose the FTP service over SOAP

BC-SOAP previously imported external WSDL to Provide a service inside Petals ESB.
This time you will expose an existing service (FtpTutorial), from the bus to the outside. BC-SOAP will Consume "FtpTutorial" and expose it as an external SOAP web-service.

Expose a SOAP-Consume of FtpTutorial:

  1. Go to Petals Studio.
  2. Click File > New > Service-Unit Project.
  3. Select Consume > SOAP > Your_BC-SOAP_Version.
  4. Click Next. It displays the window "SOAP Service-Unit - You have to provide the namespace".
  5. Click Select a service.
  6. Select FtpTutorial implements FtpInterface @ FtpTutorialEndpoint.
  7. Click OK. Fields are automatically completed.
  8. Click Next > Next. It displays the window "Define the specific properties for this version of the component".
    1. Service Name: SoapFtpTutorial
  9. Click Next > Finish.
  10. Export and deploy in Petals ESB.

Test with SOAP UI

Install SOAP UI:
Download SOAPUI and install it. SOAP UI is a client to send and receive messages with SOAP protocol.

Find the WSDL URL:

  1. Go to http://127.0.0.1:8084 in your web browser. It displays a page dedicated to "Petals BC SOAP".
  2. Go to Service List.
  3. Copy the URL of "SoapFtpTutorial" WSDL. (It migh be: http://127.0.0.1:8084/petals/services/SoapFtpTutorial?wsdl )

Create a SOAP UI Project:

  1. Launch soapUI.
  2. Click File > New soapUI Project.
    1. Project Name: PetalsFtpTutorial (or whatever name).
    2. Initial WSDL/WADL: Paste the WSDL URL previously copied.
  3. Click OK.

Test the proxified FTP DIR operation:

  1. Click PetalsFtpTutorial > FtpServiceSoapBinding > dir.
  2. Double-click Request1. It displays a window with a pre-generated message.
  3. Delete text with equal or higher indentation than  <!-Optionnal->. This means deleting <connection> node and its children.
Ftp parameters are already configured in the Service-Unit jbi.xml, so you do not need to configure them again.
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>
  1. Clic the green arrow to send the message. The response should list several files.
    Want to go further?
    Try reading "HelloWorld.txt" into "Integration" folder, using optional elements instead of deleting them.
    You need to redefine ALL properties in this case.

Technical monitoring with Webconsole:

  1. Go to Webconsole > Server: 0 > Monitoring > Server Monitoring
    1. Check Filter Endpoint.
    2. Select FtpTutorialEndpoint.
  2. Click Submit.
  3. Click the small image in the "Monitoring" column to activate FtpTutorialEndpoint monitoring.
  4. Send a few test message with SOAP UI.
  5. Go to Webconsole > Server: 0 > Monitoring > Filter Monitoring.
  6. Click on the magnifier image on the right of any message exchange to get details. You should get a screen like this:

    Message exchange status
You can see the message was sent by BC-SOAP to BC-FTP

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)

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.