on 10-26-2009 10:01 PM
Hi,
Scenario is JDBC to XML.
My Requirement is to include tag elemt <DOCTYPE> to the target XML. My Message Mapping is Multi Mapping(1:Unbounded)
Written a Java mapping inorder to add the tag to the outbound xml. Java Version JDK 1.3.1 and we are on XI3.0
Java Code
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.DynamicConfiguration;
import com.sap.aii.mapping.api.AbstractTrace;
public class ModifyRootAndDelay implements StreamTransformation {
AbstractTrace myTrace;
public void execute(InputStream input, OutputStream output) throws StreamTransformationException {
try{
BufferedReader reader = new BufferedReader(new InputStreamReader(input));
String NameSpacePrefix = "<!DOCTYPE Transaction PUBLIC \"-//innotrac//DTD BatchReceiptAuthorization//EN\" \"http://dtd.innotrac.com/dtds/ReceiptAuthorization.dtd\">";
String sLine = null;
StringBuffer XmlMsg= new StringBuffer();
String Result,PayloadBody;
int indexOfFirst;
while ((sLine = reader.readLine()) != null) {
XmlMsg.append(sLine);
}
String StartingTag = XmlMsg.toString();
indexOfFirst = StartingTag.indexOf("<Transaction>") ;
PayloadBody=new String(XmlMsg.substring(indexOfFirst));
Result=NameSpacePrefix.concat(PayloadBody);
output.write(Result.getBytes());
/* Thread.sleep(200000); */
}catch(Exception e){
myTrace.addWarning("Exception raised in the JavaMapping:modifyNamespace.java"+"\n The Exception Message: "+ e.getMessage());
throw new RuntimeException(e.getMessage()) ;
}
} public void setParameter(Map param) {
myTrace = (AbstractTrace) param
.get(StreamTransformationConstants.MAPPING_TRACE);
}
}
But iam getting an error in MONI
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="MAPPING">GENERIC</SAP:Code>
<SAP:P1>Parsing error after multi mapping.</SAP:P1>
<SAP:P2>Expected Message<i> instead of MerchantID</SAP:P2>
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:ApplicationFaultMessage namespace="" />
<SAP:Stack>Parsing error after multi mapping.Expected Message<i> instead of MerchantID</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
My Target Payload is as follows
<Transaction><MerchantID>Kerastase</MerchantID><UserID>kerxml</UserID><Password>kerxml01</Password><TransactionType>BatchReceiptAuthorization</TransactionType><Receipts><Receipt><OrderID>0071657131_27_2009-10-26 175243</OrderID><Type>PO</Type><VendorID>Streetsboro</VendorID><ShipToName>Innotrac</ShipToName><ShipToAddress1>605 W Crossroads Parkway</ShipToAddress1><ShipToCity>Bolingbrook</ShipToCity><ShipToRegion>IL</ShipToRegion><ShipToCountry>USA</ShipToCountry><ShipToPostalCode>60440</ShipToPostalCode><FreightTerms>DESTINATION</FreightTerms><WarehouseID>WHSE1</WarehouseID><Line><LineNum>1</LineNum><ProductID>3474630179431</ProductID><Quantity>4</Quantity><Price>0.00</Price><ExpectedReceiptDate>2009.10.15 17:10:36 EST</ExpectedReceiptDate><ReferenceNum>3474630179431</ReferenceNum></Line><Line><LineNum>2</LineNum><ProductID>3474630181526</ProductID><Quantity>116</Quantity><Price>0.00</Price><ExpectedReceiptDate>2009.10.15 17:10:36 EST</ExpectedReceiptDate><ReferenceNum>3474630181526</ReferenceNum></Line></Receipt></Receipts></Transaction><Transaction><MerchantID>Shu Uemura</MerchantID><UserID>shuxml01</UserID><Password>shuxml01</Password><TransactionType>BatchReceiptAuthorization</TransactionType><Receipts><Receipt><OrderID>0071657131_28_2009-10-26 175243</OrderID><Type>PO</Type><VendorID>Streetsboro</VendorID><ShipToName>Innotrac</ShipToName><ShipToAddress1>605 W Crossroads Parkway</ShipToAddress1><ShipToCity>Bolingbrook</ShipToCity><ShipToRegion>IL</ShipToRegion><ShipToCountry>USA</ShipToCountry><ShipToPostalCode>60440</ShipToPostalCode><FreightTerms>DESTINATION</FreightTerms><WarehouseID>WHSE1</WarehouseID><Line><LineNum>1</LineNum><ProductID>878604000142</ProductID><Quantity>24</Quantity><Price>0.00</Price><ExpectedReceiptDate>2009.10.15 17:10:36 EST</ExpectedReceiptDate><ReferenceNum>878604000142</ReferenceNum></Line><Line><LineNum>2</LineNum><ProductID>878604000166</ProductID><Quantity>48</Quantity><Price>0.00</Price><ExpectedReceiptDate>2009.10.15 17:10:36 EST</ExpectedReceiptDate><ReferenceNum>878604000166</ReferenceNum></Line></Receipt></Receipts></Transaction></ns0:Message1></ns0:Messages>
Please Suggest me why iam getting an error in Moni.
Appreciate your Help.
Thanks
Srinivas
Edited by: Srinivas on Oct 26, 2009 6:01 PM
Closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.