Thread

Skip Navigation LinksForums > SpiraTeam Forums > SpiraTeam Issues & Questi... > Web Service API authentic...

Web Service API authentication issue RSS Feed

Wednesday, January 4, 2012
I am using the Web Service API to update some test run data.

I call connection_Authenticate which returns "true"

I then call connection_ConnectToProject with a Project ID I know exists, and it throws an exception "The session was not authenticated, please call the Connection_Authenticate() method first"

I have also tried using
2 Replies
Charlie StottCharlie Stott
re: Charlie Stott on Wednesday, January 4, 2012
Wednesday, January 4, 2012
Sorry about previous post ending abruptly, messed up the cut & paste.

I tried using:

          ((BasicHttpBinding_IImportExportStub)service).setUsername("Integrator");
          ((BasicHttpBinding_IImportExportStub)service).setPassword("Password0");

but still get the same error.

Full code snippet follows, user and password are valid, exception occurs on ConnectToProject, as stated, same result with .setUsername/.setPassword lines commented:

<code>
  public static void main(String[] argv) {
      RemoteTestCase[] tcs;
      Boolean rcFlag;
      try {
          ImportExportLocator locator = new ImportExportLocator();
          IImportExport service = locator.getBasicHttpBinding_IImportExport();
          // If authorization is required
          ((BasicHttpBinding_IImportExportStub)service).setUsername("Integrator");
          ((BasicHttpBinding_IImportExportStub)service).setPassword("Password0");
          // invoke business method
          rcFlag = service.connection_Authenticate("Integrator", "Password0");
          System.out.println("Authenticate returns " + rcFlag.toString());
          rcFlag = service.connection_ConnectToProject(10);
          System.out.println("ConnectToProject returns " + rcFlag.toString());

          RemoteFilter[] remoteFilters = new RemoteFilter[1];
          remoteFilters[0].setPropertyName("NAME");
          remoteFilters[0].setStringValue("ConnectToWebService");

          tcs = service.testCase_Retrieve(remoteFilters, 0, 0);
          System.out.printf("Found %d test cases", tcs.length);

      } catch (javax.xml.rpc.ServiceException ex) {
          ex.printStackTrace();
      } catch (java.rmi.RemoteException ex) {
          ex.printStackTrace();
      }
  }
</code>

Adam SAdam S
re: Charlie Stott on Wednesday, January 4, 2012
Thursday, January 5, 2012
You need to turn on cookie handling on the web service proxy and that will fix the issue. The session cookie from the first Authenticate call is not being passed to the subsequent calls.
Tagged
Statistics
  • Started: 1/4/2012
  • Last Reply: 1/5/2012
  • Replies: 2
  • Views: 864
Powered by KronoDesk v1.1.0.15 | © Copyright Inflectra Corporation 2011-2016 | Licensed to Inflectra Corporation.