FTP Quote Service - check return code from server

Request:
We use BP as FTP client. FTP server sends back return code that is interpreted as error at the SI side, but in fact it should be success.
If we want the return code to be interpreted as success, there is a way to use FTP QUOTE service. FTP QUOTE can run any FTP raw command and service will always finish with success and return code that is send back to a BP will be written to the Process Data.
- FTP QUOTE command (from the documentation): “This service never produces a fault, because the service does not know what constitutes a valid response from the quoted command.”
After that we can make a choice, check the return code and finally decide if it was success or error.
ABOR
|
abort a file transfer
|
CWD
|
change working directory
|
DELE
|
delete a remote file
|
LIST
|
list remote files
|
MDTM
|
return the modification time of a file
|
MKD
|
make a remote directory
|
NLST
|
name list of remote directory
|
PASS
|
send password
|
PASV
|
enter passive mode
|
PORT
|
open a data
|
PWD
|
print working directory
|
QUIT
|
terminate the connection
|
RETR
|
retrieve a remote file
|
RMD
|
remove a remote directory
|
RNFR
|
rename from
|
RNTO
|
rename to
|
SITE
|
site-specific commands
|
SIZE
|
return the size of a file
|
STOR
|
store a file on the remote host
|
TYPE
|
set transfer type
|
USER
|
send username
|
Business process:
This process is written for CD command (raw command for CD is CWD). This process communicate to a custom FTP server, the return code that was sent back for Change Directory command was interpreted as error in SI. So we used FTP Client QUOTE Service and cheked a return code. If it was 200 or 250, both were treated as success, but for any other process failed.
Rule used for checking is:
number(ServerResponse/Code/text()) = 200
or
number(ServerResponse/Code/text()) = 250

BPML Code:
<process name="default">
<rule name="CWDfailed">
<condition>number(ServerResponse/Code/text()) = 200
or
number(ServerResponse/Code/text()) = 250</condition>
</rule>
<sequence name="START1">
<operation name="File System Adapter">
<participant name="FS_WriteEDI"/>
<output message="FileSystemInputMessage">
<assign to="Action">FS_COLLECT</assign>
<assign to="collectionFolder">/home/si/mirjana/test</assign>
<assign to="deleteAfterCollect">false</assign>
<assign to="filter">PLIVA_inputData.txt</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="XML Encoder">
<participant name="XMLEncoder"/>
<output message="XMLEncoderTypeInputMessage">
<assign to="map_name">PLIVA_XMLObject</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="FTP Client Begin Session Service">
<participant name="FTPClientBeginSession"/>
<output message="FTPClientBeginSessionServiceTypeInputMessage">
<assign to="FTPClientAdapter">FTPClientAdapter</assign>
<assign to="RemoteHost">192.168.101.128</assign>
<assign to="RemotePasswd">HPdds10</assign>
<assign to="RemotePort">21</assign>
<assign to="RemoteUserId">si</assign>
<assign to="UsingRevealedPasswd">true</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="FTP Client QUOTE Service">
<participant name="FTPClientQuote"/>
<output message="FTPClientQuoteServiceTypeInputMessage">
<assign to="SessionToken" from="//SessionToken/text()"></assign>
<assign to="QuoteCommand">CWD mirjana</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<choice name="Choice Start">
<select>
<case ref="CWDfailed" negative="true" activity="START2"/>
</select>
<sequence name="START2">
<operation name="Business Process Exception">
<participant name="BPExceptionService"/>
<output message="BPExceptionServiceTypeInputMessage">
<assign to="exceptionCode">550</assign>
<assign to="statusReport">CWD command unsuccessful</assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
</sequence>
</choice>
<operation name="FTP Client LIST Service">
<participant name="FTPClientList"/>
<output message="FTPClientListServiceTypeInputMessage">
<assign to="SessionToken" from="//SessionToken/text()"></assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<operation name="FTP Client End Session Service">
<participant name="FTPClientEndSession"/>
<output message="FTPClientEndSessionServiceTypeInputMessage">
<assign to="SessionToken" from="//SessionToken/text()"></assign>
<assign to="." from="*"></assign>
</output>
<input message="inmsg">
<assign to="." from="*"></assign>
</input>
</operation>
<onFault code="550">
<sequence name="Sequence Start">
<assign name="Assign" to="error">550 CWD failed</assign>
</sequence>
</onFault>
</sequence>
</process>