Thread: Addattachment question

This question is answered.


Permlink Replies: 14 - Pages: 1 - Last Post: Nov 10, 2009 2:55 PM Last Post By: yurijap Threads: [ Previous | Next ]
gricupero

Posts: 21
Registered: 10/03/08
Addattachment question
Posted: Oct 21, 2009 3:21 AM
 
Click to report abuse...   Click to reply to this thread Reply
Hi all,

First of all, I know how to use addattachment() function. My question is, does anyone know how to access the html page that addattachment is generating with the browse, upload, cancel button?

I would like to modify that page to prevent users typing in the text box. We found a problem where if you type something in there without specifying a drive letter first (ie. C:\), once upload is clicked we get the "Processing" message and it hangs there forever. If you do enter something with the drive letter, it gives you an error that the file is not found. Which is what it supposed to do.

I submitted a case with oracle support already, and they replicated it. The problem was submitted to their developer, but I can't wait that long. I need to come up with something. This happens with IE 7 and below. For Firefox and IE 8 the text boxes are disabled as they should.

I was able to recreate the same html page with some extra function to retrieve the value from it, but how can I upload the function without calling that html page? At first I thought PutAttachment() would work, but when I give the path to the function it looks at the app server directory, not my local machine. Duh!

Any suggestions or workaround would be greatly appreciated.

Thank you,

Giovanni
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Oct 21, 2009 8:43 AM   in response to: gricupero in response to: gricupero
Correct
Click to report abuse...   Click to reply to this thread Reply
The PeopleSoft AddAttachment function (different from the FUNCLIB add_attachment function) has an UploadPageTitle parameter that accepts HTML. This HTML is displayed above the attachment field. I would use this parameter to insert JavaScript to validate the input field. Be sure to wait for document.onload before binding to the input field since the JavaScript is above the input field in the DOM tree.
gricupero

Posts: 21
Registered: 10/03/08
Re: Addattachment question
Posted: Oct 21, 2009 8:50 AM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
jim, that is awesome. I knew I could put simple html, but didn't realize inserting javascript. I will definetely try it out an let you know. Thank you for the idea.

Giovanni
gricupero

Posts: 21
Registered: 10/03/08
Re: Addattachment question
Posted: Oct 21, 2009 12:03 PM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Hi Jim as promised I was going to respond with my implementation to the idea you gave me.
I coded the following script and placed in the title argument of addattachment():

Local string &sJs = "<script language=""Javascript""> function Disable_evt(){return false;}";
&sJs = &sJs | " document.body.onload = function(e){var oElement = document.forms.elements;";
&sJs = &sJs | " oElement.attachEvent(""onkeydown"", Disable_evt);";
&sJs = &sJs | " oElement.attachEvent(""oncontextmenu"", Disable_evt);document.getElementById(""WAIT_win0"").style.visibility = ""hidden"";}</script>";

Easy to read:

<script language="Javascript">
function Disable_evt(){
return false;
}

document.body.onload = function(e){
var oElement = document.forms.elements;
oElement.attachEvent("onkeydown", Disable_evt);
oElement.attachEvent("oncontextmenu", Disable_evt);

document.getElementById("WAIT_win0").style.visibility = "hidden";
}
</script>
The last line of the script hides the Processing image. Somehow in IE, it was visible. I also tested this script in FF and it did not affect the page at all.

Thank you very much for your suggestion. I don't understand why oracle support couldn't suggest that. Oh well, it works and I'm happy.

Giovanni
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Oct 21, 2009 12:16 PM   in response to: gricupero in response to: gricupero
 
Click to report abuse...   Click to reply to this thread Reply
@gricupero, Thank you for posting your resolution. Great stuff! The UploadPageTitle parameter was intended for HTML and CSS to display text. I don't think many people have considered the possibilities. Using Ajax and IScripts, the UploadPageTitle parameter makes anything possible!
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Oct 21, 2009 12:19 PM   in response to: gricupero in response to: gricupero
 
Click to report abuse...   Click to reply to this thread Reply
Two observations: 1) I don't think you want to set body.onload. I think you want to attachEvent just like you did for the form elements. This will keep you from overriding a PeopleSoft delivered body event (not that one exists, but just in case). 2) I'm also not sure you want to disable keydown for the button. I use the keyboard enter and space buttons to activate the button on the file input button.
yurijap

Posts: 7
Registered: 06/17/08
Re: Addattachment question
Posted: Nov 4, 2009 10:16 AM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Hi Jim

I have a question for you. How I can send a file into message soap ti external system?

Very Thanks for your answer.

Mr Juliusss
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Nov 4, 2009 10:22 AM   in response to: yurijap in response to: yurijap
 
Click to report abuse...   Click to reply to this thread Reply
Is it a text file or a binary file? If it is a text file, then you can use the GetFile PeopleCode function to open the file and insert its contents into a message. If it is a binary file, then usually you base64 encode the binary file prior to inserting it into an XML document. PeopleSoft doesn't provide binary file support, but Java does. I am not aware of any Integration Broker features that support binary file attachments, so I would write a Java helper class to read binary data, convert it to base64, and then return the data as a base64 string.
Scott Ohlund

Posts: 22
Registered: 08/10/09
Re: Addattachment question
Posted: Nov 4, 2009 10:30 AM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Jim,

So would this ascii text file be a flat file with the xml stripped out of it once it ends up on on the other end?

On a related topic, our PeopleSoft Developers are interested in receiving flat files via IB to process them. We want to get these legacy flat files that are currently placed on a server and ftp'ed in and out. We have dozens of them. Is Integration Broker the right technology to send and receive and also process?

Scott
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Nov 4, 2009 10:41 AM   in response to: Scott Ohlund in response to: Scott Ohlund
 
Click to report abuse...   Click to reply to this thread Reply
@yurijap, @Scott, IB questions are a bit off topic from the original question about the UI based Add Attachment HTML. It would be best to have different threads.

@Scott, IB doesn't determine how the other end processes or treats a file. @yurijap asked how to embed a file in a message. What the target system does with that file is up to the target system. As far as sending files via FTP, or even creating local files, I suggest you look at the FTPTargetConnector and SimpleFileTargetConnector. Both will create "flat" files on the target. If you publish a structured message and don't transform it, the target file will be an XML file. If you transform the file, then the target file will be whatever you transform it into. Using XSL or PeopleCode, you can transform the published XML message into a flat (tab, fixed, csv, etc) file prior to sending it to the target connector. Worst case, you can create your own target connector (worst really isn't that bad, I have a hand full of target connectors).
yurijap

Posts: 7
Registered: 06/17/08
Re: Addattachment question
Posted: Nov 4, 2009 11:00 AM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Thanks Jim

This is the scenary:
1. From a PeopleSoft PO page I have to capture the file(jpg, pdf, limit size 3mb) from client`s machine local.
2. I have to embebbed this file in message soap
3. I have to send the message soap to external system throught Integration Broker. This external system is a Web Services WSDL

We have 1000 clients and they can upload 1000 files together.

My restrictions:
1. I don´t use FTP
2. I can´t use record://PSFILE_ATTDET for save the file withAddattachment function

Thanks,
MrJuliusss

jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Nov 4, 2009 2:19 PM   in response to: yurijap in response to: yurijap
 
Click to report abuse...   Click to reply to this thread Reply
@yurijap, unless you write something in a JSP/servlet or anywhere else completely outside PeopleSoft, you will have to use FTP or RECORD for file attachments. Either one can be temporary, just so you can acquire the file and then send it off. Once you have it in a record, you can read the binary file out of the record and convert it to base64 (or whatever format is required by the web service). If it is in a file (FTP), then you will have to find an alternative method, such as Java, to read and encode the binary file.

I have been meaning to write up a document on how to do this, but haven't gotten around to it yet.
yurijap

Posts: 7
Registered: 06/17/08
Re: Addattachment question
Posted: Nov 5, 2009 12:38 PM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Hi Jim

Thanks for your response.

We will use servlets for the solution.

Thanks you,
Mr. Juliusss
jim.marion

Posts: 326
Registered: 07/18/08
Re: Addattachment question
Posted: Nov 5, 2009 12:45 PM   in response to: yurijap in response to: yurijap
 
Click to report abuse...   Click to reply to this thread Reply
If you use a servlet, I suggest you create an external node for the servlet and an inbound routing. You can then use the servlet to accept the uploaded binary file, encode it for XML (base64, etc), and then publish it to Integration Broker. In Integration Broker, you can create a request handler to receive the text encoded binary data and then republish it with any additional database/transactional data.

Since you will be working outside the component processor, you will want to make sure you maintain transaction state: don't publish image until save time, etc.
yurijap

Posts: 7
Registered: 06/17/08
Re: Addattachment question
Posted: Nov 10, 2009 2:55 PM   in response to: jim.marion in response to: jim.marion
 
Click to report abuse...   Click to reply to this thread Reply
Hi Jim

How are you?
I`m working with this Integration. I have a question for you. I will hope your response.
I get many fileds value from buffer from a component and I need transfer this values as parameter to servlet. The servlet is call into Iscript function.
Doy you have any idea to transfer this values to Iscript function?

Thanks,
Mr. Juliusss
Legend
Guru Guru : 2500 - 1000000 pts
Expert Expert : 1000 - 2499 pts
Pro Pro : 500 - 999 pts
Journeyman Journeyman : 200 - 499 pts
Newbie Newbie : 0 - 199 pts
Oracle ACE Director
Oracle ACE Member
Oracle Employee ACE
Helpful Answer (5 pts)
Correct Answer (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums