OSB How to parse not well formed XML with Any XML Service - osb

Hi i am using OSB 11g.
I am having trouble whith not well formed xml.
My service has to be any xml service. Some of the xml's I receive are not well formed.
If i use messaging service is able to check an not well formed xml in the java callout.
but when I use any xml service before the java callout osb tries to parse the xml
and i get this error : Failure while unmarshalling message: Failed to parse XML text
Is there any way to handle not well formed xml in any XML service ?
When i receive a not well formed XML I want to handle it in the java callout.

I know nothing about OSB, but...
A standard XML parser will not parse ill-formed XML.
There are "tolerant" parsers out there which will attempt to recover and deliver their best guess at what you intended. I believe the W3C's "tidy" tool can be (ab)used for this purpose; there are others. Mostly these are used in authoring environments such as text editors with "xml assist" modes or tools to do a one-time fixup of data, because the best guess is often incomplete or wrong and a human has to be involved in helping to correct the problem.
The better answer, in the long term, is to get the folks producing your XML to fix their tools. The best reason for using XML is interoperability, and if it isn't correct XML it isn't interoperable.

Related

Receive XML post to Salesforce Sites page

I'm currently looking at building a lightweight integration between PivotalTracker and Salesforce.com. Reviewing this bit of PT documentation, it looks like I can do an update of Salesforce data based on PT activity. Awesome! I can't figure out how to access the XML data that is being posted however.
I can't see anything in ApexPages.CurrentPage() that looks like it will let me get to the XML. Has anyone done anything like this, without the use of an intermediate server?
I think we chatted about this over Twitter last week.
AFAIK there is (somewhat annoyingly) no way to access raw (i.e. not form posted key/values) POST data via SFDC. The Apex REST service support would be the closest thing, but requires authentication and still may not do exactly what you want.
Fairly certain you'll need some sort of middle-man proxy that simply takes the XML data and posts it to VF as a form-encoded key/value pair. That is a fairly trivial thing to do, but it's an unnecessary additional moving part and will require some sort of server resource.
I would probably first investigate if PT supports any other ping mechanism, or a way to write a custom extension to convert the raw POST into a form POST.

Transfer files via ODATA

Is it possible to transfer files via an ODATA service?
when there is a possibility, how could i do that?
I already searched a lot on the internet but i couldnt make it to find a proper example.
There's a great walkthrough here: https://devblogs.microsoft.com/odata/data-services-streaming-provider-series-implementing-a-streaming-provider-part-1/ and then https://devblogs.microsoft.com/odata/data-services-streaming-provider-series-part-2-accessing-a-media-resource-stream-from-the-client/.
It describes a way to expose streams based on an EF provider. There's also a way to upload the stream to the server.
Note that there's nothing "OData" about the streams as such. The sample above just uses OData as the metadata for the streams and uses simple REST to get and/or upload the stream.
Since you can save and retrieve binary data to/from a database and Edm.Binary is supported by the data model this should be possible. You could save your file in binary format in a database column and then expose it through your model and the OData API.

Obtaining Raw Data from NagiosXI and/or OPSview

I am currently working on completing my Masters Thesis project. In order to do so I need to be able to obtain the raw data accumulated in NagiosXI and/or OPSview. Because both of these are based off of the Nagios core, I assume the method to obtaining the raw data may be similar. This raw data is needed so that I can at a later time perform specific statical calculations which relate to my Masters Thesis. I have looked online and so far found some Nagios plugins which obtain raw data and then manipulate it for graphs and visuals, but I need the raw numbers in order to complete my calculations.
I am also researching to see if I can create maybe a PHP script, or some other language, that will extract the data from Nagios and save it in a word or excel document. However, this would be a bit of extra work as I am unfamiliar with either PHP or MySQL queries. Because of this I hope to be able to find a plugin, or something similar, that can get the data for me.
Cyanide,
I can't speak for NagiosXI, but I can for Opsview :)
You could access the data that is stored in the RRD files. You can use rrdtool dump to pull the values out or use a URL like: /rrdfetch?start=1307608993&end=1307695393&hsm=opsview%3A%3ACheck%20Loadavg%3A%3Aload1&hsm=opsview%3A%3ACheck%20Loadavg%3A%3Aload5
And this returns back the JSON data points. This is undocumented, but is used to power the interactive javascript graphing.
Alternatively, if you have ODW enabled with full statistics, then the raw data is stored in the ODW database and you can then extract the raw data with SQL commands. See http://docs.opsview.com/doku.php?id=opsview-community:odw for more information.
Ton
You can try use mk livestatus http://mathias-kettner.de/checkmk_livestatus.html
or http://exchange.nagios.org/directory/Addons/APIs/JSON/Nagios2JSON/details
All this tools get you status data without need to go to DB or status file. While XI is based on Nagios it can still work with him.
Please take a look at http://dmytro.github.com/nagira
It's a web services API to access Nagios data. You can get all hosts, service status data, objects configuration in multiple formats JSON, XML or YAML.

SELECT ... FOR XML into a file

I have a query returning large XML, its size can reach 1GB in extreme cases, but normally it takes hundreds of megabytes.
The obvious approach when client program receives all the data at once and keeps it in memory doesn't work in this case.
Is there any way to make SQL Server output result into a file? Or maybe it could deliver resulting data piece by piece? In the latter case it would be trivial to direct the ouput to a file without loading everything to memory.
According to the statement of problem the resulting XML is to be transformed by XSLT which would produce much smaller result. Ideally the server should be instructed to output XML data into a pipe which could be connected to xslt engine being run as a separate process. However I don't see any way to do this.
Are there any ideas?
Thank you.
Client program is to be written in C# 3.
SQL Server version is 2005, however if some really good solution exists in 2008 only, this restriction should not be considered essential
Assuming you are using a .NET language and ADO.NET, here
http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson02.aspx
you find a example how to feed the result set of a SELECT SQL to the Console stream using an SqlDataReader. Replace the Console by a file stream and you are done.
Unfortunately, that works only if your XML is stored in several text rows, line-by-line. If your XML is stored in a BLOB field, you need some kind of chunking. Read this article how to do this:
http://support.microsoft.com/kb/317034/EN-US

Simplest way to convert XML file and/or web service to a flat file

I am starting a project in which I need to get two sets of data into flat files. Source A is a web service that is updated daily, so I only need to hit this once a day. Source B is an XML file on an FTP site that I will also retrieve daily.
I have never converted XML to a flat file before. I'm a SQL Server guy, so my initial thought was to work on getting the data into SQL Server, then export to flat files. However, am I wasting my time doing that? Should I just use a conversion tool such as XMLConvert and skip SQL Server entirely? The data files are fairly small, so performance is not an issue. I need to get this done as quickly as possible. What suggestions do you folks have? Thank you!
I have used Stylus Studio to create XSLT and was very happy with the features.
http://www.stylusstudio.com/
I have also used XML Spy, but not the XSLT features.
http://www.altova.com/xmlspy.html
Once you have the XSLT created the code to transform the XML is fairly straightforward.
http://msdn.microsoft.com/en-us/library/ms757854(v=VS.85).aspx
I've used this method to convert XML into HTML, but not a flat file, but it should work.
Converting XML to other (text-based) formats is probably best done using something like XSLT. http://www.w3schools.com/xsl/

Resources