Tags

, , , , , , , , , , ,

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.

Imagem

Below will have a very important detail in the definition of posts where is our attachment” that should bebinary

Imagem

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>

Imagem

Below is our full WSDL:

Imagem

Imagem

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

Imagem

Now let’s create a BPEL based on our WSDL created earlier and we tie in our new DBAdapter.

Imagem

Now open the BPEL and drag an Assign to begin our variables and Invoke to our DBAdapter:

Imagem

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:

Imagem

Vamos iniciar nossas variáveis:

  1. Connect the input of your WSDL idTransacao with the input of its variable created for your Invoke
  2. 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:

Imagem

Fill in your variable below the Invoke if the image is saved successfully.

Imagem

Ready .. Now perform the deploy locally and we will test it.

First in EM take the WSDL of your BPEL

Imagem

To test, we will send a JPEG file type through SOAUI, first let’s enter the WSDL of our project as follows:

Imagem

Open the Request and idTransacao place the number 1 to create a transaction with number 1, and then click Attachments as follows:

Imagem

Now click the + and will open a popup for you to locate the image you want to insert, in my case Imagem.jpeg

Imagem

Click Open and another popup will open as shown below, click Yes then for the image to be attached to soapUI

Imagem

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.

Imagem

Click Part and select the Attachment option and see that in Type will automatically switch to MIME.

Imagem

Now in its soapUI click Submit (small arrow> green) to run our process.

Imagem

If your message is this, our process has been successfully completed.

Imagem Blog Uans

Now just check on your data bank the transaction ID referring to image that we insert.

imagem Blog Uans

 

Hugs and to the Next

/:-D