on 07-01-2008 1:54 PM
Hi...
Can anyone tell me about how to validate the schemas in PI 7.0.
http://72.14.235.104/search?q=cache:xXUqSuBD2BIJ:https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/d...validatetheschemasinSAPPI&hl=en&ct=clnk&cd=1&lr=lang_en
ur answer
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To validate xml from source side with the help of Adapter modules in XI.
Similarly we can handle any type schema validation with xml validation tools or xml schema conversion tools.
The same concept will be used to convert the source schema into valid XI xml schema ( Edi message to normal xml)
Also we can use Java mapping (SAX for structure changes) to validate schema itself.
Check the below links for more details
http://www.xmlconverters.com/customers/sap-review.html
On how to create XML docs with SAX and DOM go thruugh these links:
http://www.cafeconleche.org/books/xmljava/chapters/ch09.html
http://www.cafeconleche.org/books/xmljava/chapters/ch06.html
http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
DOM parser API
http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi leela,
you can write an adapter module, for validating schemas in PI7.0
regards,
Madhav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is the method validation which you can use in adapter module .
Use SAX /DOM parsing to prepare the output document if any change is required for the output file structure after validation.or else if the file is valid just send the inputstream as it is as the output (SAX is a better option for changing structure)
The code is to validate the xml with no namespace schema location .please palce the xsd on server inside usr/sap/<SID>/DVE/j2ee/cluster/server0 folder
public boolean validateXml(byte[] xmlName)
{
// preparing the XML file as a input source
InputSource source =
new InputSource(new java.io.ByteArrayInputStream(xmlName));
//String parserClass = "org.apache.xerces.parsers.SAXParser";
String parserClass = "com.sap.engine.lib.xml.parser.SAXParser";
String validationFeature = "http://xml.org/sax/features/validation";
String schemaFeature =
"http://apache.org/xml/features/validation/schema";
//String namespacesFeature = "http://xml.org/sax/features/namespaces";
//String noNamespaceProperty ="http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation";
//String dynamicFeature = "http://apache.org/xml/features/validation/dynamic";
//XMLValidationBean vl = new XMLValidationBean();
try
{
XMLReader r = XMLReaderFactory.createXMLReader(parserClass);
r.setFeature(validationFeature, true);
//r.setFeature(namespacesFeature,true);
//r.setFeature(dynamicFeature,true);
r.setFeature(schemaFeature, true);
r.setErrorHandler(this);
//
// if(checkOrderType(xmlName))
// r.setProperty( "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" , "EDItX_TradeOrder_V1.1.xsd");
// else
// r.setProperty( "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation" , "abc.xsd");
//
r.parse(source);
//System.out.println("ValidateXML :" + isValid);
}
catch (SAXException e)
{
isValid = false;
Audit.addAuditLogEntry(
myAuditMsgKey,
AuditLogStatus.ERROR,
"Exception : " + e.getCause());
}
catch (IOException e)
{
Audit.addAuditLogEntry(
myAuditMsgKey,
AuditLogStatus.ERROR,
"Exception : " + e.getMessage());
}
catch (Throwable e)
{
Audit.addAuditLogEntry(
myAuditMsgKey,
AuditLogStatus.ERROR,
"Exception : " + e.getMessage());
}
//Audit.flushAuditLogEntries(myAuditMsgKey);
return isValid;
}
Edited by: Progirl Progirl on Jul 2, 2008 6:41 AM
This is the answer to youre question.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you need PI 7.1 for schema validation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.