on 10-19-2006 5:33 PM
Hi!
I want to access a XML file in an user defined function in a message mapping. The XML file is included in an imported archive. I need the information out of this XML file for configuring an extended receiver determination.
Does anyone know how to solve this?
Best regards,
Daniel
HI,
But you can use of Property file for that. -E.g-
/people/sap.user72/blog/2006/06/07/property-file-a-smart-use-in-xi-context
But I don't think so, you can access file from imported archive ..
So you can plan for Property file option for this.
Regards,
Moorthy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Krishna,
a property file will be a solution but is has to be stored in the filesystem. In my scenario I prefer a file (not neccessary xml) which is editeable in the IR.
I tried something in this way (just for testing):
try {
DocumentBuilderFactory factory = null;
DocumentBuilder builder = null;
Document document = null;
Element element = null;
factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
document = builder.parse(Container.class.getResourceAsStream("routing.xml"));
element = (Element)document.getElementsByTagName("BUSINESS_SYSTEM").item(0);
return element.getNodeValue();
} catch (Exception e) {
return "Crash: "+e.getMessage();
}
But it crashes, because the resource "routing.xml" cannot be found. I tried to add the namespace or the name of the imported archive or both as prefix, but it don't work. How can I find out under which address/url I can open the xml document?
Best regards,
Daniel
Daniel,
from what I've observed, you can access single files inside .jars using getResourceAsStream() method (pure getResource() won't work, don't know why), when doing java mappings. To check the full path of file, go for the imported .jar and check the path of that file.
If you have files with association to other files (for example, .xsds with import or include tags) the system won't be able to find the associations.
But for UDF's, I guess you had to have the file in the same class .jar. I don't if that's possible. I think you'll have to use filesystem solution...
Regards,
Henrique.
Hi Henrique,
thanks for the answer
A filesystem solution... I just try to get away from that, because it makes the installation of the content more complicated
I saw an XI solution which used this technique, but unfortunately I haven't took a deeper look how they solved it.
Best regards,
Daniel
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.