cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Response Structures in a single mapping

Former Member
0 Kudos

Hi

I have Proxy Soap SYNC Scenario.

The request structure has 10 fields. For different combinations of the Source fields, the WEBSERVICE returns two kinds of responses.

Both are of different structures.

Please let me know how can I map both the responses back to the Same outbound message type belonging to the proxy.

Regards,

Yashwanth

Accepted Solutions (0)

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Please let me know how can I map both the responses back to the Same outbound message type belonging to the proxy.

Design your Proxy response message in a way that looks like this


Root
 ResponseMessage1 0..1
   ResponseMessageDetails1
 ResponseMessage2 0..1
   ResponseMessageDetails2

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

the outbound message type has fields for both the types of messages. But the problem is that the RESPONSE message is failing as there two structures coming in different cases.

i have configured one of the structure and it is running fine.

I am not getting how to incorpoate the second response structure in to the existing one.

I tried this :

I created an Intermediate messate type with both the message structures. Wrote a java map to remove the soap envelope and transform th incoming RESPONSE into the intermediate structure.

Then defined the message mapping from this intermediate structure to outbound structure.

I guess the java code is not working.

Below mentioned is the JAVA mapping code .

It is still not working.

-


String inData = sb.toString();

StringBuffer finalDoc = new StringBuffer();

String in1 = inData.replaceAll("<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">", " ");

in1 = in1.replaceAll("<soap:Body>", "");

in1 = in1.replaceAll("</soap:Body>", "");

in1 = in1.replaceAll("<soap:Fault>", "");

in1 = in1.replaceAll("</soap:Fault>", "");

in1 = in1.replaceAll("<soap:Envelope>", "");

in1 = in1.replaceAll("</soap:Envelope>", "");

int startidx = in1.indexOf("<Discovery_Result xmlns=\"https://www6.AustinTetra.com/AIT/WebServices\">");

int lastidx = in1.indexOf("</Discovery_Result>");

if ( startidx > -1){

finalDoc.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

finalDoc.append("<ns0:MT_Discovery_Intermediate_Response xmlns:ns0=\"http://applied.com/I1089/3rdPartyCreditInterface_To_Equifax\">");

finalDoc.append(in1.substring(startidx,(lastidx + 19)));

finalDoc.append("</ns0:MT_Discovery_Intermediate_Response>");

}else {

finalDoc.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

finalDoc.append("<ns0:MT_Discovery_Intermediate_Response xmlns:ns0=\"http://applied.com/I1089/3rdPartyCreditInterface_To_Equifax\">");

finalDoc.append(in1);

finalDoc.append("</ns0:MT_Discovery_Intermediate_Response>");

}

out.write(finalDoc.toString().trim().getBytes());

out.close();

-


Edited by: YashwanthSVK on Nov 3, 2011 2:06 PM

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

When you test the Operation Mapping by loading the Output SOAP Envelope, what is the error that you are getting?

I would still go for this approach


Root
 ResponseMessage1 0..1
   ResponseMessageDetails1
 ResponseMessage2 0..1
   ResponseMessageDetails2

Now, after you remove the SOAP Envelope, just do an append to the RootMessage and it will be okay since either occurrence is 0..1. Also this can be omitted


finalDoc.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

Hope this helps,

Mark

Former Member
0 Kudos

Thanks Mark..

I omitted the line. However i have found out another error that was stopping this..

I had given the wrong message type in Service Interface.

That was stopping the messages from getting into PI.

Issue looks resolved.. however i will close this thread upon confirmation !!

Yash

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

As a general rule, test the output using operation mapping before proceeding to ID. Glad that it has been fixed.

Regards,

Mark