hi,
I saw many thread abput how to create a SOAP Lookup in PI since the standar fuction up today involves only the RFC and JDBC Lookup
until this point become standar, the only way to implent it is manually,
below you will find a detailed executed scenario to show you how to do it.
In this case i will use a simple structure that send two parameter to a service and it returns the sum of them.
so a Message Mapping needs to be created.
The same structure is used as source and target tomake this scenario more simple, as you can see a UDF was created (SOAP_LookUp) to invoke a service to sumarize boths values.
Libraries used:
import java.io.*;
import java.util.Map;
import com.sap.aii.mapping.lookup.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.*;
import org.xml.sax.*
Funtion CODE
*********************************************************************************************************************
AbstractTrace trace = container.getTrace();
String suma = "";
try {
//instace the channel to invoke the service.
Channel channel = LookupService.getChannel("CCR_SOAP_LookUP","cc_SOAP_Lookup_receiver");
SystemAccessor accessor = LookupService.getSystemAccessor(channel);
// The Request message in XML. THIS IS THE LOOKUP SERVICE
String SOAPxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:SendDataToStorage xmlns:ns0=\"http://Test.Service.SchemaIn\"> <Valor1>"
+ var1
+ "</Valor1><Valor2>"
+ var2
+ "</Valor2></ns0:SendDataToStorage>";
InputStream inputStream =new ByteArrayInputStream(SOAPxml.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload SOAPOutPayload = null;
//The response will be a Payload. Parse this to get the response field out.
SOAPOutPayload = accessor.call(payload);
/* Parse the SOAPPayload to get the SOAP Response back.
The conversion rate is available under the Field Name ConversionRateResult */
InputStream inp = SOAPOutPayload.getContent();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
/* Create DOM structure from input XML */
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(inp);
/* ConversionRate is available in the TAG ConversionRateResult in the Response XML */
NodeList list = document.getElementsByTagName("Response");
Node node = list.item(0);
if (node != null) {
node = node.getFirstChild();
if (node != null) {
suma = node.getNodeValue();
}
}
} catch (Exception e) {
trace.addWarning("Error" + e); }
- trace.addInfo("Service XXX success executed");
return suma;
*****************************************************************************
Once all the configuration is made in the ESR and ID we can execute the scenario, in my case i will use the soft HTTP Client for SAP Process integration that could be dowloaded from: http://sappihttpclient.codeplex.com
Dont get confuse with the QoS, even if the Lookup is sync, the QoS of our interface is Exactly Once.
Message Monitor
to check whether the interface process success is let go to SXI_MONITOR to see what happened
so as fas we can see the scenario process sucess, so, lets check if the data process success in the adapter engine., so lets go to Runtime Workbech-->communication component--> adapter engine-->Communication channel monitoring.
Select the proper channel asocciated to our backen system press the USE FILTER buttom.
if every looks like the picture, click on "Message Processing completted ..." to get the payload of message
Once the popup comes up, go to Message Content tab and select the option "PAYLOAD........" from the drop-down-list. a message similitar to the below picture should be displayed.
and that it, hope you can get a more clear idea about how to configure such scenarios ussing SOAP LookUp