Friday, December 20, 2013

Java : XPathReader with CDATA

String xpath = "//IDOC[position()>=1 and position()<=3]";
XPath xpathObj = XPath.getXPathInstance(xpath);
XPathReader xpathReaderObj = XPathReader.getXPathReader(xpathObj, null,oDoc, fileName);
xpathReaderObj.open();
int resultNode = xpathReaderObj.loadNextNode();

Explanation of the above scenario :
In Order to read the data only chunkwise you need to go with xpathReader to have better performance as this thing will be reading on chunk basis.

Problem : But the problem with this function is, It won't load the CDATA elements if your XML have any. Instead the element nodes will be empty.

Thursday, December 19, 2013

SAP IDOC Issue - Not able to update the database table "IDOCTABLE"

We've spotted the difference between the sapconnector.jar from Cordys-QUA & Cordys-PreProd. PFB the difference in the class "com.eibus.applicationconnector.sap.request.OLEDBRequestSender"


Code snipped from QUA


Code snipped from PreProd


Notice the difference in XPath argument for "Find.firstMatch" method. 

where the extra string in XPath : params[5] = idoc.getIDocType(); [= IORDER01] in the IDOC XML, while in the root of IDOC we've YIORDER01 (highlighted in the image below). I think this is why it is giving error in PreProd & not in Qual

Finally we used sapconnector.jar from QUA environment and the issue got resolved.


Java : Unable to generate SAMLArt for HTTPS from Java

Unable to Create SAMLArt for https from Java:

The error was 

sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested targetcom.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
java.io.BufferedOutputStream.flushBuffer(Unknown Source)

java.io.BufferedOutputStream.flush(Unknown Source)

Explanation about the issue :
  • The issue is because of certificate unavailability in keystore of the server. 
  • one can view the keystore contents from the command prompt. This command has to be executed from "%JAVA_HOME%/jre/bin path

    keytool -list -keystore "%JAVA_HOME%/jre/lib/security/cacerts"
  • The certificate must be available in the list provided from the above, to confirm there will be an entry with Fingerprint (MD5) value which should be identical of Fingerprint (MD5) value of the certificate.
  • Properties of the certificate can be visible from webserver.
  • If the certificate is not visible then one has to manually import the certificate using keytool commands.

    keytool -import -noprompt -trustcacerts -alias <AliasName> -file <certificate> -keystore <KeystoreFile> -storepass <Password>
  • One can list the keystore contents using the command mentioned in the above points, now the certificate has to be available.
  • Once this is done then World Wide Web has to be restarted to effect the change.
Entire details on how to set up https successfully will be found the document below


Tuesday, December 17, 2013

HideSOAPFault : Gateway

Cordys Version : BOP4.1CU6

com.cordys.gateway.strip.soapfault.detail=true;
and then restart the gateway and also the monitor since you will be keeping this in cordys properties.
______________________________________________________
Cordys Version : BOP4.2

To Strip all the SOAP Faults
gateway.fault.blacklist=Cordys.CWS.Messages.*

TO Strip Only a particular SOAP Fault 
gateway.fault.blacklist=Cordys.CWS.Messages.<SOAPFaultMsgIdentifier>
Where 
<SOAPFaultMsgIdentifier> can be obtained from SOAP:fault section
Ex: gateway.fault.blacklist=Cordys.CWS.Messages.commitTransactionFailedWithReason

Java Script : Date Format Utilities

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
Date.prototype.monthNames = [
"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
];

Date.prototype.getMonthName = function() {
return this.monthNames[this.getMonth()];
};
Date.prototype.getShortMonthName = function () {
return this.getMonthName().substr(0, 3);
};

function convert(dateObj,fromFormat,toFormat) {
/*default the values 
dateObj default it to new Date();
fromFormat default it to UTC;
toFormat default it to UTC;
*/
var dateObj = dateObj;
var fromFormat = fromFormat;
var toFormat = toFormat;
if(!dateObj || dateObj=="")
dateObj = new Date();
debugger;
//if both fromFormat and toFormat is null
dateObj = new Date(Date.parse(dateObj));
if(!toFormat || toFormat=='' || toFormat=='CORDYS')
{
//return the dateObj in UTC Format
return dateObj.toISOString();
}
if(toFormat=='dd-MM-yyyy'){
var formattedDT = dateObj.getDate()+"-"+dateObj.getMonth()+"-"+dateObj.getFullYear();
return formattedDT;
}
if(toFormat=='yyyy-MM-dd'){
var formattedDT = dateObj.getFullYear()+"-"+dateObj.getMonth()+"-"+dateObj.getDate();
return formattedDT;
}
if(toFormat=='UTC'||toFormat=='GMT'){
return dateObj.toUTCString();
}
if(toFormat=='dd/MM/yyyy'){
var formattedDT = dateObj.getDate()+"/"+dateObj.getMonth()+"/"+dateObj.getFullYear();
return formattedDT;
}
if(toFormat=='yyyy/MM/dd'){
var formattedDT = dateObj.getFullYear()+"/"+dateObj.getMonth()+"/"+dateObj.getDate();
return formattedDT;
}
if(toFormat=='dd-MMM-yyyy'){
var formattedDT = dateObj.getDate()+"-"+dateObj.getShortMonthName()+"-"+dateObj.getFullYear();
return formattedDT;
}
if(toFormat=='dd MMM yyyy'){
var formattedDT = dateObj.getDate()+" "+dateObj.getShortMonthName()+" "+dateObj.getFullYear();
return formattedDT;
}
var format = dateObj.getFullYear()+"-";
format += dateObj.getMonth()+"-";
format += dateObj.getDate();
return dateObj.toJSON();
}
function convertDate(){
$("#convertedFormat").html(convert($('#custDate').val(),'',$('#ipDateFormat').val()));
}
</script>
</head>
<body>
<font style="font-family:Trebuchet MS;font-size:14px;width:100%;">Date Format <input id="ipDateFormat"></input></font><br/>
<input id="custDate" type="date" title="Please enter Date"></input><br/>
<button id="convertFormat" onclick="convertDate()">Convert Format</button><br/>
<div id="convertedFormat" style="font-family:Trebuchet MS;font-size:14px;width:100%;"><div>
</body>
</html>

Java Script : Convert Ascii value to character

String.fromCharCode(charCode)

Java Script : Mandatory mark for fields

function mandatory(control)
{
 if(cordys.getTextContent(control.getLabel()).indexOf('*')<0)
     control.setLabel(cordys.getTextContent(control.getLabel())+" <font color='RED'>*</font>");
}

Java Script : Delete Cookie

function deleteCookie(cookieName,cookiePath)  {
  var path = window.location.pathname;
  document.cookie = cookieName + "=; path="+cookiePath+";expires=Thu, 01 Jan 1970 00:00:01 GMT;"  
 }  

Java : Surya's Implementation of Deleting Nodes

public static int getIntContextInformation(String OBJECT, String OPERATION, String BO_ID)
  {
    Vector nodesToDelete = new Vector();
    try
    {
      int resp = BSF.getXMLDocument().createElementNS("IntContext", "", "", "http://schemas.schneiderelectric.com/1.0/canonical/technical", 0);

      queryText = "SELECT BI.STATUS STATUS_INT, BI.CORDYS_USER_NAME CORDYS_USER_NAME_INT, BCBM.ID ID_BO, BCBM.STATUS STATUS_BO, BCBM.CORDYS_USER_NAME CORDYS_USER_NAME_BO, BI.ADMIN_EMAIL_ADDRESS ADMIN_EMAIL_ADDRESS_INT, BCBM.ADMIN_EMAIL_ADDRESS ADMIN_EMAIL_ADDRESS_BO, BI.DESCRIPTION, BI.SLA AS SLA_INT, BCBM.SLA AS SLA_BO FROM BFOI_INTCONTEXTS BI LEFT OUTER JOIN BFOI_CONTEXT_BO_MAPPING BCBM ON BI.OBJECT    =BCBM.OBJECT AND BI.OPERATION=BCBM.OPERATION AND BCBM.BO_ID  =:BO_ID WHERE BI.OBJECT =:OBJECT AND BI.OPERATION=:OPERATION ";

      QueryObject query = new QueryObject(queryText);
      query.addParameter("OBJECT", "BFOI_INITCONTEXTS.OBJECT", 1, OBJECT);

      query.addParameter("OPERATION", "BFOI_INITCONTEXTS.OPERATION", 1, OPERATION);

      query.addParameter("BO_ID", "BFOI_CONTEXT_BO_MAPPING.BO_ID", 1, BO_ID);

      XqyResultSet rset = query.execute();
      int data = rset.getDatasetNode();
      int dataRoot = Node.createElement("IntegrationInfo", resp);
      Node.appendToChildren(XPath.getFirstMatch("//BFOI_INTCONTEXTS", null, data), dataRoot);

      nodesToDelete.add(Integer.valueOf(data));

      queryText = "select ID, OBJECT, OPERATION, PARAM_NAME, DESCRIPTION, REQUIRED, DATA_TYPE, LENGTH, FRACT_LENGTH, FORMAT_STR, SEQUENCE_NO, KEY_PARAM from \"BFOI_INTCONTEXT_PARAMS\" where \"OBJECT\" = :OBJECT and \"OPERATION\" = :OPERATION ORDER BY SEQUENCE_NO";

      query = new QueryObject(queryText);
      query.addParameter("OBJECT", "BFOI_INTCONTEXT_PARAMS.OBJECT", 1, OBJECT);

      query.addParameter("OPERATION", "BFOI_INTCONTEXT_PARAMS.OPERATION", 1, OPERATION);

      query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);

      rset = query.execute();
      data = rset.getDatasetNode();
      int[] boElements = XPath.getMatchingNodes("//BFOI_INTCONTEXT_PARAMS", null, data);

      dataRoot = Node.createElement("IntContextParams", resp);
      for (int i = 0; i < boElements.length; i++) {
        int node = Node.clone(boElements[i], true);
        Node.appendToChildren(node, dataRoot);
      }

      nodesToDelete.add(Integer.valueOf(data));

      queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, MAIN_UI_URL, EMBEDDED_UI_URL, UI_SETTINGS, ADDL_INFO FROM BFOI_INTCONTEXT_UI_MAPPINGS WHERE OBJECT=:OBJECT AND (BO_ID=:BO_ID OR BO_ID='*')";

      query = new QueryObject(queryText);
      query.addParameter("OBJECT", "BFOI_INTCONTEXT_UI_MAPPINGS.OBJECT", 1, OBJECT);

      query.addParameter("BO_ID", "BFOI_INTCONTEXT_UI_MAPPINGS.BO_ID", 1, BO_ID);

      query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);

      rset = query.execute();
      data = rset.getDatasetNode();

      String boId = BO_ID;
      String operation = OPERATION;

      if (XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS", null, data) != 0)
      {
        dataRoot = Node.createElement("IntContextUIMapping", resp);
        int node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='" + BO_ID + "' and OPERATION='" + OPERATION + "']", null, data);

        if (node != 0) {
          Node.appendToChildren(node, dataRoot);
        } else {
          operation = "*";
          node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='" + BO_ID + "' and OPERATION='*']", null, data);

          if (node != 0) {
            Node.appendToChildren(node, dataRoot);
          } else {
            boId = "*";
            operation = OPERATION;
            node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='*' and OPERATION='" + OPERATION + "']", null, data);

            if (node != 0) {
              Node.appendToChildren(node, dataRoot);
            } else {
              operation = "*";
              node = XPath.getFirstMatch("//BFOI_INTCONTEXT_UI_MAPPINGS[BO_ID='*' and OPERATION='*']", null, data);

              if (node != 0)
                Node.appendToChildren(node, dataRoot);
            }
          }
        }
      }
      nodesToDelete.add(Integer.valueOf(data));

      queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, KEYWORD1, KEYWORD2, SERVICE_NAME, SERVICE_NS, ADDL_INFO, PROCESS_NAME, COMPONENT_NAME FROM BFOI_CONTEXT_SERV_MAPPINGS WHERE OBJECT=:OBJECT AND BO_ID=:BO_ID AND OPERATION=:OPERATION";

      query = new QueryObject(queryText);
      query.addParameter("OBJECT", "BFOI_CONTEXT_SERV_MAPPINGS.OBJECT", 1, OBJECT);

      query.addParameter("BO_ID", "BFOI_CONTEXT_SERV_MAPPINGS.BO_ID", 1, boId);

      query.addParameter("OPERATION", "BFOI_UI_SERVICE_MAPPINGS.OPERATION", 1, operation);

      query.setResultClass(BFOI_INTCONTEXT_PARAMS.class);

      rset = query.execute();
      data = rset.getDatasetNode();

      boElements = XPath.getMatchingNodes("//BFOI_CONTEXT_SERV_MAPPINGS", null, data);

      dataRoot = Node.createElement("IntContextServiceMappings", resp);
      for (int i = 0; i < boElements.length; i++) {
        int node = Node.clone(boElements[i], true);
        Node.appendToChildren(node, dataRoot);
      }

      nodesToDelete.add(Integer.valueOf(data));

      queryText = "SELECT ID, BO_ID, OBJECT, OPERATION, PARAM_NAME, PARAM_VALUE FROM BFOI_INTCONT_PROC_PARAMS WHERE OBJECT=:OBJECT AND BO_ID=:BO_ID AND OPERATION=:OPERATION";

      query = new QueryObject(queryText);
      query.addParameter("OBJECT", "BFOI_INTCONT_PROC_PARAMS.OBJECT", 1, OBJECT);

      query.addParameter("BO_ID", "BFOI_INTCONT_PROC_PARAMS.BO_ID", 1, boId);

      query.addParameter("OPERATION", "BFOI_INTCONT_PROC_PARAMS.OPERATION", 1, operation);

      query.setResultClass(BFOI_INTCONT_PROC_PARAMS.class);

      rset = query.execute();
      data = rset.getDatasetNode();

      boElements = XPath.getMatchingNodes("//BFOI_INTCONT_PROC_PARAMS", null, data);

      dataRoot = Node.createElement("IntContextProcParams", resp);
      for (int i = 0; i < boElements.length; i++) {
        int node = Node.clone(boElements[i], true);
        Node.appendToChildren(node, dataRoot);
      }

      nodesToDelete.add(Integer.valueOf(data));
      Enumeration it;
      return resp;
    }
    catch (Exception e)
    {
      String queryText;
      Enumeration it;
      return 0;
    } finally {
      Enumeration it = nodesToDelete.elements();
      while (it.hasMoreElements())
        Node.delete(((Integer)it.nextElement()).intValue());
    }
  }

Custom Gateway : Get Server Variables

req.getServerVariable("HTTPS")
req.getServerVariable("SERVER_NAME")
req.getServerVariable("SERVER_PORT")

Java : Property Usage

private static Properties properties=new Properties();

static {
try {
properties.load(new FileInputStream(EIBProperties.getInstallDir()
.concat("/Web/com/schneider/JE/Properties/JE.properties")));
installDir = properties.getProperty("com.je.installDir");
ValidationReq=properties.getProperty("com.je.isSAPValidationRequired");
} catch (Exception e) {
throw new RuntimeException(e);
}
}

Java : OnBeforeInsert

  protected void onBeforeInsert()
  {
    super.onBeforeInsert();
    setCREATED_ON(new Date());
    setCREATED_BY(BSF.getUser().substring(BSF.getUser().indexOf("=") + 1, BSF.getUser().indexOf(",")) + "[" + BSF.getOrganization().substring(BSF.getOrganization().indexOf("=") + 1, BSF.getOrganization().indexOf(",")) + "]");
  }

  protected void onBeforeUpdate()
  {
    super.onBeforeUpdate();
    setLAST_MODIFIED_ON(new Date());
    setLAST_MODIFIED_BY(BSF.getUser().substring(BSF.getUser().indexOf("=") + 1, BSF.getUser().indexOf(",")) + "[" + BSF.getOrganization().substring(BSF.getOrganization().indexOf("=") + 1, BSF.getOrganization().indexOf(",")) + "]");
  }

XPath : Select Unique in XML

XPath.getMatchingNodes("descendant-or-self::HMT_PROCESS_CONFIG[not(PROCESS_NAME=preceding::HMT_PROCESS_CONFIG/PROCESS_NAME)]/PROCESS_NAME", null, processData);

Java : DML Statement Usage

DML Statements :

 String query1 = "update EMP_DT  set EMP_NAME='"EMP_NAME"',EMP_DEPT='"EMP_DEPT"' where EMP_ID='"EMP_ID"' ";
                     DMLStatement dml1 = new DMLStatement(query1);
                     dml1.execute(); 

Reference:

https://wiki.cordys.com/display/ucforum/Query+In+Java+Code

Cordys Installation : Unable to connect to My Sql database



Resolution:
Put jar in CLASSPATH of system variables of Environment Variables of the machine
Example:

C:\Program Files\MySQL\MySQL Server 5.1\libraries\mysql-connector-java-5.0.8-bin.jar;

HTML : Sample table usage

<!DOCTYPE html>
<html>
<head>
<title>Sample HTML Page</title>
</head>
<body>
<table>
<tr><td style="border:1px solid;color:#FF0000;background-color:#FF0000">A</td><td style="padding-left:15px;">Aborted</td></tr>
<tr><td style="border:1px solid;color:#FF9933;background-color:#FF9933">W</td><td style="padding-left:15px;">Waiting</td></tr>
<tr><td style="border:1px solid;color:#0066FF;background-color:#0066FF">R</td><td style="padding-left:15px;">Running</td></tr>
<table>
</body>
</html>

Transaction Object is null : Coboc Browser : Problem installing isvps which has DTs

Issues related to this:
·         Isvps related to CoBOC Content will not be installed as CoBOC browser will not be functioning properly.

·         When opening CoBOC Browser we get an error “TransactionObject is null” and in the log it will be “invalidTransactionObject”.


Possible reason:
The port number of CoBOC container is not in sync with Monitor container hence even after restart we could not solve this issue. So as a resolution we have created a clone of CoBOC container (port number will be changed automatically and it will create proper connection with Monitor service container) and stopped the main container and let the copy of coboc container in started state (assuming the algorithm the CoBOC service group is in failover mode). Then the issue has gone.

Monday, December 16, 2013

Cordys : Failed connecting to Oracle Schema from Cordys

Possible Reasons :

·         Configuration details are indeed wrong or
·         Missing oracle driver.
Missing oracle driver :
Give <<ojdbc14.jar>> (For oracle 10 g this works may be for oracle 11i something other jar would be used i guess).

Configure "classpath" variable of "Environment Variables" in the machine and restart the system.


HTTP Error 404.0 Not Found while installing Cordys over IIS



My Sql : Packet issue

Caused by: com.cordys.bpm.utils.db.DatabaseException: Database update failed. The exception is Error occurred while processing the request. Error from database server or driver.com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4942706 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable. ErrorCode:0 SQLState:S1000.

I have added an extra parameter in my.ini file located at “C:\Program Files\MySQL\MySQL Server 5.1”



Event Service Error - Resolution

The possible reason could be that Cordys BOP is installed in a standalone mode and the network card is disabled. To resolve this issue, 
Go to <Cordys_Installation_Directory>/config folder. 
Open the wcp.properties file. 
Set the property cordys.eventgateway.domain to the value 127.0.0.1. 
Restart the Web server and try again.

Timestamp in BPM Message map

sprintf("%D(%yyyy-%MM-%dd)T%T(%HH:%mm:%ss.0)", utc(),utc())

String To Date Format in BPM Message map

sprintf('%XD(%dd-%MMM-%yyyy)',"2009-01-01T00:00:01.0")

Execute Process

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<ExecuteProcess type="" xmlns="http://schemas.cordys.com/bpm/execution/1.0">
<type>definition</type>
<receiver>/BPM/ExecuteProcess</receiver>
<source/>
<modelSpace></modelSpace>
<senderEnterprise/>
<sender/>
<instanceIdentifier/>
<monitor activityMonitorLevel="" activityMonitoring="" level=""/>
<crashRecovery>No</crashRecovery>
<priority>3</priority>
<triggeredByActionId/>
<mainProcessWaiting/>
<callingSOAPProcessor/>
<activityId iterationCount=""/>
<redirected/>
<message>
<Input_Msg xmlns="http://schemas.cordys.com/default">
<Name xmlns="http://schemas.cordys.com/default">PARAMETER</Name>
<ID xmlns="http://schemas.cordys.com/default">PARAMETER</ID>
</Input_Msg>
</message>
</ExecuteProcess>
</SOAP:Body>
</SOAP:Envelope>

Set Profile SOAP Request

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <SetProfile xmlns="http://schemas.cordys.com/1.0/email">
      <displayName>Appspace</displayName>
      <mailId>appspace2012@gmail.com</mailId>
      <password>******</password>
      <userId>appspace2012</userId>
    </SetProfile>
  </SOAP:Body>
</SOAP:Envelope>

Send Mail Soap Request

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
  <SOAP:Body>
    <SendMail xmlns="http://schemas.cordys.com/1.0/email">
      <to>
        <address>
          <emailAddress>Kiran.joshi@darkhorseboa.com</emailAddress>
          <displayName>Kiran Joshi</displayName>
        </address>
         <address>
          <emailAddress>j.kiran809@gmail.com</emailAddress>
          <displayName>Kiran Joshi</displayName>
        </address>
      </to>    
      <subject>PARAMETER</subject>
      <body type="normal">PARAMETER</body>
      <from>
        <displayName>Appspace</displayName>
        <emailAddress>appspace2012@gmail.com</emailAddress>
      </from>
    </SendMail>
  </SOAP:Body>
</SOAP:Envelope>

Sample Login Form

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Journal Entry</title>
<style type="text/css">
input{
width:150px;
}
button{
width:200px;
height:20px;
}
body{
left: 50%!important;
    position: relative!important;
    top: 20%!important;
}
</style>
<script type="text/javascript" src="/cordys/wcp/application.js"></script>
<script type="text/javascript">
function redirect()
{
var requestString =
"<SOAP:Envelope xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\">"+
"<SOAP:Header>"+
"<wsse:Security xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"+
"<wsse:UsernameToken xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"+
"<wsse:Username>"+userId.value+"</wsse:Username>"+
"<wsse:Password>"+pwd.value+"</wsse:Password>"+
"</wsse:UsernameToken>"+
"</wsse:Security>"+
"</SOAP:Header>"+
"<SOAP:Body>"+
"<samlp:Request xmlns:samlp=\"urn:oasis:names:tc:SAML:1.0:protocol\" MajorVersion=\"1\" MinorVersion=\"1\">"+
"<samlp:AuthenticationQuery>"+
"<saml:Subject xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\">"+
"<saml:NameIdentifier Format=\"urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified\">"+userId.value+"</saml:NameIdentifier>"+
"</saml:Subject>"+
"</samlp:AuthenticationQuery>"+
"</samlp:Request>"+
"</SOAP:Body>"+
"</SOAP:Envelope>";

// We dont need to specify http://Hostname/ part

var cordysGatewayURL = "https://dhl-hyd1024.darkhorseboa.com:443/cordys/com.eibus.web.soap.Gateway.wcp";
var xmlhttp = cordys.getConnection();
xmlhttp.open("POST", cordysGatewayURL, false);
xmlhttp.send(requestString);


var responseXMLDOC = cordys.loadXMLDocument(xmlhttp.responseText) ;


var validUser = (cordys.selectXMLNode(responseXMLDOC,".//*[local-name()='Fault']/*[local-name()='faultstring']") == null);

if(validUser){

system.samlInfo=new Object();

system.samlInfo.eventData=responseXMLDOC;
document.getElementById("ssologin").setAssertions(responseXMLDOC);
window.location.href = "homepage_bkp.htm";
}
else
alert("invalid User");
}
</script>
</head>
<body>
<div id="ssologin" cordysType="wcp.library.system.SSO"></div>
UserName <input id="userId"/><br/><br/>
Password <input id="pwd"> <br/><br/>
<button id="submit" name="Submit" onclick="redirect()">Submit</button>
</body>
</html>

Creating tablespace in Oracle and assigning users to schema

CREATE TABLESPACE JournalEntry
datafile 'JournalEntry.dbf'
size 100M;

CREATE USER JE IDENTIFIED BY Journal;

grant all privileges to JE;

alter user <username> default tablespace <tablespace_name>;

How to Set up JConsole

Open <<WsApp>> Container :
Right click on the container and copy the jmx address. It will be similar to below
"service:jmx:rmi:///jndi/rmi://127.0.0.1:1099/cordys/je%23je_wsapp_sg%23je_wsapp_sc"

127.0.0.1 : IP Address of the server where the container is installed. If one is viewing JConsole from remote server, then you should not use 127.0.0.1 instead use the ip address of the server i.e., 192.168.10.90

Open Java directory (JDK Installed directory)
C:\Program Files\Java\jdk1.6.0_21\bin
Run JConsole.exe file from bin folder
Select "Remote Process" and give the above saved jmx address with jmx console credentials
Open MBeans tab and go to 'operations' in com.cordys in that tab.
Click on 'setNomLeakInfoBaseline'
Click on 'getNomLeakInfo' -- This will show growing document which probably is the reason for memory Leak.

Change default URL of Juniper Network

PROBLEM OR GOAL:
How can I change the default URL used by Network Connect launcher?



SOLUTION:
To change the URL:

Go to the following location on the end user's PC who is using Network Connect  :
For Vista & Windows 7 users:
C:\Users\<sername>\AppData\Roaming\Juniper Networks\Network Connect <version number>\

For Windows 2000 & XP users:
C:\Documents and Settings\user\Application Data\Juniper Networks\NetworkConnect <version number>\
Edit the versioninfo.ini file 

 The URL listed next to URL_0 is the default URL. Remove it and change it to the URL which you would like to be the default URL .
Example:

[SignIn]
URL_0=https://sslvpn.juniper.net
Save the changes. 

Launch NC . You will now be redirected to the new URL configured in the versioninfo.ini file .

Sample Contents of version.ini would be as below

[Network Connect 7.1.14]
locale=en
[GINA]
Stat=0
UsrModify=0
[WindowOption]
NotFirstRun=1
Top=0
Minimize=1
ShowStat=0
[SignIn]
URL_0=https://magoo.schneider-electric.com/xtern
URL_1=https://example.test.com/xtern
URLCOUNT=2


SOAP Request Usage

SOAP Request Object usage in Java

SOAPRequestObject getTasks = new SOAPRequestObject("http://schemas.cordys.com/notification/workflow/1.0", "GetTasks", new String[]{"AssignedBy","Target","OrderBy","ShowNonWorkableItems","ReturnTaskData"}, new Object[]{"","","Task.DeliveryDate desc",false,false} );
    getTasks.setUser(BSF.getUser());
    getTasks.addParameterAsXml(criterionNode);
    returnObj = getTasks.execute();

where criterionNode is an XMLNode(Int)

Logging in File system from Java

For places where you cannot debug, you can use CordysLogger according to your convenience  and debug your piece of code.

Logging into file system from Java
the Jar which needs to be used is managementlib.jar

private static final CordysLogger fileLog = CordysLogger.getCordysLogger(JE_UTILITY.class);

JE_UTILITY : Class Name where you want to Log.
This variable is a class variable.

the variable used is like 
fileLog.log(Severity.ERROR, "Exception in getting Pending tasks for the user "+e.getMessage());
fileLog.log(Severity.ERROR, "Exception in getting Pending tasks for the user",e);

Debug Java from Eclipse

Add this property to JRE config of the container 

-Xrunjdwp:transport=dt_socket,server=y,address=9009,suspend=n

9009 : Sample port number that need to be configured. This should be the same as the Debug Configurations from Eclipse. (For Debug configurations related to port please go through the below screen shots).



Configure Debug environment as below :