Sample scripts are provided as-is with no warranty of fitness for a particular purpose. These scripts are solely intended to demonstrate techniques for accomplishing common tasks. Additional script logic and error-handling may need to be added to achieve the desired results in your specific environment.
ebmx.s
Chrysler's e-Business Messaging Exchange (EBMX) enables the exchange of documents (typically EDI and XML) between Chrysler and their trading partners.
Robo-FTP provides all the functionality needed to implement a secure, reliable, automated connection to Chrysler EBMX using HTTPS.
While this sample script was written specifically for EBMX, the techniques demonstrated can be used for automating any HTTP POSTs.
You must first acquire the hostname, username, and password from Chrysler. You will use this information in two places:
- Configure a site called "ebmx" in the configurator and store the username and password there.
- Set the variables at the top of the file.
This script requires Robo-FTP 3.7 to function.
1 SET username = ""
2 SET password = ""
3 SET uploadRecieverID = "LOOPTEST"
4 SET uploadFileType = "LOOPBACK"
5 SET uploadFilename = "Readme.txt"
6 WORKINGDIR "C:\Program Files\Robo-FTP 3.7"
7
8 FTPLOGON "ebmx"
9
10 ;do login
11 PREPAREPOST "application/x-www-form-urlencoded"
12 POSTVALUE "function" "login"
13 POSTVALUE "username" username
14 POSTVALUE "password" password
15 SET ErrorMsg = "Could not login as " & username
16 HTTPPOST "/servlet/ebmxcontroller" "" result /intype=prepared /outtype=string
17 IFNSUBSTR result "Success!" GOTO FAILED
18
19 ;do upload
20 PREPAREPOST "multipart/form-data"
21 POSTVALUE "ReceiverId" uploadRecieverID
22 POSTVALUE "FileType" uploadFileType
23 POSTVALUE "filename" uploadFilename /file
24 SET ErrorMsg = "Could not upload " & uploadFilename
25 HTTPPOST "/servlet/ebmxcontroller?function=submitfile" "" result /intype=prepared /outtype=string
26 IFNSUBSTR result "Success!" GOTO FAILED
27
28 ;extract returned tracking id
29 SETSUBSTR depth = result " "
30 SETNUM depth = depth + 1
31 SETEXTRACT uploadedId = result " " depth
32 DISPLAY uploadedId
33
34 ;get list of files that need to be downloaded
35 PREPAREPOST "application/x-www-form-urlencoded"
36 POSTVALUE "function" "listfiles"
37 POSTVALUE "newdocsonly" "true"
38 SET ErrorMsg = "Could not get file listing"
39 HTTPPOST "/servlet/ebmxcontroller" "" "tmpfile.txt" /intype=prepared
40 IFERROR GOTO FAILED
41
42 ;discard header line
43 READFILE "tmpfile.txt" discard /termchr=lf
44
45 ;get next record from file list
46 READFILE "tmpfile.txt" record /record=next /termchr=lf /allowall
47 IFERROR GOTO FAILED ;No Records
48 ;extract tracking id from record (first item, space delimited)
49 SETEXTRACT trackingID = record " " 1
50 SET filelist = trackingID
51
52 :ADDFILE
53 READFILE "tmpfile.txt" record /record=next /termchr=lf /allowall
54 IFERROR GOTO ALLFILES ;No more Records
55 ;extract tracking id from record (first item, space delimited)
56 SETEXTRACT trackingID = record " " 1
57 SET filelist = filelist & "," & trackingID
58 GOTO ADDFILE
59 :ALLFILES
60 ;download zip file
61 PREPAREPOST "application/x-www-form-urlencoded"
62 POSTVALUE "function" "downloadfiles"
63 POSTVALUE "filelist" filelist
64 SET ErrorMsg = "Could not download " & filelist
65 HTTPPOST "/servlet/ebmxcontroller" "" "download.zip" /intype=prepared
66 IFERROR GOTO FAILED
67 ;confirm download of zip file
68 PREPAREPOST "application/x-www-form-urlencoded"
69 POSTVALUE "function" "confirmdownload"
70 POSTVALUE "filelist" filelist
71 SET ErrorMsg = "Could not confirm download of " & filelist
72 HTTPPOST "/servlet/ebmxcontroller" "" result /intype=prepared /outtype=string
73 IFERROR GOTO FAILED
74
75 GOTO DOWNLOAD
76
77 :FAILED
78 DISPLAY ErrorMsg
79 DISPLAY %lasterrormsg
80 DISPLAY result
81 :DONE
82 FTPLOGOFF

