cancel
Showing results for 
Search instead for 
Did you mean: 

Schema Validation

Former Member
0 Kudos
143

I have written a java program to do schema validation and implemented/tested it successfully in interface mapping in XI.

When the validation succeeds, I am forwarding the input message to a receiving system.

When the validation fails, I am creating an error response using xsl - named outputMessage. outputMessage is of javax.xml.transform.Result type.

Throwing StreamTransformationException(new StringBuffer().append(outputMessage).toString()); is giving the following error message:

<?xml version="1.0"?>

<!-- see the documentation -->

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SOAP:Body>

<SOAP:Fault>

<faultcode>SOAP:Server</faultcode>

<faultstring>Server Error</faultstring>

<detail>

<s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">

<context>XIAdapter</context>

<code>RecoverableException</code>

<text><![CDATA[

com.sap.aii.af.ra.ms.api.DeliveryException: Application:STREAM_TRANSFORMATION_EX:

at com.sap.aii.adapter.xi.ms.XIEventHandler.onTransmit(XIEventHandler.java:453)

at com.sap.aii.af.ra.ms.impl.core.queue.CallConsumer.onMessage(CallConsumer.java:131)

at com.sap.aii.af.ra.ms.impl.core.queue.Queue.run(Queue.java:834)

at com.sap.aii.af.ra.ms.runtime.MSWorkWrapper.run(MSWorkWrapper.java:56)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

]]></text>

</s:SystemError>

</detail>

</SOAP:Fault>

</SOAP:Body>

</SOAP:Envelope>

How do I send my customized error message 1. either as a normal response 2. or as a fault response.

I have read through many blogs and forum messages on SDN but couldn't figure this out.

Any help is appreciated.

Thanks,

Badari

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Badari,

I didn't try these following ideas, but one of those should work

1) In your java mapping before throwing exception,set a Globalcontainer parameter (eg:errMsg).In exception block of the original mapping put another mapping in which we get the globalcontainer parameter which we set before and use it..

2)Do not throw StreamTransformationException.. but create a status message which has Success or Fail flags with error message.Based on the status flag change the process flow..

Both of these ideas are not one step solutions as you are trying to acheive...

Good hear from you Badari.

Venu

Former Member
0 Kudos

Hi Venu, good to hear back from you too. Here are salient points of my implementation:

1. No usage of BPM.

2. This is a synchronous SOAP call from a client.

3. The input message should go through the interface mapping defined at the time of Interface Determination.

4. Successful input message (if schema validation is success) should go to to a receiving ECC system for processing.

5. If schema validation fails, I should stop the sync call at XI itself and send back the detailed error message either as a normal SOAP response or as a SOAP Fault Response.

This is an independent Java class and not a UDF. Here is the exception block code snippet:

catch (SAXParseException spe) {

this.createExceptionOutput(spe.getMessage(),

inputMessage, outputMessage);

throw new StreamTransformationException(new StringBuffer().append(outputMessage).toString());

}

If I don't throw an exception (StreamTransformationException), XI doesn't detect any error and simply passes on the error output message ( created by createExceptionOutput method ) to the receiving system ! The receiving system fails to process the message and sends back ABAP Processing Error. But, my objective is to stop the incorrect input message at XI itself and not do any further processing.

Thanks,

Badari