Custom parser difficulties.
I am trying to parse a Windows 2008 '4624' event log entry as a proof-of-concept before parsing other high-priority Windows Server 2008 events.
I have created a 'parser' which will work flawlessly when using the 'test' feature within Mars 6.x.
However I am unable to get this 'parser' to interpret incoming events from the server.
* Events are being forwarded from the server using snare.
* Copying the event from 'Event raw messages' report output (where "Parsing error or event type unknown:" has been pre-pended to the message)
and pasting directly into the parser test screen, the message will be successfully parsed by the test parser.
* I have configured the device as a 'windows-generic' device but have NOT configured the MARS to receive OR pull logs from the device - hence, the only software configured on the device is the custome framework I have created.
Anyone any thoughts or have I missed something very simple?
Kind regards
Colm
Hi,
try:
1. To create a new one device type (as example win2008 generic).
2. Create a new device event type (add to this NEW event type).
3. Then create parser's patterns.
4. Then create new device (selest OS Windows --->>> Receive events ), go to tab Reporting applications and add a new one created device type (as example Win 2008 generic)
5. Thats all.
P.S In snare please enable syslog header. Thats all.
Kind regards,
Nick
Similar Messages
-
Mars 6.1.2 custom parser error
Hello!
I have Cisco MARS 55 v. 6.1.2 (3466) 39.
I'm trying to import custom parser fo Radware. I've already done it with older version of MARS (6.0.X) and everything was ok.
But now I've getting "error processing package improt".
What can be the reason for this error?
Nick.I've trying to ipmport others custom pasers from this forum, getting
the same problem. -
Custom Parser for ESX version 3.5 machine
Has anyone done a customer parser for a VMWARE ESX machine running version 3.5 software?
We want the machine itself to report to MARS and we don't have any experience with the type of Device Event IDs which it produces. We are interested in things like login failures, account lockouts, and high CPU utilization messages.
Pointing me in the right direction would be a big help and would be rated very positively.
Thanks in advance.Hi again,
I'm trying to write XML pareser implementing XmlParserInterface. I have implemented parse methods and used IfsXmlParser.CreateDOM to get parsed XMLDocument.
As far as I know, my xml parser should be instaneiated by IfsXmlParser, which in turn calls one of parse methods. The problem is that XmlParserInterface doesn't contain constructors to implement. For example, interface Parser has constructor with argument of type LibrarySession.
How I can get current LibrarySession from my XML parser? Should I implement both interfaces Parser and XmlParserInterface?
Thanks for any help,
Alexandre.
PS: are Java sources of iFS available somewhere? It would be helpful to get knowledge of how the things working. There is no documentation for creating XML parsers. I have only found about writing usual custom parsers in Developer Guide and a little in iFS API. But that is very scant. :((( -
How to activate a custom parser ?
I have written a small custom parser which should deal with *.txt documents. If
called by an application the parser works.
Now, I have tried to register the parser
in iFS so that it is invoked automatically
whenever a *.txt file is submitted via one
of the standard protocol servers (e.g. Smb).
I put the *.class file of the parser in my $ORACLE_HOME/ifs/custom_classes directory and uploaded the following xml-file using ifsput into ifs (as system user):
<?xml version="1.0" standalone="yes"?>
<!--TxtParser.xml-->
<PROPERTYBUNDLE>
<UPDATE RefType="valuedefault">ParserLookupByFileExtension</UPDATE>
<PROPERTIES>
<PROPERTY ACTION="add">
<NAME>txt</NAME>
<VALUE DataType="String">TxtParser</VALUE>
</PROPERTY>
</PROPERTIES>
</PROPERTYBUNDLE>
The parser was successfully registered as the
entry in the corresponding Register... dialog in the iFS manger shows, but it is not used. Its initialization message does not appear on any log and the insertion of a new *.txt file does not lead to the desired parser activity.
Do I have to do some additional installation/registration procedures or
must I deregister the default parser for txt somehow ?
Greetings, Michael Skusa
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Mark_D_Drake():
Given that the parser is not in a package can you tell me what happens when you insert a ".txt" file into the iFS.
<HR></BLOCKQUOTE>
I insert a file via SMB, but nothing
happens. I neither get log entries nor any
error messages. The file is stored correctly,
but there is no parser activity. Even
log files like those which are generated
for xml files are not generated.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>
Do you create any log file from you parser that might indicate whether or not the parser was instantiated. Could you post the code...
<HR></BLOCKQUOTE>
Currently I do not create log files. I write
an initialization message to stdout, but
I do not know where this message would appear
when the parser is called by iFS.
Perhaps a look at the code could help. Most
of the code is a copy of an example from
the iFS developer's guide.
I just have modified the parse method.
And I added a main method so that I can call
the parser directly with a file from the
local file system in order to test its
functionality. This works as it should.
But the automatic invocation by iFS does
not work. I registered the "parser lookup"
by uploading the xml configuration file
(see earlier mails) with ifsput, which was
successful.
Registration by copying the xml file to iFS via SMB resulted in an error of the internal XML parser
(root element expected in line 0, column 0).
This is the code of my sample parser:
import oracle.ifs.common.*;
import oracle.ifs.beans.*;
import oracle.ifs.beans.parsers.*;
import oracle.ifs.beans.LibraryObject;
import java.util.Hashtable;
import java.io.*;
class TxtParser implements Parser
private LibrarySession session;
public TxtParser (LibrarySession s) {
session = s;
System.out.println("TxtParser initialized.");
public LibraryObject parse(InputStream stream , ParserCallback callback, Hashtable options) {
return parse (new InputStreamReader(stream), callback, options);
public LibraryObject parse(Reader reader, ParserCallback callback, Hashtable options) {
try {
// This part is copied from a sample program of the developer's guide
DocumentDefinition newDocDef = new DocumentDefinition(session);
String fileName = (String) options.get(Parser.CURRENT_NAME_OPTION);
newDocDef.setAttribute("NAME", AttributeValue.newAttributeValue(fileName));
Format f = (Format) session.getFormatCollection().getItems("Text");
newDocDef.setFormat(f);
newDocDef.setContentReader(reader);
Document d = (Document) session.createPublicObject(newDocDef);
String folderName = (String) options.get(Parser.CURRENT_PATH_OPTION);
Folder target = (Folder) session.getRootFolder().findPublicObjectByPath(folderName);
target.addItem(d);
// look up a log file in ifs folder "public" and append a message
Document log = (Document) session.getRootFolder().findPublicObjectByPath("/public/docs.log");
InputStreamReader is = new InputStreamReader(log.getContentStream());
StringBuffer buffer = new StringBuffer();
char[] exchangeBuffer = new char[100];
try{
int read = is.read(exchangeBuffer);
while (read > 0) {
buffer.append(exchangeBuffer,0,read);
read = is.read(exchangeBuffer);
} catch (IOException e) {}
buffer.append("\nfile "+fileName + " inserted into " + folderName);
DocumentDefinition logDef = new DocumentDefinition(session);
logDef.setContentReader(new StringReader(buffer.toString()));
logDef.setAttribute("NAME", AttributeValue.newAttributeValue("docs.log"));
log.free();
log = (Document) session.createPublicObject(logDef);
target = (Folder) session.getRootFolder().findPublicObjectByPath("/public/");
target.addItem(log);
return d;
} catch (IfsException e) {
e.printStackTrace();
return null;
public static void main (String[] args) throws Exception {
LibraryService ifsService = new LibraryService();
CleartextCredential me = new CleartextCredential("s cott","tiger");
ConnectOptions connectOpts = new ConnectOptions();
connectOpts.setServiceName("IfsDefault");
connectOpts.setServicePassword("ifssys");
LibrarySession ifsSession = ifsService.connect(me,connectOpts);
TxtParser p = new TxtParser(ifsSession);
Hashtable options = new Hashtable();
if (args.length > 0) {
options.put(Parser.CURRENT_NAME_OPTION,args[0]);
options.put(Parser.CURRENT_PATH_OPTION,"/home/scott/Experimente/");
FileInputStream f = new FileInputStream(args[0]);
p.parse(f,null,options);
ifsSession.disconnect();
null -
Hello forum,
I want to put in iFS XML documents with binary content encoded in base64.
I have created "PrintedDoc" base on "Document" with new attributes: Name, Pages, PeportName.
I created test XML file and iFS parses it just fine.
This is an example of XML file:
<?xml version = '1.0' standalone = 'yes'?>
<PrintedDoc>
<Name> Angebot-Nr. 123 vom 12.06.2002.pdf </Name>
<FolderPath> /printed/Angebote </FolderPath>
<Pages> 3 </Pages>
<Format RefType="name"> PDF </Format>
<ReportName> Angebot </ReportName>
<Content>AABC-+.....AABCD</Content>
</PrintedDoc>
Now I want to decode content back into binary format and store binary data. I have written java class for decoding. I will write a parser that decodes base64 content into binary data.
My question: How I can register my parser for that xml document? I read about including namespace into document and registering custom XML parser, but this will give me the whole xml document as incoming data.
I would appreciate if you share your experience or give some hints.
TIA
AlexandreHi again,
I'm trying to write XML pareser implementing XmlParserInterface. I have implemented parse methods and used IfsXmlParser.CreateDOM to get parsed XMLDocument.
As far as I know, my xml parser should be instaneiated by IfsXmlParser, which in turn calls one of parse methods. The problem is that XmlParserInterface doesn't contain constructors to implement. For example, interface Parser has constructor with argument of type LibrarySession.
How I can get current LibrarySession from my XML parser? Should I implement both interfaces Parser and XmlParserInterface?
Thanks for any help,
Alexandre.
PS: are Java sources of iFS available somewhere? It would be helpful to get knowledge of how the things working. There is no documentation for creating XML parsers. I have only found about writing usual custom parsers in Developer Guide and a little in iFS API. But that is very scant. :((( -
I am tryint to write a custom XML parser but I am having trouble accessing the Value fields. I need to use one of the Value Fields to determine which parser I need to use for my custom Class Objects. Below is my sample code and a sample XML Document that I am trying to Parse. I hope that it will reformat. If not then I am sorry for the format.
public LibraryObject parse(InputStream p_file, ParserCallback p_callBack, Hashtable p_opts)
throws oracle.ifs.common.IfsException
XMLDocument xmlDoc = new XMLDocument();
IfsXmlParser parser = new IfsXmlParser(m_Session);
xmlDoc = parser.createDOM(p_file, false);
NodeList list = xmlDoc.getElementsByTagName("Value");
for (int i=0; i < list.getLength(); i++) {
printNodeInfo(list.item(i));
// This gives me a Type Casting error!
// Here is the problem
CharacterData temp = (CharacterData)list.item(i);
<?xml version='1.0'?>
<Records>
<Record>
<Field id='Remote_User' type='string' length='30'></Field>
<Field id='Time_Stamp' type='string' length='30'><Value>02/01/01 02:03:13 PM</Value></Field>
<Field id='Suspense_File' type='string' length='30'><Value>T:\teleform\bat\00000053\7H6CUO0000.tct</Value></Field>
<Field id='Remote_Uid' type='number' length='10'><Value>-1</Value></Field>
<Field id='Remote_Fax' type='string' length='30'><Value>Y087EY0000.TIF</Value></Field>
<Field id='Form_Id' type='number' length='10'><Value>18567</Value></Field>
<Field id='OrigPgSeq' type='string' length='128'><Value>0</Value></Field>
<Field id='Orig_File' type='string' length='128'><Value>T:\teleform\bat\00000053\HDKHBA0000.tct</Value></Field>
<Field id='SKFI_Zone_1' type='string' length='30'></Field>
<Field id='First_Name' type='string' length='15'><Value>Jason</Value></Field>
<Field id='Middle_Name' type='string' length='15'><Value>Paul</Value></Field>
<Field id='Last_Name' type='string' length='30'><Value>Adkison</Value></Field>
<Field id='Suffix' type='string' length='10'><Value>Mr</Value></Field>
<Field id='Address_1' type='string' length='50'><Value>5532 Overlook NE</Value></Field>
<Field id='Address_2' type='string' length='50'><Value>Albuquerque</Value></Field>
<Field id='Zip_Code' type='string' length='15'><Value>87111</Value></Field>
<Field id='Home_Phone' type='string' length='15'><Value>505-555-5555</Value></Field>
<Field id='Work_Phone' type='string' length='15'><Value>505-555-5555</Value></Field>
<Field id='E_Mail' type='string' length='20'><Value>[email protected]</Value></Field>
</Record>
</Records>Jason
You are making incorrect assumptions regarding what is contained in the NodeList.
The folllowing should explain
public void doSomething(LibrarySession ifs)
throws IfsException
try {
InputStream is = new FileInputStream("c:\\temp\\testfile.xml");
IfsXmlParser parser = new IfsXmlParser(ifs);
XMLDocument xmlDoc = parser.createDOM(is,false);
xmlDoc.print(System.out);
NodeList nodes = xmlDoc.getElementsByTagName("Value");
for (int i=0;i<nodes.getLength();i++) {
Node node = nodes.item(i);
System.out.println("Node " + i + " is an instance of " + node.getClass());
System.out.println("The value of the Text for the Node is " + node.getFirstChild().getNodeValue());
} catch (java.io.IOException x) {
throw new IfsException(9999,x);
generates
Transaction Started.
<?xml version = '1.0'?>
<Records>
<Record>
<Field id="Remote_User"
type="string" length="30"/>
<Field id="Time_Stamp" type="string" length="30">
<Value>02/01/01 02:03:13 PM</Value>
</Field>
<Field id="Suspense_File" type="string" length="30">
<Value>T:\teleform\bat\00000053\7H6CUO0000.tct</Value>
</Field>
<Field id="Remote_Uid" type="number" length="10">
<Value>-1</Value>
</Field>
<Field id="Remote_Fax" type="string" length="30">
<Value>Y087EY0000.TIF</Value>
</Field>
<Field id="Form_Id" type="number" length="10">
<Value>18567</Value>
</Field>
<Field id="OrigPgSeq" type="string" length="128">
<Value>0</Value>
</Field>
<Field id="Orig_File" type="string" length="128">
<Value>T:\teleform\bat\00000053\HDKHBA0000.tct</Value>
</Field>
<Field id="SKFI_Zone_1" type="string" length="30"/>
<Field id="First_Name" type="string" length="15">
<Value>Jason</Value>
</Field>
<Field id="Middle_Name" type="string" length="15">
<Value>Paul</Value>
</Field>
<Field id="Last_Name" type="string" length="30">
<Value>Adkison</Value>
</Field>
<Field id="Suffix" type="string" length="10">
<Value>Mr</Value>
</Field>
<Field id="Address_1" type="string" length="50">
<Value>5532 Overlook NE</Value>
</Field>
<Field id="Address_2" type="string" length="50">
<Value>Albuquerque</Value>
</Field>
<Field id="Zip_Code" type="string" length="15">
<Value>87111</Value>
</Field>
<Field id="Home_Phone" type="string" length="15">
<Value>505-555-5555</Value>
</Field>
<Field id="Work_Phone"
type="string" length="15">
<Value>505-555-5555</Value>
</Field>
<Field id="E_Mail" type="string" length="20">
<Value>[email protected]
</Value>
</Field>
</Record>
</Records>
Node 0 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 02/01/01 02:03:13 PM
Node 1 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is T:\teleform\bat\00000053\7H6CUO0000.tct
Node 2 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is -1
Node 3 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Y087EY0000.TIF
Node 4 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 18567
Node 5 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 0
Node 6 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is T:\teleform\bat\00000053\HDKHBA0000.tct
Node 7 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Jason
Node 8 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Paul
Nod e 9 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Adkison
Node 10 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Mr
Node 11 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 5532 Overlook NE
Node 12 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is Albuquerque
Node 13 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 87111
Node 14 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 505-555-5555
Node 15 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is 505-555-5555
Node 16 is an instance of class oracle.xml.parser.v2.XMLElement
The value of the Text for the Node is [email protected]
Transaction Completed.
Successful End of Program.
null -
We've a business partner who requires us to create a service request message with a SAML 2.0 assertion. The partner's supplied two certificates and a test harness for their JAVA webservice.
I've created a WCF client with a `CustomBinding` to try and recreate the request and consume the service, but I'm getting so frustrated with the nuances of WCF (and the lack of intrinsic support for SAML 2.0) I'm wondering am I better off using something like
a `WebClient` or `HttpWebRequest` and encrypting/building & signing the XML web request and doing the same for the response. I know there's a lot of work involved on this but at least I'd be in full control.
Your advice would be very much appreciated, what I'm working with is displayed below
**Note: I was supplied with a SoapUI Test harness for the Java service**
**The vendor supplied me with this request (ran though SOAPUI and extracted via Fiddler)**
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
<SOAP-ENV:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<xenc:EncryptedKey Id="EncKeyId-29B98C291D1FDFB39113352984774895">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<wsse:SecurityTokenReference>
<ds:X509Data>
<ds:X509IssuerSerial>
<ds:X509IssuerName>CN=test_server</ds:X509IssuerName>
<ds:X509SerialNumber>12356789</ds:X509SerialNumber>
</ds:X509IssuerSerial>
</ds:X509Data>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>
<!--Omitted -->
</xenc:CipherValue>
</xenc:CipherData>
<xenc:ReferenceList>
<xenc:DataReference URI="#EncDataId-3"/>
</xenc:ReferenceList>
</xenc:EncryptedKey>
<wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="CertId-29B98C291D1FDFB39113352984773591" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><!-- Omitted --> </wsse:BinarySecurityToken>
<ds:Signature Id="Signature-1" xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#id-2">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue>
<!--Omitted -->
</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue>
<!--Omitted -->
</ds:SignatureValue>
<ds:KeyInfo Id="KeyId-29B98C291D1FDFB39113352984773792">
<wsse:SecurityTokenReference wsu:Id="STRId-29B98C291D1FDFB39113352984773893" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Reference URI="#CertId-29B98C291D1FDFB39113352984773591" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
</ds:Signature>
</wsse:Security>
<saml:Assertion ID="_54d0c8395de26c3e44730df2c9e8d3e9" IssueInstant="2012-02-17T10:40:36.806Z" Version="2.0" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<saml:Issuer>CN=test_client</saml:Issuer>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_54d0c8395de26c3e44730df2c9e8d3e9">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted -->
</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
<!--Omitted -->
</SignatureValue>
<KeyInfo>
<X509Data>
<X509Certificate>
<!--Omitted -->
</X509Certificate>
</X509Data>
</KeyInfo>
</Signature>
<saml:Subject>
<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress">[email protected]</saml:NameID>
</saml:Subject>
<saml:Conditions NotBefore="2012-02-17T10:40:21.806Z" NotOnOrAfter="2012-02-17T10:41:06.806Z"/>
</saml:Assertion>
<wsa:Action SOAP-ENV:mustUnderstand="1">http://www.xxxxxxx.xxx/ws/schemas/xxxxxx1/xxxx/xxxxxxxxxxxxxx</wsa:Action>
<wsa:MessageID SOAP-ENV:mustUnderstand="1">uuid:bffc27ba-68d9-44e6-b1f0-e2f852df7715</wsa:MessageID>
</SOAP-ENV:Header>
<SOAP-ENV:Body wsu:Id="id-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<xenc:EncryptedData Id="EncDataId-3" Type="http://www.w3.org/2001/04/xmlenc#Content">
<xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Reference URI="#EncKeyId-29B98C291D1FDFB39113352984774895"/>
</wsse:SecurityTokenReference>
</ds:KeyInfo>
<xenc:CipherData>
<xenc:CipherValue>
<!--Omitted -->
</xenc:CipherValue>
</xenc:CipherData>
</xenc:EncryptedData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
**This is as close as I've gotten with my WCF client. Issues I can immediatley is that the `<o:SecurityTokenReference>` element should contain the Issuer and Serial, instead it contains a `KeyIdentifier` element?**
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1" u:Id="_3"/>
<a:MessageID u:Id="_4">urn:uuid:fc8ef84b-dbf5-4150-a0c3-d4cc986333d1</a:MessageID>
<ActivityId CorrelationId="a9e1fec4-32bc-4633-909e-3d601c809b3c" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">d1909115-8922-46f3-a96c-db15bf91c599</ActivityId>
<a:ReplyTo u:Id="_5">
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo27oY4/3mnBOry0YL4StqvcAAAAA0UM+eVt4fU2AOe9/B3lPDZNf/2HmAuNEvzAoW0eKVSUACQAA</VsDebuggerCausalityData>
<a:To s:mustUnderstand="1" u:Id="_6">https://localhost:8089/ws</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<u:Timestamp u:Id="uuid-e5592f06-32af-40fb-996e-a0a469c7ed5e-2">
<u:Created>2012-04-24T20:41:50.447Z</u:Created>
<u:Expires>2012-04-24T20:46:50.447Z</u:Expires>
</u:Timestamp>
<e:EncryptedKey Id="uuid-e5592f06-32af-40fb-996e-a0a469c7ed5e-1" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<o:SecurityTokenReference>
<o:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#ThumbprintSHA1" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">lU10DQn4lSpE4fRpE9gslm5QDt0=</o:KeyIdentifier>
</o:SecurityTokenReference>
</KeyInfo>
<e:CipherData>
<e:CipherValue>
<!--Omitted-->
</e:CipherValue>
</e:CipherData>
<e:ReferenceList>
<e:DataReference URI="#_2"/>
<e:DataReference URI="#_7"/>
<e:DataReference URI="#_8"/>
</e:ReferenceList>
</e:EncryptedKey>
<o:BinarySecurityToken u:Id="uuid-fad0c01f-ab4b-4a5f-bec6-93aa8c2d5a52-1" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary"><!--Omitted--></o:BinarySecurityToken>
<e:EncryptedData Id="_7" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<e:CipherData>
<e:CipherValue>
<!--Omitted-->
</e:CipherValue>
</e:CipherData>
</e:EncryptedData>
<e:EncryptedData Id="_8" Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<e:CipherData>
<e:CipherValue><!--Omitted--></e:CipherValue>
</e:CipherData>
</e:EncryptedData>
</o:Security>
</s:Header>
<s:Body u:Id="_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<e:EncryptedData Id="_2" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<e:CipherData>
<e:CipherValue><!--Omitted--></e:CipherValue>
</e:CipherData>
</e:EncryptedData>
</s:Body>
</s:Envelope>
Using this configuration for the WCF CustomBinding
<system.serviceModel>
<bindings>
<customBinding>
<binding name="WSHttpBinding_IEnquiryRequest" >
<transactionFlow />
<security defaultAlgorithmSuite="TripleDesRsa15"
authenticationMode="MutualCertificate"
messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireDerivedKeys="false"
>
<secureConversationBootstrap authenticationMode="CertificateOverTransport"
messageSecurityVersion="WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10"
requireDerivedKeys="false" />
</security>
<textMessageEncoding messageVersion="Soap11WSAddressing10" />
<!--<mtomMessageEncoding messageVersion="Soap11WSAddressing10" />-->
<httpsTransport requireClientCertificate="true" />
</binding>
</customBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="certBehaviour">
<clientCredentials>
<!-- clientCertificate not defaultCertificate -->
<clientCertificate x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My" findValue="test_client" />
<serviceCertificate>
<defaultCertificate x509FindType="FindBySubjectName" storeLocation="CurrentUser" storeName="My" findValue="test_server"/>
<authentication revocationMode="NoCheck" certificateValidationMode="None" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint
address="https://localhost:8089/pvs/ws"
binding="customBinding"
bindingConfiguration="WSHttpBinding_IEnquiryRequest"
contract="XXXService.enquiryRequest"
name="WSHttpBinding_IEnquiryRequest"
behaviorConfiguration="certBehaviour"
>
<identity>
<dns value="test_server"/>
</identity>
</endpoint>
</client>
</system.serviceModel>
I've no idea how to insert the SAML 2.0 assertion in there before it's signed. That and the Key Issuer/serial issue above is where my main problems lie with the request.
Any and all help appreciated
Yaron,
Thanks a million for your response, think you hit the nail on the head there. Actually figured out the first part myself this morning, I've retrieved the SymmetricSecurityBindingElement object from the binding configured in the app.config and set it explicitly,
just as you've defined. Couldnt figure out how to do this yesterday for some reason! Here's the code for anyone that's interested:
//Get custom binding reference from app.config
CustomBinding binding = new CustomBinding("bindingNameInConfig");
// Reference the symmetric security element
SymmetricSecurityBindingElement securityBindingElement = binding.Elements.Find<SymmetricSecurityBindingElement>();
// Get the x509ProtectionParams from the security element
X509SecurityTokenParameters tokenParameters = new X509SecurityTokenParameters();
tokenParameters.X509ReferenceStyle = X509KeyIdentifierClauseType.IssuerSerial;
tokenParameters.RequireDerivedKeys = false;
tokenParameters.InclusionMode = SecurityTokenInclusionMode.AlwaysToInitiator;
// Set the X509SecurityTokenParameters to point to the one's just configured. This is for symetric encryption, for asymetric this line needs to change
securityBindingElement.ProtectionTokenParameters = tokenParameters;
Are you sure that SAML assertion is not signed? That makes things a lot easier! Do you think the following approach will work when inserting in the SAML 2.0 assertion? :
Create a class that inherits from IClientMessageInspector and insert the SAML as shown below
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
using System.Text;
using System.Xml;
using Microsoft.IdentityModel.Protocols.XmlSignature;
namespace TestClient.Application
class Saml20Extension : IClientMessageInspector, IEndpointBehavior
#region Implementation of IClientMessageInspector
public object BeforeSendRequest(ref Message request, IClientChannel channel)
MessageBuffer buffer = request.CreateBufferedCopy(int.MaxValue);
// ** Add the SAML Assertion XML here **
request = buffer.CreateMessage();
return null;
public void AfterReceiveReply(ref Message reply, object correlationState)
MessageBuffer buffer = reply.CreateBufferedCopy(Int32.MaxValue);
// ** REMOVE THE SAML ASSERTION HERE **
reply = buffer.CreateMessage();
#endregion
#region Implementation of IEndpointBehavior
public void AddBindingParameters(ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
// Add this implementation to the inspectors.
clientRuntime.MessageInspectors.Add(this);
public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
public void Validate(ServiceEndpoint endpoint)
#endregion
Also, There's a second signature being inserted into my WCF request that I need to replace with the SAML insertion - how do i get rid of the second signature?? (see updated request below)
POST https://localhost:8089/pvs/ws HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Host: localhost:8089
Content-Length: 6720
Expect: 100-continue
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<a:Action s:mustUnderstand="1" u:Id="_3"/>
<a:MessageID u:Id="_4">urn:uuid:84dc0bb8-13fd-4e90-84c4-ed1e6e831801</a:MessageID>
<ActivityId CorrelationId="07e0df62-d40a-4e24-aacc-12e626f80e8b" xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics">40077c44-d415-4567-99a1-1ea610c41d94</ActivityId>
<a:ReplyTo u:Id="_5">
<a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
</a:ReplyTo>
<VsDebuggerCausalityData xmlns="http://schemas.microsoft.com/vstudio/diagnostics/servicemodelsink">uIDPo1f0ZJ98FOxIvULl0pmGv/wAAAAAEGu5/G7VNkia/XbStJDa+ldqi+8xxdtAiBL+Y8vCqa0ACQAA</VsDebuggerCausalityData>
<a:To s:mustUnderstand="1" u:Id="_6">https://localhost:8089/pvs/ws</a:To>
<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<e:EncryptedKey Id="uuid-5b1de37e-ea76-4f75-b268-ebb63b554c11-1" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/>
<KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
<o:SecurityTokenReference>
<X509Data>
<X509IssuerSerial>
<X509IssuerName>CN=test_server</X509IssuerName>
<X509SerialNumber>123456789</X509SerialNumber>
</X509IssuerSerial>
</X509Data>
</o:SecurityTokenReference>
</KeyInfo>
<e:CipherData>
<e:CipherValue><!--Omitted--></e:CipherValue>
</e:CipherData>
<e:ReferenceList>
<e:DataReference URI="#_2"/>
</e:ReferenceList>
</e:EncryptedKey>
<o:BinarySecurityToken u:Id="uuid-d62ff21f-7e9b-460d-a0ee-d5fad221427d-1" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">MIIBpzCCARCgAwIBAgIETzKMfzANBgkqhkiG9w0BAQUFADAYMRYwFAYDVQQDDA10ZXN0X2ZhY2lsaXR5MB4XDTEyMDIwODE0NTM1MVoXDTE3MDIwODE0NTM1MVowGDEWMBQGA1UEAwwNdGVzdF9mYWNpbGl0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAvzdwlxcpwRKGzLvpqYoS4NEbhbx/jV6Z6kyXgJ0IWLZAW20oWmxPwumsqkKr6bWX2NWbGrka6w1e9+iZFBKiBq5zzxJKusCJQtPjuYwjaTGjVTFnixHp9sKnjIEprKyarceG00WzCVdtuI1NpNp8dgemzA6FFt1ESwwELq+rKvECAwEAATANBgkqhkiG9w0BAQUFAAOBgQAokX6HZhhEj7Bfo0Z8ZeoZeYFB8pHrN5A6927cJx17EXWVv0Mwn/+fDgTAhtsN9DB68CFNejox8mM0+KewjsgT4z80YxMHGlpM13z4c8+iMiQcJ7cISScTBaTONOtDqK1WNtci8biNjnLn7+4Z4fw17jlttN0dPHC3fvGywh6TkQ==</o:BinarySecurityToken>
<Signature Id="_0" xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"/>
<Reference URI="#_1">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
<Reference URI="#_3">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
<Reference URI="#_4">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
<Reference URI="#_5">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
<Reference URI="#_6">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
<!--Omitted-->
</SignatureValue>
<KeyInfo>
<o:SecurityTokenReference k:TokenType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey" xmlns:k="http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd">
<o:Reference ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey" URI="#uuid-5b1de37e-ea76-4f75-b268-ebb63b554c11-1"/>
</o:SecurityTokenReference>
</KeyInfo>
</Signature><!-- Why is this second signature here? how do i get rid of it and replace with SAML --> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<Reference URI="#_0">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>
<!--Omitted-->
</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>
<!--Omitted-->
</SignatureValue>
<KeyInfo>
<o:SecurityTokenReference>
<o:Reference ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" URI="#uuid-d62ff21f-7e9b-460d-a0ee-d5fad221427d-1"/>
</o:SecurityTokenReference>
</KeyInfo>
</Signature>
</o:Security>
</s:Header>
<s:Body u:Id="_1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<e:EncryptedData Id="_2" Type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:e="http://www.w3.org/2001/04/xmlenc#">
<e:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
<e:CipherData>
<e:CipherValue>
<!--Omitted-->
</e:CipherValue>
</e:CipherData>
</e:EncryptedData>
</s:Body>
</s:Envelope> -
How do I use my own Custom Auth/Authentication/Entitlement (Token)?
[ Background ]
Adobe Access DRM provides for 3 authentication mechanisms:
Anonymous - Licenses are issued irregardless on if there is/isn't a valid authentication token attached to the license request.
UsernamePassword - Licenses are ONLY issued if the license request has a valid Adobe-Access-Server-Issued authentication token.
Custom - Licenses are ONLY issued if there is a valid cusom authentication token attached to the license request.
Typically, customers already have some authentication scheme in place and choose to re-use that system, instead of leveraging Adobe Access' built-in usernamePassword support. For this to succeed, accomodations must be made during packaging time, on the client device, and at the Adobe Access license server endpoint.
[ More Background ]
Here's a forum thread that prompted this thread: http://forums.adobe.com/message/5085330#5085330
[ Recipe ]
1. Adobe Access DRM Policy is created that specifies a "custom" authentication token. As of Adobe Access 4.0, the tools that ship with the Java SDK cannot create a DRM policy with "custom" authentication out the box; a small Java application will have to be written to do this, which is covered in the thread posted above.
2. Content is packaged using this custom_auth policy.
3. Client device performs authentication via whatever channel already exists for you to perform authentication (e.g. SAML tokens, etc...)
4. Client device sets the authentication token: DRMManager.setAuthenticationToken()
5. Client device attempts to acquire a license for the content created in step #2: DRMManager.loadVoucher();
5a) Because step #4 set the authentication, all license requests going forward will automatically have this custom auth token appended to it
6. License server receives request & extracts custom auth token to parse & perform additional entitlement checks
7. Licnese server generates a license to return to client device.
[ Server Code Snippet (RefImplLicenseReqHandler.java) ]
try {
ServletInputStream in = request.getInputStream();
ServletOutputStream out = response.getOutputStream();
HandlerConfiguration context = super.getHandlerContext();
ServerCredential licenseServerCred = getLicenseParams().getLicenseServerCred();
licenseHandler = new LicenseHandler(context, in, out, licenseServerCred);
licenseHandler.parseRequest();
List<? extends LicenseRequestMessage> requests = licenseHandler.getRequests();
// Multiple request in one message is not supported in FAXS 2.0 or 3.0 client.
for (LicenseRequestMessage licenseReq : requests) {
try {
// TODO: If custom authentication is specified in the DRM policy, here is where
// you can retrieve the custom authentication token and perform custom parsing to
// determine further business rules and entitlement before issuing a license.
// The "Custom Authentication" will look like:
// 1. Client device obtains auth token using some other channel
// 2. Client device sets auth token by calling DRMManager.setAuthenticationToken()
// 3. Client makes a license request by calling DRMManager.loadVoucher()
// 4. Adobe Access Server receives request and:
// 4a) Determines Custom Auth is required by DRM Policy: licenseReq.getContentInfo().getContentMetadata().getPolicies()[0].getLicenseServerInfo(). getAuthenticationType();
// 4b) Retrieves Custom Auth token for custom parsing/handling: licenseReq.getRawAuthenticationToken()
// 5. If there are no errors when parsing the custom token, Adobe Access Server generates a license.
V2ContentMetaData metadata = licenseReq.getContentInfo().getContentMetadata();
ApplicationProperties applicationProperties = null;
String usageModelString = null;
if (metadata != null) {
applicationProperties = metadata.getCustomProperties();
if (applicationProperties != null) {
usageModelString = applicationProperties.getSingleValueAsUTF8String(DEMOMODE);
cheers,
/Eric.Google Search: '''firefox create a persona'''
* '''Personas for Firefox''' | How to Create Personas<br>https://www.getpersonas.com/en-US/demo_create
* '''Personas for Firefox''' | Frequent Questions<br>http://www.getpersonas.com/en-US/faq
* '''Personas for Firefox''' | Getting Started<br>http://www.getpersonas.com/en-US/getting_started
'''I think you'd have a lot more fun with Styles though''', personas tend to hide things on toolbars, styles can be more helpful (or just as bad)
* '''Stylish''' :: Add-ons for Firefox<br>https://addons.mozilla.org/en-US/firefox/addon/stylish/
* '''Restyle the web with Stylish!''' - userstyles.org<br>http://userstyles.org/
* '''Scrollbar Context Menu''' - Themes and Skins for Browser - userstyles.org<br>http://userstyles.org/styles/54
* '''Scrollbar Menu''' - Themes and Skins for Browser - userstyles.org<br>http://userstyles.org/styles/52
* '''Link Warning''' - Themes and Skins for Mozilla - userstyles.org<br>http://userstyles.org/styles/1301
* '''Tabs, Enlarge list-all-tabs button''' - Themes and Skins for Browser - userstyles.org<br>http://userstyles.org/styles/18553
* '''Tabs Bar Minimal Size''' - Themes and Skins for Browser - userstyles.org<br>http://userstyles.org/styles/9043
* '''Tab Color Underscoring active/read/unread (Fx3.6)''' - Themes and Skins for Browser - userstyles.org<br>http://userstyles.org/styles/24728 -
Parse large (2GB) text file
Hi all,
I would like your expert tips on efficient ways (speed and memory considerations) for parsing large text files (~2GB) in Java.
Specifically, the text files in hand contain mobility traces that I need to process. Traces have a predefined format, and each trace is given on a new line in the text file.
To obtain the attribues of each trace i use java.util.regex.Pattern and java.util.regex.Matcher.
Thanks in advance,
NickMemory mapped files are faster when you need random access and you don't need to load all the data, however here it just add complexity you don't need IMHO.
I suspect most of the time is taken by the parser so if you customise your parser it could be faster. Here is a simple custom parser
public static void main(String... args) throws IOException {
String template = "tr at %.1f \"$obj(1) pos 123.20 270.98 0.0 2.4\"%n";
File file = new File("/tmp/deleteme.txt");
// if(!file.exists()) {
System.out.println(new Date()+": Writing to "+file);
PrintWriter pw = new PrintWriter(file);
for(int i=0;i<Integer.MAX_VALUE/template.length();i++)
pw.printf(template, i/10.0);
pw.close();
System.out.println(new Date()+": ... finished writing to " + file + " length= " + file.length() / 1024 / 1024 + " MB.");
long start = System.nanoTime();
final BufferedReader br = new BufferedReader(new FileReader(file), 64 * 1024);
for(String line;(line = br.readLine()) != null;) {
int pos = 6;
int end = line.indexOf(' ', pos);
double time = Double.parseDouble(line.substring(pos, end));
pos = line.indexOf('s', end+12)+2;
end = line.indexOf(' ', pos+1);
double x = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf(' ', pos+1);
double y = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf(' ', pos+1);
double z = Double.parseDouble(line.substring(pos, end));
pos = end+1;
end = line.indexOf('"', pos+1);
double velocity = Double.parseDouble(line.substring(pos, end));
br.close();
long time = System.nanoTime() - start;
System.out.printf(new Date()+": Took %,f sec to read %s%n", time / 1e9, file.toString());
{code}
prints
{code}
Sun May 08 09:38:02 BST 2011: Writing to /tmp/deleteme.txt
Sun May 08 09:42:15 BST 2011: ... finished writing to /tmp/deleteme.txt length= 2208 MB.
Sun May 08 09:43:21 BST 2011: Took 66.610883 sec to read /tmp/deleteme.txt
{code} -
Hi,
I've created a custom parser which on taking certain
binary files parses and inserts them into oracle
tables.
So anytime a file is updated on iFS so are the tables.
Now conversly I want a custom renderer so whenever
data is updated or inserted into these tables these
changes will be reflected in the file blob itself.
The tables can be updated in any of the normal ways,
manually (SQLPlus), through a JDBC application etc ..
any suggestions on the best way to do this?
The only thing that comes to mind is to use
a Java stored procedure with a trigger placed
on the tables in question ..
Thanks for your time,
CathalGot the info by adding a validator and printing out the Family and renderer values.
<render-kit>
<renderer>
<component-family>javax.faces.SelectOne</component-family>
<renderer-type>javax.faces.Menu</renderer-type>
<renderer-class>my.MenuRenderer</renderer-class>
</renderer>
</render-kit>
Fred -
Storage of a document via Word97 with a parser
Hi,
The storage of a document via Word97 is always impossible when
there is a parser on the document (.doc associated with my
custom parser)
There is always a message "Impossible to record the file
O:\toto.doc is not a valid file name".
There is the same problem with wordpad for the txt files: the
message is a little different: "impossible to modify this file
taking into account the definite rights of access. To ask your
administrator network to modify this parameter. "
The parser works very good with interface HTTP and Explorateur
Windows with copy / paste.
We've tried with the simplest parser.
We have the same result: impossible via storing via Word or
Wordpad but the parser works fine with copy/paste or with
interface HTTP.
We don't understand... Thanks for your answers
Have a good day !Preview>Preferences>Signatures.
-
CMSDK: How to replace the deprecated Parser
Since 9.0.3 custom parsers are deprecated. Custom parsers where the ideal mechanism to ensure consistency in document-handling functions throughout the different protocols, while providing the possibility to act upon an upload operation before any decisions where made about how to store the document.
You could, for instance, decide to store the document as an instance of a specific subclass of document. This decision would be unrelated to the specific protocol the user chose to use to perform his upload, and thus it was possible to maintain consistent logic across the different protocols.
The 9.0.3 developer reference, chapter 12, suggests that you actually don't need these parsers, that they are overly complex and that you can simply implement your parser in a http-servlet (implying that you shouldn't use ftp, smb, ... for uploads). To stress their point (I guess) they removed (silently) the possibility for custom parsing from all but the cup protocols.
I thoroughly disagree with this and would like to maintain the functionality provided to us by the 9.0.2 parser - if necessary with different techniques. Two existing customers are unable to upgrade to newer versions simply because of this problem.
I have taken the possibility of an agent into account, but that lacks the possibility to interactively inform a user about problems regarding the content of his uploaded file. Furthermore, changing the cmsdk-class of an allready created object is tedious.
Anybody from Oracle with an explanation about the deprecation of the parsers?
Has anybody faced the same problems? Did you survive?
Happy to hear your thoughts,
BartI figured out the order in which things get stored in iFS, when creating a new Document:
1. S_TieDocument.extendedPreInsert
2. S_TieContentObject.extendedPreInsert
3. S_TieDocument.extendedPostInsert
4. S_TieFolderRelationship.extendedPreInsert
5. S_TieFolderRelationship.extendedPostInsert
6. S_TieContentObject.extendedPostInsert
After the post-insert calls, things are stored in the database. If I would want to determine the type of a document based on its contents or the folder it will be stored in, then this information should be available in step 1. Before the document is stored in the database, we have to change the class id, or the document will be stored in the wrong tables.
But in step 1, the S_TieContentObject has not been created and there is no relation between the document content and the document itself. The same goes for the folder relationship. So I don't think changing the document type (class id) in a server-side override is going to work.
Does anybody at Oracle has ever tried any of this? -
HTMLEditorKit: Inserting Custom Tags?
How do you insert a custom tag into a HTML document? I've tried both:
HTMLEditorKit.InsertHTMLTextAction( "merge", "<merge name=\"date\">DATE</merge>", HTML.Tag.BODY, new HTML.UnknownTag( "merge" ) )and
kit.insertHTML( doc, offset, "<merge name=\"date\">DATE</merge>", 0, 0, new HTML.UnknownTag( "merge" ) );Both of these methods work fine for standard HTML tags.
-- JohnI think you have to extend HTML.Tag, the following is quoted from the API documentation:
Typesafe enumeration for an html tag. Although the set of html tags is a closed set, we have let the set open so that people can add their own tag types to their custom parser and still communicate to the reader.
OTHER READERS PLEASE DON'T SHY GIVING A REPLY.
(I have got no real experiences with the HTMLEditorKit.) -
Hi everyone,
I'm currently working with oracle text, everything is working fine but now I have to extend some features so the problem is this:
- Oracle provides some parsers for common file types such as .doc, .docx, .pdf, .html, etc.. but now I must create a custom parser - its use will possibly be parsing custom file types or encrypted files.
Anyone knows some documentation that can help me create my custom parser and get it to work properly?
Any help would be apreciated.
Regards,- In what language an format (.exe, .pl, .class, etc..) should my custom parser be developed?Any executable file.
- Where should it be in the database directory tree?Whatever directory you have your sql files stored in. The default is your bin sub-directory of your oracle home directory path, except on Windows it must be in the ctx/bin sub-directory of the oracle home directory path.
- How can I tell that my custom parser is only to be used when the document extension meets certain critiria? (I want to mix doc, docx and my custom extension so the parsers provided by oracle should be available and working too)Use a format column.
- Where shall I insert the tokens and with what info?If you create a user_filter preference, then set your executable file as the command attribute to that preference, then use that preference when creating your index, the tokens are automatically inserted in the dr$your_index_name$i domain index table.
You may not have scrolled down far enough in the documentation to see all of the information and complete example provided. -
Custom Parsers available for MARS?
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
I am currently working on a MARS design. There are a lot of devices for which MARS support ( version 6.x) is not there like AGM/ADM, CRS-1, ASR9K, GSR ( 12K) Radware IPS etc.
It is a requirement that these devices be able to report to MARS. However, I do not have the bandwidth to design a custom parser. Wanted to know if there are any custom parsers already available so that I can reuse them for my deployment.
Regards
LovyaHi,
no one(
Try to write yourself
Maybe you are looking for
-
Our Mac was working fine last Monday, then Tuesday morning one of our current inboxes was gone, and an old, archived inbox was restored--twice. Other than some trouble-shooting on Tuesday, we've pretty much left things alone as we were busy doing oth
-
File adapter, File encoding national characters
Hi, I have a problem with national characters (ÅÄÖ) when sending (receiver adapter) files with the fileadapter. When i specify Transfere mode = Binary and File Type = Binary everything works fine but when i use Transfere mode =+ Text+ the national ch
-
Hi folks, I had one small doubt in the below program... import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import ja
-
S_ALR_87012178--this report is an aging report telling me how old my receivables are. What I want to know is the other side. After how many days have the customers paid weighted with the amount. S_ALR_87012177 - Debitoren Zahlungsverhalten is closed
-
Hi experts I have this error message:I think it s a problem with my connector but I m not sure Error while connecting to BI mastersystem via RFC: com.sap.mw.jco.JCO$Exception:Connect to SAP gateway failed Connect_PM TYPE=A ASHOST=10.67.124.67 SYSNR=