cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Configuration issue -pi7.0

Former Member
0 Kudos


Hi All,

I have an issue while trying to use the dynamic configuration in sap pi 7.0. It isfor SFDC poc.

conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);


key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP","TServerLocation");

conf.put(key2, serverURL);

iam able to retrive the server url and session id ,but when passed to conf.put(key2, serverURL);

its going to catch error .

in the DynamicConfigurationKey.create is it the correct path i url i have provided .

Regards

Kiran

Accepted Solutions (0)

Answers (3)

Answers (3)

Harish
Active Contributor
0 Kudos

Hi Kiran,

The below discussion will be helpful to resolve the issue

dynamically pass parameter in SOAP adapter | SCN

regards,

Harish

former_member184720
Active Contributor
0 Kudos
former_member184681
Active Contributor
0 Kudos

Hi Kiran,

You can cross-check your configuration with the following Wiki page:

SOAP Adapter dynamic URL configuration - Community Profiles - SCN Wiki

Also keep that in mind that any Dynamic Configuration-related UDF will always fail during mapping test, because there is no runtime objects to be read with getTransformationParameters. So make sure you test this scenario end-to-end with a test message, not a mapping test.

Regards,

Greg

Former Member
0 Kudos

Hi Grzegorz,

I am using the below code .

AbstractTrace trace = container.getTrace();
String sessionId = new String();
String serverURL = "";

try {

String prefix = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:login xmlns:ns0=\"urn:enterprise.soap.sforce.com\"><ns0:username>"+ uname +"</ns0:username><ns0:password>" + pwd + "</ns0:password></ns0:login>";
Payload result;
SystemAccessor accessor = null;
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);


DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/SOAP", "TServerLocation");

Channel channel = LookupService.getChannel("XXXX", "XXXX");
                accessor = LookupService.getSystemAccessor(channel);
                InputStream inputStream = new ByteArrayInputStream(prefix.getBytes());
                Payload payload = LookupService.getXmlPayload(inputStream);
                Payload SOAPOutPayload = null;
result = accessor.call(payload);
trace.addInfo("" + payload);
accessor.close();
InputStream inp = result.getContent();
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();     
Document document = builder.parse(inp);     
NodeList list = document.getElementsByTagName("serverUrl");     
Node node = list.item(0);    
if (node != null) {          
node = node.getFirstChild();          
if (node != null) {               
serverURL = node.getNodeValue();          
}     
}
list = document.getElementsByTagName("sessionId");     
node = list.item(0);    
if (node != null) {          
node = node.getFirstChild();          
if (node != null) {               
sessionId = node.getNodeValue();          
}     
}
trace.addInfo("after sessionId");
trace.addInfo(sessionId + "-------------" + serverURL);
trace.addInfo("after sessionId 1");
trace.addInfo("Key  Hash Map #######"+key);
//trace.addInfo("Server URL  Hash Map >>>>>>>>>>>>>>"+serverURL.toString());
//conf.put(key, serverURL);
trace.addInfo("Session Id "+sessionId);
return sessionId;
}
catch(Exception e) {
trace.addInfo("Enter Catch >>>>>>>>>>>>> ");
//trace.addWarning("Error- " +e.getStackTrace().toString());
return "456";
}

If I comment the conf.put(key, serverURL); I am able to get the session id but if uncommnet it its going catch error and its returning error -456;