Friday, August 28, 2015

Trace Levels

For SSL
com.ibm.ws.websvcs.*=all: com.ibm.ws.policyset.*=all: com.ibm.ws.wssecurity.*=all: com.ibm.ws.wsaddressing.*=all: com.ibm.ws.wstx.*=all: org.apache.axis2.*=all

For Adapter
com.ibm.j2ca* = all

For Trace JaxWS
com.ibm.ws.websvcs.trace.*=all: com.ibm.bpm.ws.jaxws.*=all
*=info:com.ibm.websphere.wssecurity.*=all:com.ibm.ws.webservices.wssecurity.*=all:com.ibm.wsspi.wssecurity.*=all:com.ibm.ws.wssecurity.*=all:com.ibm.xml.soapsec.*=all:com.ibm.ws.webservices.trace.*=all:com.ibm.ws.websvcs.trace.*=all:com.ibm.ws.webservices.multiprotocol.AgnosticService=all:

http://www-01.ibm.com/support/docview.wss?uid=swg21199176


*=info: SCA.JMS=all: com.ibm.mq.*=all: com.ibm.ejs.jms.*=all


Jms MQ
*=info:SCA.JMS=all:com.ibm.mq.*=all:com.ibm.ejs.jms.*=all

SerializerException:
 

*=info:com.ibm.wbiserver.map.*=all:SCA.*=all:ArtifactLoader=all:BOCore=all:BOFactory=all:BOXMLSerializer=all:
BOXMLDocument=all:BOTypeMetaData=all


It is recommended to set the number of historical trace files to 10 and the size of each historical trace file to 100MB, in case useful traces are overwritten. Please don't forget to disable the trace string after test.

1)  Stop the server.

2)  Remove all the existing logs trace and FFDCs so we have a more concise log output.

3)  Restart the server.

4)  Reproduce the issue and note the time the symptoms occurred.

5)  Insure the trace covers the time period noted in step four above.

6)  Zip up the profile's logs directory.

7)  Send us the zip of the logs directory noting any errors, exceptions, or symptoms.


Friday, August 21, 2015

Read Value From Name Space Binding

try{
Context ctx = new InitialContext();
String fromId= (String)ctx.lookup("cell/persistent/bpic/caregiver/CaregiverEmailFromId");
FTPFile_DirectoryPath = fromId;

}
catch(NamingException nameExp){
nameExp.printStackTrace();
}



XPATH Expressions

  1. Size of list
                  /body/createNewCaseDataRecordResponse/response/groupList[position()>0]

  1. count(/body/createNewCaseDataRecordResponse/response/coverageList)!=0 and /body/createNewCaseDataRecordResponse/response/coverageList[position()>0]



  1. Filler

$Filler[Name='quoteNumber']


http://www.ibm.com/developerworks/websphere/library/techarticles/1003_spriet2/1003_spriet2.html


Empty tags removal


Date Format


  1. Format date in yyyyMMdd

       import java.text.SimpleDateFormat;
       import java.util.Date;

public static String formatDate(Date date){
String formattedDate1 = "";
String DATE_FORMAT_NOW = "yyyy-MM-dd";
        if(date == null)
     return formattedDate1;
 SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
 String formattedDate = sdf.format(date );
 StringTokenizer st = new StringTokenizer(formattedDate,"-"); 
 while(st.hasMoreTokens()){ 
 formattedDate1 = formattedDate1.concat(st.nextToken());
 }

 return formattedDate1;
}

Validate BO

/**
 *
 */
package com.humana.bpic.et.common.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.io.*;
import com.ibm.websphere.bo.*;
import com.ibm.websphere.sca.*;
import commonj.sdo.*;

/**
 * @author sxd5347
 *
 */
public class BOUtil {

private static BOXMLSerializer xmlSerializer = (BOXMLSerializer) ServiceManager.INSTANCE
.locateService("com/ibm/websphere/bo/BOXMLSerializer");

private static BOFactory boFactory = (BOFactory) ServiceManager.INSTANCE
.locateService("com/ibm/websphere/bo/BOFactory");

private static BOInstanceValidator instanceValidator=(BOInstanceValidator) ServiceManager.INSTANCE.locateService("com/ibm/websphere/bo/BOInstanceValidator");
public static BOFactory getBOFactory() {
return boFactory;
}

public static DataObject createBO(String uri, String boType) {
return boFactory.create(uri, boType);
}

public static DataObject createByElement(String uri, String elementName) {
return boFactory.createByElement(uri, elementName);
}
public static String boToString(DataObject bo) {
String result = "";
if (bo == null)
return result;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xmlSerializer.writeDataObject(bo, bo.getType().getURI(),
getBOName(bo), bos);
result = new String(bos.toByteArray());
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
public static String formatDate(Date date){
String formattedDate1 = "";
String DATE_FORMAT_NOW = "yyyy-MM-dd";
        if(date == null)
     return formattedDate1;
 SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
 String formattedDate = sdf.format(date );
 StringTokenizer st = new StringTokenizer(formattedDate,"-");
 while(st.hasMoreTokens()){
 formattedDate1 = formattedDate1.concat(st.nextToken());
 }

 return formattedDate1;
}
public static String toString(DataObject bo) {
String result = "";
if (bo == null)
return result;
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
xmlSerializer.writeDataObject(bo, bo.getType().getURI(),
getBOName(bo), bos);
result = new String(bos.toByteArray());
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
public static String getBOName(DataObject bo) {
String boName = bo.getType().getName();
if (boName.indexOf("BaseType") > 0)
boName = boName.substring(0, boName.indexOf("BaseType"));
else if (boName.indexOf("Type") > 0)
boName = boName.substring(0, boName.indexOf("Type"));
return boName;
}

public static String exceptionToString(Throwable t) {
String str = null;
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
str = sw.toString();

try {
pw.close();
sw.close();
} catch (IOException e) {
}
if (str == null)
str = t.getMessage();
return str;
}
public static BOInstanceValidator getBOValidator()
{
return instanceValidator;
}

public static Map validateData(DataObject input)
{
List validationErrorList=new ArrayList();
Map resultMap=new HashMap();
//System.out.println("****validation starts for "+input);
boolean isValid=com.humana.bpic.et.common.util.BOUtil.getBOValidator().validate(input,validationErrorList);
//System.out.println("*** isValid "+isValid);
if (!isValid) {
      java.util.Iterator errorList = validationErrorList.iterator();
      while(errorList.hasNext()){
             DataObject error = (DataObject)errorList.next();
             String prop=(String)error.get("property");
             String val=(String)error.get("message");
             //System.out.println("Error property: " + prop);
             //System.out.println("Error message: " + val);
             if(val.indexOf("The type definition cannot be abstract for element")>=0)
              {
               //System.out.println("***ignoring type definition error messages ");
              
              }
             else
              resultMap.put(prop,val );
}
 
}
 return resultMap;

}
public static Date dtTimeFormatt(Date input) throws ParseException{
SimpleDateFormat sdt=new SimpleDateFormat("yyyy-MM-dd");
String inputDtString=sdt.format(input);
System.out.println("inputdtString ="+inputDtString);
inputDtString+=" 00:00:00";
SimpleDateFormat sdt2=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date dtTimeStamp=sdt2.parse(inputDtString);
System.out.println("***dateTime "+dtTimeStamp);
return dtTimeStamp;
}


}

Read Value From Properties File

Read Value From Properties File

smo.set("/headers/HTTPHeader/control/DynamicOverrideURL",ESIPropertyReader.getString("MTV_GROUP_CREATE_URL"));




/**
 * 
 */
package com.humana.bpic.et.common.util;

import java.util.StringTokenizer;
import org.apache.commons.configuration.CompositeConfiguration;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.configuration.reloading.FileChangedReloadingStrategy;

import com.ibm.wsspi.sibx.mediation.MediationBusinessException;

public class ESIPropertyReader {

public static final String SERVICES_PROP_FILE_LIST = System
.getProperty("ESIPropertyFileList");

private static CompositeConfiguration cc = null;
static {
if (SERVICES_PROP_FILE_LIST != null) {
cc = new CompositeConfiguration();
StringTokenizer st = new StringTokenizer(SERVICES_PROP_FILE_LIST);
while (st.hasMoreElements()) {
try {
String propFileConfig = st.nextToken(",");
StringTokenizer propFileConfigTokenizer = new StringTokenizer(
propFileConfig);
String propertyFileName = "";
String refreshDelay = null;
propertyFileName = propFileConfigTokenizer.nextToken(":")
+ ".properties";
if (propFileConfigTokenizer.hasMoreTokens()) {

refreshDelay = propFileConfigTokenizer.nextToken(":");
System.out.println("refreshDelay:" + refreshDelay);
} else {
refreshDelay = "1";
}
PropertiesConfiguration conf = new PropertiesConfiguration();
conf.clear();
conf.setDelimiterParsingDisabled(true);
// System.out.println("property file name  loaded:"+propertyFileName);
conf.load(propertyFileName);
// System.out.println("property file Loaded Successfully");
if (refreshDelay != null) {
FileChangedReloadingStrategy fileChangedReloadingStrategy = new FileChangedReloadingStrategy();
int refreshIntervalInMilliSeconds = new Integer(
refreshDelay).intValue() * 60 * 1000;
fileChangedReloadingStrategy
.setRefreshDelay(refreshIntervalInMilliSeconds);
conf.setReloadingStrategy(fileChangedReloadingStrategy);
}
cc.addConfiguration(conf);
} catch (Exception e) {
// e.printStackTrace();
}
}
}
}

public static String getString(String key, String defaultMessage) {
String message = null;
try {
if (cc != null) {
// System.out.println("key"+ key);
message = (String) cc.getProperty(key);
// System.out.println("here in getString :"+ message);
if (message == null) {
message = defaultMessage;
}
} else {
message = defaultMessage;
}

} catch (Exception e) {
e.printStackTrace();
}
return message;
}

public static String getString(String key)
throws MediationBusinessException {

if (cc != null) {
// System.out.println("key"+ key);
// System.out.println("here in getString :"+ cc.getProperty(key));
if (cc.getProperty(key) != null) {
return (String) cc.getProperty(key);
} else {

throw new MediationBusinessException("Property not found for '"
+ key + "'");
}
} else {
throw new MediationBusinessException("Property not found for '"
+ key + "' as property file could not be initialized");
}

}

public static String concatGetString(String prefix, String key)
throws MediationBusinessException {
String key1 = "";
key1 = prefix + key;
key1 = key1.replaceAll(" ", "");
// System.out.println("Here is the value of key1 "+key1);
if (cc != null) {
// System.out.println("key1:"+ key1);
// System.out.println("here in concatGetString :"+
// cc.getProperty(key1));
if (cc.getProperty(key1) != null) {
return (String) cc.getProperty(key1);
} else {

throw new MediationBusinessException("Property not found for '"
+ key1 + "'");
}
} else {
throw new MediationBusinessException("Property not found for '"
+ key1 + "' as property file could not be initialized");
}

}
}



Usage:

smo.set("/headers/SMOHeader/Target/address",ESIPropertyReader.getString("URAAP_MQ_URL"));

Properties File(ESIEnvironment.properties)

MTV_MEMBER_READ_URL=http://dev-enrollmentapi.humana.com/Member/api/members/stub/
MTV_MEMBER_CREATE_URL=http://dev-enrollmentapi.humana.com/Member/api/Members
MTV_MEMBER_SEARCH_URL=http://dev-enrollmentapi.humana.com/Member/api/members/Search
MTV_GROUP_READ_URL=http://dev-enrollmentapi.humana.com/Group/api/groups/
MTV_GROUP_CREATE_URL=http://dev-enrollmentapi.humana.com/Group/api/groups
URAAP_MQ_URL=wmq:/msg/queue/QA.BS.ESI.URAAP.EVENTS.DEV
SOLAR_MQ_URL=wmq:/msg/queue/QA.BS.ESI.SOLAR.EVENTS.DEV
SDR_MQ_URL=wmq:/msg/queue/QA.BS.ESI.SDR.EVENTS.DEV

PBS_MQ_URL=wmq:/msg/queue/QA.BS.ESI.PBS.EVENTS.DEV