AnsweredAssumed Answered

Java XOG Response 401 UnAuthorized

Question asked by SuhasAMD on Jan 17, 2014
Latest reply on Jan 23, 2014 by SuhasAMD

I have a Java code that xogs in certance instance. After upgrading to 12.1.3 from 12.1.1 it started giving error "401 Unauthorized" when invoke gets called. I tried to rung the XOG input xml that it tries to xog-in and it runs fine with the same user. However the java code is failing at the call of invoke().
Below is the log followed by code snippets

2014/01/17 03:17:43.021 | PPP XOG triggered
2014/01/17 03:17:43.021 | ServerName: CLARITYDEV01 : 80 : xxxxxxxx : xxxxxxxx false
2014/01/17 03:17:43.021 | User Name: xxxxxxxx
2014/01/17 03:17:43.021 | Selected the batch size as : 1
2014/01/17 03:17:43.021 | pjtid=PRJ-102957
2014/01/17 03:17:43.021 | SELECT TOP 1  [project_code],[project_name],[resource_code],[resource_name],[role_code] ,[role_name],[location] ,[project_manager],[data_id], [prim_object_partition],[location_db_id] FROM ZZ_PPP_DATA WHERE   status_record IN ( 'New', 'Error' ) AND ( ( retry_count ) <= (SELECT TOP(1) XYZ_retry_count FROM   odf_ca_XYZ_PPP_config  WHERE  XYZ_upload_type = 'project_alloc' ) OR ( retry_count IS NULL ) )  AND PROJECT_CODE = 'PRJ-102957' AND REQUEST_ID = 778 ORDER BY RESOURCE_NAME
2014/01/17 03:17:43.131 |  UPDATE zz_PPP_data SET [status_record] = 'Processing' WHERE data_id in ( 829194)
2014/01/17 03:17:43.131 | XOGGing project_alloc xml into CLARITYDEV01
2014/01/17 03:17:43.131 | <?xml version='1.0' encoding='UTF-8'?><NikuDataBus xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='../xsd/nikuxog_project.xsd'>
2014/01/17 03:17:43.131 | <Header version='6.0.11' action='write' objectType='project' externalSource='NIKU'/>
2014/01/17 03:17:43.131 | <Projects>
2014/01/17 03:17:43.131 | <Project name='TT Staff' projectID='PRJ-102957' managerResourceID=''  >
2014/01/17 03:17:43.131 |  <Resources>
2014/01/17 03:17:43.131 |  <Resource resourceID='446690' projectRoleID='qef_000061'  >
2014/01/17 03:17:43.131 | <AllocCurve>
2014/01/17 03:17:43.131 | <Segment start='2013-02-01T08:00:00' finish='2013-02-28T17:00:00' sum='0.0'  />

2014/01/17 03:17:43.131 | <Segment start='2014-12-01T08:00:00' finish='2014-12-31T17:00:00' sum='0.0'  />
2014/01/17 03:17:43.131 | </AllocCurve>
2014/01/17 03:17:43.131 | <CustomInformation>
2014/01/17 03:17:43.131 | <ColumnValue name='XYZ_geography'>5000001</ColumnValue>
2014/01/17 03:17:43.131 | </CustomInformation>
2014/01/17 03:17:43.131 | </Resource>
2014/01/17 03:17:43.131 | </Resources>
2014/01/17 03:17:43.131 | <Tasks>
2014/01/17 03:17:43.131 | <Task name='TT Staff'  taskID='~rmw' outlineLevel='1' >
2014/01/17 03:17:43.131 |  <Assignments>
2014/01/17 03:17:43.131 | <TaskLabor resourceID='446690' roleID='qef_000061' ></TaskLabor>
2014/01/17 03:17:43.131 | </Assignments>
2014/01/17 03:17:43.131 | </Task>
2014/01/17 03:17:43.131 | </Tasks>
2014/01/17 03:17:43.131 | <CustomInformation>
2014/01/17 03:17:43.131 | <ColumnValue name='partition_code'>XYZ_eng</ColumnValue>
2014/01/17 03:17:43.131 | </CustomInformation>
2014/01/17 03:17:43.131 | </Project>
2014/01/17 03:17:43.131 | </Projects>
2014/01/17 03:17:43.131 | </NikuDataBus>
2014/01/17 03:17:43.131 |
2014/01/17 03:17:43.474 | Error: Unsupported response content type &quot;text/html&quot;, must be: &quot;text/xml&quot;. Response was:
2014/01/17 03:17:43.474 | &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
2014/01/17 03:17:43.506 | &lt;html&gt;&lt;head&gt;;401 Unauthorized&lt;/h3&gt;
2014/01/17 03:17:43.506 | &lt;p/&gt;Please visit this link: &lt;a href=&apos;/niku/ClarityLoginErrorPage.htm&apos;&gt;/niku/ClarityLoginErrorPage.htm&lt;/a&gt;
2014/01/17 03:17:43.506 | &lt;/html&gt;
 2014/01/17 03:17:43.506 |  at org.apache.soap.rpc.Call.getEnvelopeString(Call.java:208)
2014/01/17 03:17:43.506 |  at org.apache.soap.rpc.Call.invoke(Call.java:255)
2014/01/17 03:17:43.506 |  at com.XYZ.XYZXOGclient.XogInvoker.initServerConnection(XogInvoker.java:82)
2014/01/17 03:17:43.506 |  at com.XYZ.XYZXOGclient.XogInvoker.invoke(XogInvoker.java:47)
2014/01/17 03:17:43.506 |  at com.XYZ.XYZXOGclient.XYZXOGclient.setup_and_performXOG(XYZXOGclient.java:171)

CODE STARTS HERE

     outMsg("PPP XOG triggered ");
              outMsg("ServerName: " + xogappServerName+" : " +portnumber+" : " +xogUsername+" : " +xogPassword+ sslenabled);
              outMsg("User Name: " + xogUsername);
              outMsg("Selected the batch size as : " + int_batch_size);
     this.objConnection.setAutoCommit(false);

                String inputUserxml = null;
                if (objType.equals("project_alloc") ){
                      GetProjectXML pjtxml = new GetProjectXML();
                      //pjtxml.setJobContext(this.jobContext);
                      pjtxml.setObjConnection(this.objConnection);
                      outMsg("pjtid=" + objID);
                       inputUserxml = pjtxml.getPjtInputXML(int_batch_size, DTType, objID, reqID);
                       //grab list of projects modified
                       this.processedRows =  pjtxml.selectedRows;
            pjtxml = null; //added by JRF to assist with memory leak
                }
                if (objType.equals("demand_plan") ){
                 GetDemandPlanXML dpxml = new GetDemandPlanXML();
                      //pjtxml.setJobContext(this.jobContext);
                      dpxml.setObjConnection(this.objConnection);
                      outMsg("demandplanid=" + objID);
                       inputUserxml = dpxml.getDPInputXML(int_batch_size, DTType, objID, reqID);
                       //grab list of projects modified
                       this.processedRows =  dpxml.selectedRows;
                       dpxml = null; //added by JRF to assist with memory leak
                }
              
                      outMsg("XOGGing " + objType + " xml into " + xogappServerName);
                      System.out.println(inputUserxml);       
                     
                   XogInvoker objXogInvoker = new XogInvoker(xogappServerName, portnumber, xogUsername, xogPassword, sslenabled);
                   objXogInvoker.invoke();
       
public void invoke()
  throws Exception
{
  if (this.g_ssl)
    this.url = new URL("https://" + this.g_servername + ":" + this.g_port + "/niku/soap");
  else {
    this.url = new URL("http://" + this.g_servername + ":" + this.g_port + "/niku/soap");
  }
  initServerConnection(this.g_username, this.g_password);
}

 public void initServerConnection(String username, String password)
   throws Exception
 {
   this.call = new Call();
   this.call.setSOAPMappingRegistry(new SOAPMappingRegistry());
   this.call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
   this.call.setTargetObjectURI("urn:NikuOpenGateway");
   this.call.setMethodName("initializeSession");

   Vector params = new Vector();
   params.addElement(new Parameter("userName", String.class, username, null));
   params.addElement(new Parameter("password", String.class, password, null));
   this.call.setParams(params);

   this.call.invoke(this.url, "");

Outcomes