cancel
Showing results for 
Search instead for 
Did you mean: 

Error Handling in SOAP to JDBC Scenario

vijay_kamath2
Explorer
0 Kudos

Hello Folks,

I have hit a roadblock in error handling for SOAP to JDBC scenario.  SOAP request contains Vendor Number as input, based on which I need to get Vendor details from Oracle DB using JDBC adapter.  I have mapped my soap request to a jdbc request in which I have put the query (action = SQL_QUERY; access - 'Actual Query is put as constant').  When I tested my interface, I am successfully able to fetch the data and send it back using my response mapping.  However in case no records are fetched from DB, I need to send an error message back.  The response WSDL contains only fields where I can map the success records.  I need to send back only a single field (Error Message).  I am unable to use Multi Mapping as this is a synchronous scenario.  Appreciate if I can get some pointers on how to approach this problem.  (SAP PI version is 7.4)

Thanks,

Vijay

Accepted Solutions (0)

Answers (1)

Answers (1)

iaki_vila
Active Contributor
0 Kudos

Hi Vijay,

You don't need multimapping you can do it if you set the schema in the inbound interface for the response with cardinalities 0..1 or 0..unbound in this way the tag is not necessary to be present and the message mapping you can ask if the nodes with the data exist or not.

Regards.

maheswarareddykonda
Active Contributor
0 Kudos

Vijay,

As suggested bu Inaki , you no need to go for multimapping ..use below condition at response mapping

vijay_kamath2
Explorer
0 Kudos

Hi Inaki -

I think there is a disconnect in understanding the requirement.  My response structure does not contain any fields for capturing the error.  Below representation gives a better Idea:

Source Structure: (SOAP Request)

Vendor_Number

1st Mapping maps SOAP Request to JDBC Request:

Actual SQL query is put as a constant in the <access> with action as SQL_SELECT

2nd Mapping maps SOAP Response to JDBC Response:

Result of SQL query is mapped to fields in the response like Vendor Name, Vendor Address, etc.

Target Structure

Vendor_name

Vendor_addrress

Invoice_number

Check_number

Now when 2nd Mapping does not return back anything (when record is not present / Vendor Number is invalid), I get back the response in the response structure with only the XML tags and no data (which is correct).  However this is not what I want.  I need to send back an Error Message (in a new Target Error structure) which contains Fault Code and Fault Message.  Since JDBC does not return either of Fault code or message, I am fine with hard coding it to a generic message.  But the question is how can this be done since i will now have 2 different strutures - 1 for success and 1 for error - which is not possible with multi mapping in sync scenario.  Please advise.

Thanks,

Vijay

maheswarareddykonda
Active Contributor
0 Kudos

Hi,

still you don't need to create multimapping.

you can try structure for response at webservices side like below.

MT_Resp_Soap

   Records

        Vendor_name

        Vendor_addrress

        Invoice_number

        Check_number

    Fault

       faultsring

       faultcode

now you have to maintain condition create if for both subnodes(Records,Fault) depending on incoming data.

let me know if still stuck

vijay_kamath2
Explorer
0 Kudos

Thank you for the quick response.  However I am unable to change the target structure as it has been given as a WSDL.  I understand that I can change this WSDL using XML tools to add the error fields, but looking for other options as well without changing the existing target structure.  In case I create  a new type with only fault code/fault string, how can I handle the error scenario?  Please advise.

Thanks,

Vijay

maheswarareddykonda
Active Contributor
0 Kudos

in case your DB server is capable to send fault structures then you can easyly create fault mapping and add them operational mapping..as per my knowledge i dont think that would happens.

also your case empty tags are comming to PI when number not match at DB side that mean its running successful flow only, so you can not use fault slandered in OM.

AFAIK that only option is good.please let me know in case you find other options.