on 12-04-2008 10:06 AM
Hi All,
I'm doing a simple RFC Lookup (using RFC Lookup API) from XI to ECC. But the RFC response XML (from ECC to XI) contains CDATA (as below); hence my lookup is failing to parse it. I'm not sure why this is happening. Please suggest the ways to reslove it.
<![CDATA[<?xml version="1.0" encoding="UTF-8"?><rfc:ZSCE_RFC_LOOKUP.Response xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><RESULT1>2</RESULT1><RESULT2>1.000-</RESULT2></rfc:ZSCE_RFC_LOOKUP.Response>]]>
Thanks,
Joe.
follow this article and make sure your usage is correct - https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shabarish,
Thanks for your prompt reply. I've already checked with that. However, below is my code for your reference.
MappingTrace trace;
trace = container.getTrace();
String m = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<ns0:ZSCE_RFC_LOOKUP" +
" xmlns:ns0=\"urn:sap-com:document:sap:rfc:functions\"><TANUM>" + a +
"</TANUM><VSOLA>" + b +
"</VSOLA></ns0:ZSCE_RFC_LOOKUP>" ;
RfcAccessor accessor = null;
ByteArrayOutputStream out = null;
InputStream in = null;
try
{
Channel channel = LookupService.getChannel("BS_RFC_Lookup","CC_RFC_RCVR");
accessor = LookupService.getRfcAccessor(channel);
InputStream inputStream = new ByteArrayInputStream(m.getBytes());
XmlPayload payload = LookupService.getXmlPayload(inputStream);
Payload result = accessor.call(payload);
in = result.getContent();
}catch(LookupException e)
{
trace.addWarning("Error while lookup " + e.getMessage() );
}
String txt = "";
InputStreamReader inR = new InputStreamReader(in);
BufferedReader buf = new BufferedReader(inR);
String line;
while ( ( line = buf.readLine() ) != null )
{
txt = txt + line;
}
/*
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = null;
factory.setNamespaceAware(false);
factory.setValidating(false);
Document docRsp = null;
try {
docRsp = builder.parse(in);
} catch (Exception e) {
trace.addWarning("Error when parsing RFC Response1 - " + e.getMessage()); return null;
} */
//trace.addInfo("RFC Response XML: " + docRsp.toString());
if (accessor!=null) {
try {
accessor.close();
} catch (LookupException e) {
trace.addWarning("Error while closing accessor " + e.getMessage() );
}
}
return txt;
Thanks,
Joe.
Hi,
I have a java mapping which requires Source Interface to be RFC request & target will be ur RFC response.Do not forget to change the Business System and Commuication channel.
Check this out.
http://knowhowsapxi.synthasite.com/rfc-loolup.php
just compile it and import it into imported archives then use it in the interface mapping.
You can have multi step mappings like firststep Msg Mapping to convert src to RFC Request format second step as the Java mapping of RFC Lookup and 3rd step again to convert RFC response to target message using a msg mapping.
Any Ways I think the error is that you are using < ( sign) instead of & l t ; same for > & other chars
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.