On 5/16/07, Benamin <[EMAIL PROTECTED]> wrote:

thanks for the code, but I am wondering what the support and msisdn vars
should be?

The msisdn is system specific - it's just a string that was used as
the globally unique id for users throughout the system.

The support var is a reference to a class that was used to separate
the JBI specific concerns from the data specific concerns. Below is
the createIdentityInMessage() method to create a normalized message
sent to the identity service:

-------------------------------------------------------------------------------------------------------------------------
   protected Source createIdentityInMessage(String msisdn, Source
request) throws MessagingException {
       try {
           DOMSource xml = sourceTransformer.toDOMSource(request);
           Node n = xpath.selectSingleNode(xml.getNode(),
XPATH_LOGIN_PASSWORD);
           String password = (n != null) ? n.getNodeValue() : "";

           StringBuilder inXml = new StringBuilder("<serviceLogin
xmlns=\"http://service.identity.enabler.iwms.foo.com\";>");
           inXml.append("<in0>");
           inXml.append(msisdn);
           inXml.append("</in0>");
           inXml.append("</serviceLogin>");

           log.debug("IDENTITY IN MSG: " + inXml.toString());
           return new StringSource(inXml.toString());
       } catch (Exception e) {
           throw new MessagingException(e);
       }
   }
-------------------------------------------------------------------------------------------------------------------------

And below is the parseIdentityOutMessage() method for parsing the
normalized message received from the identity service :

-------------------------------------------------------------------------------------------------------------------------
protected boolean parseIdentityOutMessage(Source identityResponse)
throws MessagingException {
       try {
           if (log.isDebugEnabled()) {
               log.debug("PARSING IDENTITY RESP: " +
sourceTransformer.toString(identityResponse));
           }
           DOMSource xmlDom = sourceTransformer.toDOMSource(identityResponse);
           Node n = xpath.selectSingleNode(xmlDom.getNode(),
XPATH_IDENTITY_RESPONSE);

           return (n != null) && ("true".equals(n.getNodeValue()));
       } catch (Exception e) {
           throw new MessagingException(e);
       }
   }
-------------------------------------------------------------------------------------------------------------------------

Where the XPATH_IDENTITY_RESPONSE var above is defined as the following:

private static final String XPATH_IDENTITY_RESPONSE = "/*[local-name()
= 'authenticateResponse']/*[local-name() = 'out']/text()";

It's just some XPath to parse the meaningful item from the XML response.

Bruce
--
perl -e 'print unpack("u30","D0G)[EMAIL 
PROTECTED]&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/

Reply via email to