cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Webservices

praveen_vanga3
Participant
0 Kudos

Hi,

I am using Webservices as a sender (SOAP)adapter.when Webservices are failed at mapping then I have route to two receivers one for file( error) and one for proxy(Success).

If there are any errors i.e mandatory fields or data format errors then message needs to be routed to multiple receivers based on webservice triggered by third party system.looking for archive option for webservices . how to archive dat once it fails in message mapping? when SOAP as a sender adapter.

Praveen

Accepted Solutions (1)

Accepted Solutions (1)

iaki_vila
Active Contributor
0 Kudos

Hi Praveen,

You can do a file written at mapping level, however if you don't want to send that message to the receiver, you can use the condition editor on the receiver determination/ICO  to send the XML to the webservice or to the file adapter.

Regards.

praveen_vanga3
Participant
0 Kudos

Hi Iñaki,

Can you explain where condition required in ICO? How to do it ?

Please explain how to split at mapping level if there are any errors.

Thanks

Praveen

former_member186851
Active Contributor
0 Kudos

Hello Praveen,

Refer the below link to add conditions in ICO.Blog is about adding in Receiver deterimation the same should you do in ICO receivers tab.

Xpath Condition in Receiver Determination - Process Integration - SCN Wiki.

And Praveen you should have try catch blog and in case of error you should write string buffered writer to write the file.

Answers (1)

Answers (1)

former_member186851
Active Contributor
0 Kudos

Hello Praveen,

Requirement is to write the file if mapping fails??as Inaki told you can do i using UDF in the mapping.

praveen_vanga3
Participant
0 Kudos

Hi Raghuraman,

Can you explain the approach ? If the mapping fails then it should be routed to two receivers.

It's routed dynamically one for fail and other success.how to achive this UDF and archiving data if webservices fails at sender.

Thanks

Praveen

former_member186851
Active Contributor
0 Kudos

Praveen ,

Please throw more light on the requirement

In case of failure why success??and if sender adapter fails you just need to archive?

praveen_vanga3
Participant
0 Kudos

Hi Raghuraman,

In my scenario Webservices may fail or success then I have to routed to two recivers .

1.If webservices success then go to ABC- receiver.

2.If webservices fails then it's go to XYZ-receiver.

There are no conditions simply if I get an error at that time of mapping then I need to send to one receiver( fail) else send to other receiver (success).

I just looking for an option to achrive data if the webservices falis.

Thanks

Praveen.

former_member186851
Active Contributor
0 Kudos

Hello Praveen,

1.If webservices success then go to ABC- receiver.

It will be a normal flow.

2.If webservices fails then it's go to XYZ-receiver.

you can write a code in Cleanup method to write the file incase if mapping fails.

For archiving option am not sure.

praveen_vanga3
Participant
0 Kudos

Hi Raghuraman,

Can you explain approach?

How to handle it in Cleanup method if webservices fails?

Can you provide any code or configuration?

Thanks

Praveen

former_member186851
Active Contributor
0 Kudos

Praveen,

In mapping functions you can see Init,Cleanup methods.

Just have a catch block to throw in case of errors.

And incase of errors have a code like below to write the file

How to write to file in Java – BufferedWriter

praveen_vanga3
Participant
0 Kudos

Hi Raghuraman,

Is that code will capture entire payload?

or only exceptions raised at mapping?

I want to capture entire payload and send that as a file.

Thanks

Praveeen

former_member186851
Active Contributor
0 Kudos

Hello Praveen,

You need to write the code as per your requirement to catch the data and send as file.

iaki_vila
Active Contributor
0 Kudos

Hi Praveen,

According with Raghuraman suggestions this blog can be helpful for you

Regards

praveen_vanga3
Participant
0 Kudos

Hi Iñaki,

Is that code needs to be implemented in File look or cleanup method ?

Thanks

Praveen

iaki_vila
Active Contributor
0 Kudos

Hi Praveen,

It depends about what you want. Also you can't simply copy the code, you should check what do and what you should change. Also, if you want to check mandatory fields, why do you want to expect to a mapping error?, why don't make a first java mapping in order to check the mandatory fields?

Regards.

praveen_vanga3
Participant
0 Kudos

Hi Iñaki,

I have written an UDF for mandatory fileds but in scenario i need to get that record if value is missing and send back to source as a file.that's why i have to get that missing fields record.My intention is not to copy code, it  just for uderstanding.I won't get anything by copying others code. I just understanding the process.

Thanks

Praveen

iaki_vila
Active Contributor
0 Kudos

Hi Praveen,

I misunderstood you then. In my opinion you can do a SOAP to Proxy scenario. In the mapping you can have a first mapping to check the mandatory fields, you have some interesting   blog about to work with java and DOM to work with XML. In this first mapping you can check the mandatory fields, create the file if it is necessary and to produce a second XML. This XML would be the original XML or a second XML with information about the error. Later you can send this message to the proxy, even the error one; it's a good idea to have a Z table on the receiver side to store the fail communications, in this way you can control easily the issue without the necessity to go to the file or the PI monitoring, what do you think?

Regards.