cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with dynamic configuration in PI 7.0 (SP 21)

former_member84399
Participant
0 Kudos

We're trying to set a dynamically configurable parameter (UrlParam in plain http adapter) in a java mapping and when calling, via proxy, getting the following error returned<br />

<p />

<br />

&lt;?xml version="1.0" encoding="utf-8" ?&gt;<br />

- &lt;asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"&gt;<br />

- &lt;asx:values&gt;<br />

&lt;SYSTEMFAULT href="#o284" /&gt;<br />

&lt;/asx:values&gt;<br />

- &lt;asx:heap xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br />

xmlns:abap="http://www.sap.com/abapxml/types/built-in" <br />

xmlns:cls="http://www.sap.com/abapxml/classes/global" <br />

xmlns:dic="http://www.sap.com/abapxml/types/dictionary"&gt;<br />

<br />

- &lt;cls:CX_AI_SYSTEM_FAULT id="o284"&gt;<br />

- &lt;CX_ROOT&gt;<br />

&lt;TEXTID&gt;F63AFF63DBE4BB4786A7F52CC4167145&lt;/TEXTID&gt;<br />

&lt;PREVIOUS /&gt;<br />

&lt;KERNEL_ERRID /&gt;<br />

- &lt;INTERNAL_SOURCE_POS&gt;<br />

&lt;PROGID&gt;95&lt;/PROGID&gt;<br />

&lt;CONTID&gt;3304&lt;/CONTID&gt;<br />

&lt;/INTERNAL_SOURCE_POS&gt;<br />

&lt;/CX_ROOT&gt;<br />

&lt;CX_STATIC_CHECK /&gt;<br />

- &lt;CX_AI_SYSTEM_FAULT&gt;<br />

&lt;CODECONTEXT /&gt;<br />

&lt;CODE&gt;PLAINHTTP_ADAPTER.ATTRIBUTE_MISSING_PARAMS&lt;/CODE&gt;<br />

&lt;ERRORTEXT /&gt;<br />

&lt;LANGUAGE /&gt;<br />

&lt;/CX_AI_SYSTEM_FAULT&gt;<br />

&lt;/cls:CX_AI_SYSTEM_FAULT&gt;<br />

&lt;/asx:heap&gt;<br />

&lt;/asx:abap&gt; <br />

<p />

<br />

The java code in the mapping is as follows:<br />

<br />

The java code in the mapping is as follows:<br />

/*<br />

  • Created on 07-Jun-2010<br />

*<br />

  • To change the template for this generated file go to<br />

  • Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments<br />

*/<br />

package uk.gov.communities.finance; <br />

<br />

import java.io.InputStream;<br />

import java.io.OutputStream;<br />

import java.util.Map;<br />

<br />

import com.sap.aii.mapping.api.DynamicConfiguration;<br />

import com.sap.aii.mapping.api.DynamicConfigurationKey;<br />

import com.sap.aii.mapping.api.StreamTransformation;<br />

import com.sap.aii.mapping.api.StreamTransformationException; <br />

<br />

/**<br />

  • @author Mark<br />

*<br />

  • To change the template for this generated type comment go to<br />

  • Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments<br />

*/ <br />

<br />

public class PaymentGatewayRequestMap implements StreamTransformation {<br />

/** This Map parameter is for the Method setParameter() */<br />

Map param=null;<br />

/** This method should be used while the Class implements<br />

  • StreamTransformation interface<br />

*<br />

  • @param param - A Map object<br />

*/<br />

public void setParameter(Map param){<br />

this.param=param;<br />

}<br />

<br />

/**<br />

  • This method will be called by XI to execute Java Mapping. <br />

  • @param in - The InputStream which has the source message from CRM <br />

  • @param out - The OutputStream which has the target message to ProFinance <br />

*/ <br />

public void execute (InputStream in, OutputStream out) throws

StreamTransformationException { <br />

String urlParamOne = null; <br />

try{ <br />

DynamicConfiguration dynCon = (DynamicConfiguration)param.get("DynamicConfiguration"); <br />

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/HTTP","myValueHere"); <br />

String response = ""; out.write(response.getBytes()); <br />

} <br />

catch(Exception e){<br />

throw new RuntimeException(e.getMessage());<br />

}<br />

}<br />

}<br />

<p />

<p />

<p />

Looking at the call in SXMB_MONI there's no sign of the dynamic configuration stage anywhere but we are seeing the following in the response message:

<p />

<br />

&lt?xml version="1.0" encoding="UTF-8" standalone="yes" ?&gt;<br />

-&lt !-- Call Adapter <br />

--&gt;<br />

- &lt;SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"&gt;<br />

&lt;SAP:Category>XIAdapter&lt;/SAP:Category&gt;<br />

&lt;SAP:Code area="PLAINHTTP_ADAPTER"&gt;ATTRIBUTE_MISSING_PARAMS&lt;/SAP:Code&gt;<br />

&lt;SAP:P1 /&gt;<br />

&lt;SAP:P2 /&gt;<br />

&lt;SAP:P3 /&gt;<br />

&lt;SAP:P4 /&gt;<br />

&lt;SAP:AdditionalText /&gt;<br />

&lt;SAP:ApplicationFaultMessage namespace="" /&gt;<br />

&lt;SAP:Stack>Dynamic Header - Missing Message Attributes: Fields/Parameters&lt;/SAP:Stack&gt;<br />

&lt;SAP:Retry>N&lt;/SAP:Retry&gt;<br />

&lt;/SAP:Error&gt;<br />

<p />

<br />

Please note, we have set this up on another PI system (7.0 sp 12) and it works as required.

<p />

<br />

Many thanks

<p />

<br />

Andreas

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

> DynamicConfiguration dynCon = (DynamicConfiguration)param.get("DynamicConfiguration");

> DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/HTTP","myValueHere");

You have just created a key, but you have to put a value also. Check online help for an example.

Something like key.put

Are you really using "myValueHere"? You have to use the constants which you also find in online help.

former_member84399
Participant
0 Kudos

Hello , let me clarify:

- There's a graphical mapping which has a user defined function with the following code:

DynamicConfigurationKey dynKey =DynamicConfigurationKey.create(

"http://sap.com/xi/XI/System/HTTP",paramName);

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

dynCon.put(dynKey, paramValue);

return paramValue;

- The above UDF has paramName set to UrlParamOne via a constant and paramValue set a per an element in the incoming structure.

- Incidentally, a Java mapping is then called (although not relevent) to clear the xml produced from the mapping. This is a requirement for our customer who don't want the HTTP body set. The code is as follows:

/*

  • Created on 07-Jun-2010

*

  • To change the template for this generated file go to

  • Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

package uk.gov.communities.finance;

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

import com.sap.aii.mapping.api.StreamTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

/**

  • @author Mark

*

  • To change the template for this generated type comment go to

  • Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments

*/

public class PaymentGatewayRequestMap implements StreamTransformation {

/** This Map parameter is for the Method setParameter() */

Map param=null;

/** This method should be used while the Class implements

  • StreamTransformation interface

*

  • @param param - A Map object

*/

public void setParameter(Map param){

this.param=param;

}

/**

  • This method will be called by XI to execute Java Mapping.

*

  • @param in - The InputStream which has the source message from CRM

  • @param out - The OutputStream which has the target message to ProFinance

*/

public void execute(InputStream in, OutputStream out) throws StreamTransformationException {

try{

String response = "";

out.write(response.getBytes());

}

catch(Exception e){

throw new RuntimeException(e.getMessage());

}

}

}

Many thanks

Andreas

stefan_grube
Active Contributor
0 Kudos

> Hello , let me clarify:

It does not clarify anything, when you post something totally different

Anyway, in online help are examples for dynamic configuration for all type of mappings.

You can also check:

http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/package-summary.html

Answers (0)