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

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

Last tested with
  • Petals ESB 3.1
  • Petals Studio 1.1.0
  • Petals SE RMI 1.1.1
  • Petals BC SOAP 4.0.2
  • Petals Webconsole 2.0.4
  • Tomcat 6.0.29
  • JDK 6 update 20

Added in this tutorial :

  • Petals BC FTP 3.2.1
  • soapUI 3.6

Deploy a FTP Service Unit

Install and Deploy BC-FTP

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

  1. Start Petals ESB.
  2. Launch Petals Studio.
  3. File => New => Service Unit Project: Service Unit - Select the kind of service to create.
  4. Select: Provide / FTP / Current_Version => Next: FTP Service-Unit - Defines the JBI properties of the service to import.
    1. Service Name: FtpTutorial
  5. Next => Next: FTP Service-Unit - Define the specific properties for this version of the component.
    1. Server: ftp.petalslink.com
    2. Port: 21
    3. User: petals
    4. Password: demo
    5. Folder: /
    6. Transfer Type: auto
    7. Connection Mode: active
<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. Finish.
  2. Look the generated jbi.xml component configuration. It 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:transfer-type>auto</ftp:transfer-type>
    <ftp:connection-mode>active</ftp:connection-mode>
    </jbi:provides>
  1. Look the generated FtpService.wsdl sources. Operations available on service are described here.
  2. On the left "Petals projects" tree, right click on the Service-Unit Project "su-FtpTutorial-provide" => Petals => Fast Export for Petals.
    Known bug for Studio v1.1.0 !
    Please check jbi.xml and FtpService !
    "interface-name" attribute in jbi.xml and "portType name" in the WSDL should have the same value. If not, please correct FtpService.wsdl :
    1. SELECT:
      <wsdl:portType name="Ftp">
    2. REPLACE BY:
      <wsdl:portType name="FtpInterface">

    This is a known bug in Petals Studio 1.1.0. It should be corrected in version 1.1.1

  3. Drop the generated sa-FTP-FtpTutorial-provide.zip to ./petals-platform-xxx/install/ folder to deploy it.
  4. Check Petals ESB traces to be sure the SA was deployed successfully.

Test and monitor in Webconsole

Send test DIR Operation on root folder

  1. Start the Webconsole
  2. Server:0 => Text panel => Send
  3. Select:
    1. Endpoint: FtpTutorialEndpoint
    2. Operation: dir
    3. MEP: InOut
  4. Submit
    The response message should list files on the Ftp.

Monitor services

  1. In Webconsole, go to tab: 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. Submit. FtpTutorial is now listed in exchange filters
  5. Activate monitoring on FtpTutorialEndpointby clicking the small icon in the "Monitoring column" to .
  6. Send a few test messages from the test panel
  7. Go in tab: Monitoring/Filter Monitoring

Change destination folder

  1. 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.
  2. Go to Petals Studio
  3. Edit FtpTutorial jbi.xml
  4. Change <folder>/</folder> to <folder>Integration</folder>

Redeploy the component

  1. Go in Webconsole/Server:0/Administration/Service-Assemblies
  2. Uninstall the previous FtpTutorial SA (Stop=>Shutdown=>Uninstall)
    As for installing, you can use three methods:
    • 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. Ex: "hu sa-FTP-FtpTutorial-provide.zip"
  3. Go in Petals Studio => "Fast export for Petals" on the FTP SU.
  4. Drop the newly generated sa-FTP-FtpTutorial-provide.zip from Eclipse to ./petals-platform-xxx/install/
  5. Check in Petals ESB traces that the new SA was deployed sucessfully
  6. Test by calling DIR operation ob Webconsole
    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)

Expose the FTP in SOAP

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

  1. Petals Studio => File => New => Service Unit Project.
  2. Select: Consume / SOAP / Current_SOAP_Version
  3. Next: SOAP Service-Unit - You have to provide the namespace
  4. Clic "Select a service" => "FtpTutorial implements FtpInterface @ FtpTutorialEndpoint" => OK: Fields are automatically completed.
  5. Next: Define the project name and location
  6. Next: Define the specific properties for this version of the component
    1. Adress: SoapFtpTutorial (Name you want to give to the service)
  7. Next: Define the CDK properties
  8. Finish
  9. 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. 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"
    [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'
  2. Go to http://127.0.0.1:8084 in your web browser
  3. Go to Service List
  4. Copy the SoapFtpTutorial WSDL URL

Create a SOAP UI Project

  1. Lauch SOAP UI
  2. File => New soapUI Project
    1. Project Name: PetalsFtpTutorial (or whatever name)
    2. Initial WSDL/WADL: _Paste the WSDL URL previously copied. Might be: http://127.0.0.1:8084/petals/services/SoapFtpTutorial?wsdl_
  3. OK

Test the proxified FTP DIR operation

  1. PetalsFtpTutorial => FtpServiceSoapBinding => dir.
  2. Right clic on "Request1" => Show Request Editor: A window with a pre-generated messages appears
  3. Delete the optional part of the message ( <connection> node and its children)
    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>
    
  4. Clic the green arrow to send the message. The response should list two files.
    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.

Webconsole technical monitoring

  1. Activate monitoring on Webconsole
  2. Send a few test message
  3. Check the messages monitoring

[ADD SCREENSHOT]

You see the initial message was now 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.