cancel
Showing results for 
Search instead for 
Did you mean: 

How to use BPM to merge the dynamic password string?

former_member190543
Participant
0 Kudos

Hi all,

I have a requirement that when PI gets an Asyn message from ECC, it should park it and send a separate message with username and password to a third party webservice and use the response string to add it as an extra field to the original message from ECC and send the newly constructed message to the thirdparty webservice.

Could anyone help me build this scenario please?

Thank you.

Ramesh.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ramesh,

This is achievable.

You know the source & target structure.

In the mapping, you need to create a UDF which will call SOAP webserive with the user/passwor.

Map the output of this UDF to one additional field in the target which was not there in source payload. You can use the standard SOAP lookup function for the same(check the feasibiluty)

The final output of this message should be send to third party.

Regards,

Ashish

former_member190543
Participant
0 Kudos

Hi all,

Many thanks for your help.

I wrote the UDF with the help of Bhavesh's blog for the SOAP lookup, but it does not work for me.

There are no errors in the UDF. When I test the interface, only the main call is completed, but not the SOAP call within the UDF. Could you experts look at this and advise me what is wrong please?

Also, apart from doing the SOAP look up call in UDF, what other configurations should I do?

-------------------------------------

import com.sap.aii.mapping.api.*; import com.sap.aii.mapping.lookup.*; import com.sap.aii.mappingtool.tf7.rt.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import javax.xml.transform.stream.Streamoutput; import javax.xml.transform.dom.DOMSource; import javax.xml.parsers.*; import org.xml.sax.*; import org.w3c.dom.*; import javax.xml.transform.*; import com.sap.xi.tf.*

AbstractTrace trace = container.getTrace();

String tempId = "";

try

{     

            

Channel channel = LookupService.getChannel("BS_Receiver_System","CC_Communication_Channel");     

SystemAccessor accessor = LookupService.getSystemAccessor(channel);     

String SOAPxml = "<login xmlns:ns1=\"urn:realtime_services\">"

  + "<username>"+ username +"</username>"

  + "<password>"+ password +"</password>"

  + "</ns1:login>";

InputStream inputStream = new ByteArrayInputStream(SOAPxml.getBytes());     

XmlPayload payload = LookupService.getXmlPayload(inputStream);     

Payload SOAPOutPayload = null;     

 

SOAPOutPayload = accessor.call(payload);     

 

InputStream inp = SOAPOutPayload.getContent();      DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();     

 

DocumentBuilder builder = factory.newDocumentBuilder();     

Document document = builder.parse(inp);    

NodeList list = document.getElementsByTagName("output");     

Node node = list.item(0);     

if (node != null) {          

node = node.getFirstChild();          

if (node != null) {               

tempId = node.getNodeValue();          

}     

} } catch (Exception e) {     

trace.addWarning("Error" + e);  } return tempId;

-----------------------------------------------------------------------------

Thank you very much.

Ramesh.

Answers (3)

Answers (3)

former_member190543
Participant
0 Kudos

Thanks everyone.

nabendu_sen
Active Contributor
0 Kudos

Hi Ramesh,

As mentioned by Raja, go for SOAP Lookup from Message Mapping UDF. Please find the below blog for more information.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2006/11/20/webservice-calls-from-a-user-defi...

rajasekhar_reddy14
Active Contributor
0 Kudos

Perform a SOAP lookup to get a password then append the same at mapping level and send to third party. simple