on 04-29-2008 4:17 PM
Hello everyone!
We are using XI with Netweaver 2004 and have programmed our own adapter for message transformations.
After the transformation we want to validate the generated XML file with the validator from SAP XML Toolkit.
Validator validator = new Validator();
String[] xsdFileNames = new String[]{
"???/de/nordakademie/ext/gen/" + ediStandard + "/" + parser.getEdiVersion().toLowerCase() + "/xsd/" + parser.getEdiMessageName().toLowerCase() + ".xsd",
"???/de/nordakademie/ext/gen/" + ediStandard + "/" + parser.getEdiVersion().toLowerCase() + "/xsd/segments.xsd"
};
boolean isValid = validator.validate(byteIn, xsdFileNames);
But we don't know how to address the necessary xsdFiles for the transformation. At the moment we get thw following error: [location : null] ERROR : E:\...\de\nordakademie\ext\gen\edifact\d96a\xsd\orders.xsd (The system cannot find the path specified)
The xsd files are located in the following package: de.nordakademie.ext.gen.edifact.d96a.xsd.
This package is part of a jar file which was deployed to the J2EE-Engine in a Libary.
But how can we access these files in the code example above?
Thanks in advance!
Did you assign a reference to the library in the deployment descriptor of your adapter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This problem was due to a deployment problem on our server....
Edited by: Stefan Tanck on Apr 30, 2008 5:44 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately this solution only worked until I deployed the library containing the xsds another time.
Now I'm getting this error:
SchemaException: [location : null] ERROR : JAR entry de/nordakademie/ext/gen/abc.xsd not found in E:\usr\sap\CX1\DVEBMGS00\j2ee\cluster\server0\bin\ext\de.nordakademie~MyLibrary\MyJar.jar
But when I take a look on the server the determined directory and jar file exists and contains exactly that folder structure and xsd files. What's wrong?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Use standard validation from SAX/DOM parsers:
http://help.sap.com/saphelp_nw70/helpdata/EN/c4/e1343e8c7f6329e10000000a114084/frameset.htm
For how to access the .xsds inside .jar file, check Franz Forsthofer's reply in this thread:
If your .xsds refer to other .xsds (in import or include statements), check my last message on the same topic.
Regards,
Henrique.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey!
Thanks for your help. I ha´ve now solved the problem. The following code works:
String xsdMessagePath = "de/nordakademie/ext/gen/.../abc.xsd";
String xsdSegmentsPath = "de/nordakademie/ext/gen/.../xyz.xsd";
Validator validator = new Validator();
URL xsdMessageUrl = getClass().getClassLoader().getResource(xsdMessagePath);
URL xsdSegmentsUrl = getClass().getClassLoader().getResource(xsdSegmentsPath);
String[] xsdFileNames = new String[]{
xsdMessageUrl.toString(),
xsdSegmentsUrl.toString()
};
boolean isValid = validator.validate(byteIn, xsdFileNames);
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
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.