on 06-10-2010 11:48 AM
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 />
<?xml version="1.0" encoding="utf-8" ?><br />
- <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><br />
- <asx:values><br />
<SYSTEMFAULT href="#o284" /><br />
</asx:values><br />
- <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"><br />
<br />
- <cls:CX_AI_SYSTEM_FAULT id="o284"><br />
- <CX_ROOT><br />
<TEXTID>F63AFF63DBE4BB4786A7F52CC4167145</TEXTID><br />
<PREVIOUS /><br />
<KERNEL_ERRID /><br />
- <INTERNAL_SOURCE_POS><br />
<PROGID>95</PROGID><br />
<CONTID>3304</CONTID><br />
</INTERNAL_SOURCE_POS><br />
</CX_ROOT><br />
<CX_STATIC_CHECK /><br />
- <CX_AI_SYSTEM_FAULT><br />
<CODECONTEXT /><br />
<CODE>PLAINHTTP_ADAPTER.ATTRIBUTE_MISSING_PARAMS</CODE><br />
<ERRORTEXT /><br />
<LANGUAGE /><br />
</CX_AI_SYSTEM_FAULT><br />
</cls:CX_AI_SYSTEM_FAULT><br />
</asx:heap><br />
</asx:abap> <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>Preferences>Java>Code Generation>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>Preferences>Java>Code Generation>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 />
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><br />
-< !-- Call Adapter <br />
--><br />
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1"><br />
<SAP:Category>XIAdapter</SAP:Category><br />
<SAP:Code area="PLAINHTTP_ADAPTER">ATTRIBUTE_MISSING_PARAMS</SAP:Code><br />
<SAP:P1 /><br />
<SAP:P2 /><br />
<SAP:P3 /><br />
<SAP:P4 /><br />
<SAP:AdditionalText /><br />
<SAP:ApplicationFaultMessage namespace="" /><br />
<SAP:Stack>Dynamic Header - Missing Message Attributes: Fields/Parameters</SAP:Stack><br />
<SAP:Retry>N</SAP:Retry><br />
</SAP:Error><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
> 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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>Preferences>Java>Code Generation>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>Preferences>Java>Code Generation>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
> 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
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.