on 10-06-2016 10:26 AM
All,
I'm trying to control communication channels with a web service.
Source: http://help.sap.com/saphelp_nw73/helpdata/en/4b/a2862d182b63a3e10000000a42189c/frameset.htm
When I do that without any operation mapping, I see response.
But, I want to control the input and make it generic.This means having an operation mapping in place with a request and response mapping.
When we test, we see response coming back in SAP PO and it looks like this
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ChannelStatusResult SYSTEM "/AdapterFramework/channelAdmin/ChannelAdmin.dtd">
<ChannelStatusResult xsi:schemaLocation="http://host:port/AdapterFramework/channelAdmin/ChannelAdmin.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Channels>
When we test in soapUI, we see this error
<code>ADAPTER.JAVA_EXCEPTION</code>
<text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error encountered while executing mapping: com.sap.aii.af.service.mapping.MappingException: Mapping failed in runtimeRuntime Exception when executing application mapping program com/sap/xi/tf/_CommunicationChannelCheckResponse_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Failed to load resource from the context classloader of the current thread! Loading from classloader was caused by: java.io.FileNotFoundException: D:\AdapterFramework\channelAdmin\ChannelAdmin.dtd (The system cannot find the path specified)
Any ideas? We just use the XSD in the ESR.
Can we skip the DTD validation?
Thanks a lot
Dimitri
Hi Dimitri!
I used java mapping prior to main response mapping to remove DOCTYPE:
public class RemoveDOCTYPEClass extends AbstractTransformation {
@Override
public void transform(TransformationInput in, TransformationOutput out) throws StreamTransformationException {
executeMapping(in.getInputPayload().getInputStream(), out.getOutputPayload().getOutputStream());
}
public void executeMapping(InputStream is, OutputStream os) throws StreamTransformationException {
byte[] plBytes;
ByteArrayOutputStream buffer;
String xmlPayload = null;
try {
buffer = new ByteArrayOutputStream();
int nRead;
byte[] data = new byte[16384];
while ((nRead = is.read(data, 0, data.length)) != -1)
buffer.write(data, 0, nRead);
buffer.flush();
plBytes = buffer.toByteArray();
xmlPayload = new String(plBytes, "UTF-8");
}
catch (Exception e) {
throw new StreamTransformationException(e.getMessage());
}
int docTypeIndex = xmlPayload.indexOf("<!DOCTYPE");
String docTypeString = "";
if (docTypeIndex != -1) {
char currChar;
for (int i=docTypeIndex;i<xmlPayload.length();i++) {
currChar = xmlPayload.charAt(i);
docTypeString = docTypeString + currChar;
if (currChar == '>')
break;
}
}
xmlPayload = xmlPayload.replaceAll(docTypeString, "");
try {
os.write(xmlPayload.getBytes("UTF-8"));
}
catch (Exception e) {
throw new StreamTransformationException(e.getMessage());
}
}
}
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
24 | |
11 | |
9 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.