Tags
Attachments, BPEL, DBAdapter, Deploy, EM, invoke, JDeveloper, MIME, Oracle, Payload, SOAPUI, Submit
A BPEL process can receive an attachment (Attachment) MIME along with a Payload. The attachment can be in any format (for example, DOC, PDF, JPEG, XML, text, and so forth).
Let this first time send a JPEG file type to BPEL and burn it to a database by using the tool ora:getAttachmentContent BPEL
The big move to do that is in the WSDL definitions, the rest will be very quiet.
Let the WSDL definition first:
Here we have the operations of Request and Response normally in Request send a Transaction ID.
No Response will receive a code and an error message or success of our recording operation.
Below will have a very important detail in the definition of posts where is our “attachment” that should be “binary“
Logo Below we will also have another very important step in our WSDL that will be in the “input” of our “operation”, see that it is essential that is between one type of tag <mime:multipartRelated>
Below is our full WSDL:
WSDL OK.
Now let’s create a DBAdapter to perform the recording of our file.
Note: The table field in the database where we will write to the file must be of type BLOB
Down a DBAdapter created with the name GravaArquivoDBAdapter
Now let’s create a BPEL based on our WSDL created earlier and we tie in our new DBAdapter.
Now open the BPEL and drag an Assign to begin our variables and Invoke to our DBAdapter:
After that drag another Assign below Invoke to put a successful message if our image is recorded successfully and add also a catchall with another Assign upon our image not be recorded as follows:
Vamos iniciar nossas variáveis:
- Connect the input of your WSDL idTransacao with the input of its variable created for your Invoke
- In his input variable of your Invoke drag a Expression for her and place the code below
ora:getAttachmentContent(“inputVariable”,”anexo”)
So we would like this:
Fill in your variable below the Invoke if the image is saved successfully.
Ready .. Now perform the deploy locally and we will test it.
First in EM take the WSDL of your BPEL
To test, we will send a JPEG file type through SOAUI, first let’s enter the WSDL of our project as follows:
Open the Request and idTransacao place the number 1 to create a transaction with number 1, and then click Attachments as follows:
Now click the + and will open a popup for you to locate the image you want to insert, in my case Imagem.jpeg
Click Open and another popup will open as shown below, click Yes then for the image to be attached to soapUI
See the image was now attached and below in attachments is with the number 1
However see that the Part tab as shown in the red arrow, is empty and Type is UNKNOWN.
Click Part and select the Attachment option and see that in Type will automatically switch to MIME.
Now in its soapUI click Submit (small arrow> green) to run our process.
If your message is this, our process has been successfully completed.
Now just check on your data bank the transaction ID referring to image that we insert.
Hugs and to the Next
/:-D