on 04-21-2009 6:25 AM
Hi All,
Is there any way to transfer the files (pdf, word doc etc...) through web service exposed by SAP MII ?
If yes, how can it be done and what might be the datatype of output data?
In the given set of MII datatypes, there is no datatype which can represent file object (other than String and XML).
Thanks,
Sumit
There is no built-in webservice exposed by SAP MII itself for trasferring files.
You can do either of following options for transferring using SAP MII
1. Use of External Webservice : You should create a new webservice or find some existing webservice of your desire, then you can consume that webservice and operate on that functionality through SAP MII using one Action Block called Web Service in the BLS
2. Use of Internal Webservice : You can create a BLS which transfer files using Action Blocks under the Category File I/O, then generate a new Web Service based on that created BLS using URL like following
http://<servername>/XMII/WSDLGen/<TransactionFolder(s)>/<Transaction>; which you can consume for your purpose
Regards
Som
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Som.
I'm able to expose MII transaction as web service and a third party application which is consuming my web service is able to receive the data that I'm sending.
My requirement is to generate the pdf file through MII transaction and transfer it through web service.
Since there is no specific action block and data type to represent the file object, can WSDLGen servlet be customized to load the file from MII server and transfer it across web service ?
Regards,
Sumit
Sumit,
I guess Som has meant that you can use the URl to call a MII transaction, which uses the File I/O actions like FTP Input and Output to transfer your files to whatever destination you like.
So you can build your PDF file, save it with the Image saver action, and then transfer it using the FTP output.
Would this be an option for you?
Michael
Edited by: Michael Otto on Apr 21, 2009 3:14 PM
Edited by: Michael Otto on Apr 21, 2009 3:15 PM
Hi,
If you want to generate a PDF document in BLS and then get that PDF document from an external application you can use the PDF action blocks in BLS to generate the PDF document and then assign the output property of the PDF document action to a transaction output parameter (e.g. of name PDFOutput) of type string and then access the transaction using a HTTP call:
http://<server>:<port>/XMII/Runner?Transaction=<project/folder/trx name>&OutputParameter=PDFOutput&Content-type=application/pdf&isBinary=true
This should give you the pdf document as a binary object which you can either display directly in a web browser or save as a PDF by the consuming application.
Thanks,
Dipankar
I'm trying to post the pdf document through HTTP Post action of MII BLS as follows -
1) Loaded pdf document through Image Loader
2) Mapped ImageLoader.EncodedImage to HttpPost.PostData
3) I'm using
HTTP Post URL - "http://<machine name>/wwwroot/<name>.pdf"
Content Type - "application/x-www-form-urlencoded"
Encoding - UTF-8
I'm getting error -
[DEBUG]: 00000.01500 Post Action _success:false statusText:Not Found statusCode:404
[ERROR]: ACTION FAILED: End Action Post_0 : (HTTP Post)
Am I missing anything or mappping URL in wrong way ?
Thanks,
Sumit
Hi,
Couple of points -
- you can't post data to a pdf document. It has to be a server program such as servlet to which you can post. So no .pdf in the URL
- if the server program is hosted by MS IIS then the URl should be ideally http://<machine name>/<servletname>. No wwwroot in the URL.
Also the content-type should be application/pdf
Alternatively you can call the runner URL I've mentioned in my previous post from the server program to get the PDF data from MII.
Thanks,
Dipankar
Sumit,
the URL in the HTTP Post action you mentioned should be the address of the receiving web service which consumes the encoded data. You entered the address of a pdf file which does not exist, so you get error 404. When you use the HTTP Post, you push data to a webservice.
You may create a MII transaction (BLS) like Dipankar proposed to response to a call. This BLS will be called as a webservice using the URL described by Dipankar, and send the pdf data to the caller.
I guess you now have three different possibilities to get your PDF data from MII to elsewhere:
Build a BLS, which
1. saves the pdf data as a pdf file, then FTPs it to your destination
2. pushes the pdf data to a destination web service using HTTP Post action
3. reponses to a call, delivering the pdf data to the caller as an BLS output parameter
Does this help you decide what to do?
Michael
Hi,
You can pass the authentication by using parameters in the URL, otherwise you can use basic or SSO2 authentication mechanisms:
http://<server>:<port>/XMII/Runner?Transaction=<folder>/<Transaction-name>&<InpuParamName1>=<value1>... n>=<value n>&OutputParameter=pdfOutput&Content-Type=application/pdf&isBinary=true&XacuteLoginName=<username>&XacuteLoginPassword=<password>
Thanks,
Dipankar
Yes, you need to pass credentials. Which is why you should use an HTTPS connection (or create a very low permission role and user account in MII for this specific task).
As a general note for this overall topic (transmitting files), the "String" datatype is also used for storing binary data of virtually any type, in a Base64-encoded format. Adding the "IsBinary" flag to the Runner servlet URL tells MII to convert the String output parameter back to a binary stream when returning results.
Thank you Dipankar,
I'm calling following URL from IE browser -
http://<Server>/Lighthammer/Runner?Transaction=<Transaction>&Content-Type=application/pdf&isBinary=t... name>&XacuteLoginPassword=<user password>
and getting error as -
"File does not begin with '%PDF-'."
It seems that binary data is being transfered to browser.
I think if this binary string is properly parsed/consumed at application consuming web service, PDF document will be displayed.
Am I getting proper message at browser or still missing something ?
Regards,
Sumit
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.