ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Flow statistics accounting

Post new topic  Reply to topic
 Flow statistics accounting « View previous topic :: View next topic » 
Author Message
sarvana
PostPosted: Thu Jan 20, 2005 1:25 am    Post subject: Flow statistics accounting Reply with quote

Apprentice

Joined: 17 Jan 2005
Posts: 29
Location: India

I am trying to validate an XML against a schema and it works fine except for enumerations.What do I do so that only my desired enumerations work.Secondly I have a lists and patterns (which are not supported by broker).So what do I do?

Another thing I have used the flowstats command.How do I view the logs?How do the XML file can be processed.

Please help.

Thanksssssssssssssssssss a LoTTTTTTTTTTTTTTTTTTTTTTT.
_________________
SYstems Engineer ,
TCS,
India.
Back to top
View user's profile Send private message
kirani
PostPosted: Thu Jan 20, 2005 11:32 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Write your own plug-in node to validate xml message against XML schema.
Please do some reading. There are very good redbooks and WBIMB manuals out there.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
shra_k
PostPosted: Mon Jan 24, 2005 3:55 am    Post subject: Reply with quote

Apprentice

Joined: 30 Dec 2002
Posts: 37

Use this java code and call it from ESQL using the "Calling External Java Procedures from ESQL"....

============Validation.java===================
package com.ibm.broker.cjp;
import java.io.*;
import org.xml.sax.*;
import javax.xml.parsers.*;

public class Validation
{
public static String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage",
XML_SCHEMA = "http://www.w3.org/2001/XMLSchema",
SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";

public static String msg = null;
public final static Boolean xml_validation(com.ibm.broker.plugin.MbElement input, String xsdfile)
{
boolean valid_state;
File schema = new File(xsdfile);
SAXParserFactory factory = null;
SAXParser parser = null;
msg = null;

try
{
factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
factory.setValidating(true);
parser = factory.newSAXParser();
parser.setProperty(SCHEMA_LANGUAGE,XML_SCHEMA);
parser.setProperty(SCHEMA_SOURCE,schema);
System.out.println("Msg Tree :"+input.toString());
parser.parse(new ByteArrayInputStream(input.toBitstream("","","",0,0,0)),new ErrorPrinter());
}
catch(SAXNotRecognizedException x)
{
System.err.println("Your SAX parser is not JAXP 1.2 compliant.");
valid_state = false;
}
catch (Exception ex)
{
System.err.println("Unknown Exception.");
valid_state = false;
}

if(msg != null)
{
System.out.println("In Validation : The msg is NOT valid [ "+msg+" ]");
valid_state = false;
}
else
{
System.out.println("In Validation : The msg is Valid");
valid_state = true;
}
System.out.println("state :"+valid_state);
return new Boolean(valid_state);
}
}
======================

I don't understand why to use expensive nodes when the objective can be acieved using simple java procedures.
Inorder to call java procedures from ESQL you should be atleast at FP04
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jan 24, 2005 4:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

shra_k wrote:
I don't understand why to use expensive nodes when the objective can be acieved using simple java procedures.
Inorder to call java procedures from ESQL you should be atleast at FP04

Actually, in order to call java procedures from ESQL, you HAVE to be at FP04 of v5.

If you are not at FP04 of v5, then you can't do it. So you have to use an "expensive" node instead of a "simple" java procedure.

Also, I do not think your method has to be final, merely static.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mlafleur
PostPosted: Mon Jan 24, 2005 3:57 pm    Post subject: Reply with quote

Acolyte

Joined: 19 Feb 2004
Posts: 73

shra_k,

How would you pass the xsd file to this argument? How would you get it in a string?
Back to top
View user's profile Send private message
shra_k
PostPosted: Wed Feb 02, 2005 10:08 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Dec 2002
Posts: 37

I agree the method need not be final. Thanks for that.

Declare the procedure as :->

CREATE PROCEDURE validateMsg(IN message REFERENCE, IN xsd_file CHARACTER)
RETURNS BOOLEAN
LANGUAGE JAVA EXTERNAL NAME "com.ibm.broker.cjp.Validation.xml_validation";

Call it as :->

DECLARE xsd_file CHARACTER;
SET xsd_file = 'votes.xsd';
CALL validateMsg(xml_message,xsd_file) INTO valid;

Place your .xsd file in bin directory or else you can specify the path of the xsd file, but this would make the ESQL variable xsd_file as hardcoded.
So you can adopt alternate methods to achieve this.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Flow statistics accounting
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.