[ZOOM] Has anyone used ZOOM to send an update holdings request toOCLC.

Andrew George ageorge at carl.org
Thu May 22 18:12:16 CEST 2008


-----Original Message-----
Which in turn is due to the lack of prior art.

 

 > Here is the structure we are sending in our request:

 > 

 > ES Struct: PyZ3950.asn1.ExtendedServicesRequest [

 

Oooohhhhh ...

 

So you're not using YAZ at all!  OK, you have a non-YAZ client

(PyZ3950) talking to a non-YAZ server (OCLC) ... *whew*, we're in the

clear :-)  Seriously, one or other is at fault -- you could try using

ziffy the packet sniffer to determine which.

 

Guys,

 

 We are using the YAZ/ZOOM toolkit. See the method below we are using to
construct the message.

We used PyZ3950 as a dummy server to see what we were sending.

 

Thanks,

 

Sam and Andy

 

//--------------------------------------------------------------------------
----

// Name: DoUpdate

// Description: Performs an update on a (connected) ZServer

// Returns: true if update succeeded, false if update failed

// Note: Private Function

//--------------------------------------------------------------------------
----

bool cnZ3950Session::DoUpdate(

            const Z_IUSuppliedRecords     &xSuppliedRecords,

            AnsiString                                &strDiagnostics

      )

{

      bool                    bSuccess = true;

 

      ZOOM_package      xZP = ZOOM_connection_package( m_xConnection,
m_xOptions );

 

      // OCLC only supports function=create and waitAction=wait

      ZOOM_package_option_set( xZP, "function", "create" );

      ZOOM_package_option_set( xZP, "waitAction", "wait" );

      ZOOM_package_option_set( xZP, "action", "elementUpdate" );

      ZOOM_package_option_set( xZP, "databaseName",

                  ZOOM_connection_option_get( m_xConnection, "databaseName"
) );

      ZOOM_package_option_set( xZP, "package-name", "Extended Service
Update" );

      ZOOM_package_option_set( xZP, "user-id", ZOOM_options_get(m_xOptions,
"user") );

      ZOOM_package_option_set( xZP, "record",
(*xSuppliedRecords.elements)[0].u.string );

 

      // Extended service package type is Database Update

      ZOOM_package_send( xZP, "update" );

      

      // CHECK FOR CONNECTION ERROR

      {

            const char  *acErrMsg = 0;

            const char  *acMoreInfo = 0;

            int               iError = ZOOM_connection_error(m_xConnection,
&acErrMsg, &acMoreInfo);

            if ( iError )

            {

                  std::ostringstream      oss;

                  oss << ZOOM_connection_option_get(m_xConnection, "host")
<< " iError: "

                        << acErrMsg << " (" << iError << ") " << acMoreInfo;

                  strDiagnostics = oss.str().c_str();

                  return false;

            }

      }

      

      // CHECK RESULT

      //    Because OCLC does not support async update, operationStatus will
be

      //    "done" or "fail" at this point.

      const char* pcOperationStatus = ZOOM_package_option_get( xZP,
"operation-status" );

      if ( 0==::strcmp( pcOperationStatus, "done" ) )

      {

            //    Because OCLC does not support async update, taskStatus
will be

            //    "complete" or "aborted" at this point.

            // ("pending" is past, "active" does not apply.)

            const char* pcTaskStatus = ZOOM_package_option_get( xZP,
"taskStatus" );

            if ( pcTaskStatus && 0==::strcmp( pcTaskStatus, "complete" ) )

            {

                  // Because we sent only one record, updateStatus will be
"Success" or "Failure" (never "Partial").

                  const char* pcUpdateStatus = ZOOM_package_option_get( xZP,
"updateStatus" );

                  bSuccess = ( 0==::strcmp( pcUpdateStatus, "Success" ) );

                  if ( ! bSuccess ) {

                        // ##### TBD: GET DIAGNOSTICS FROM
packageDiagnostics #####

                        ExtractUpdatePackageDiagnostics( xZP, strDiagnostics
);

                  }

            }

      }

      else

      {

            // Task failed

            bSuccess = false;

            strDiagnostics = "Something went wrong...";

            // ##### TBD: GET DIAGNOSTICS FROM operation-diagnostics #####

      }

      

      if ( ! bSuccess && ( strDiagnostics.Length() == 0 ) )

      {

            strDiagnostics = "Something went wrong...";

      }

      

      // Clean up the mess

      ZOOM_package_destroy( xZP );

 

      return bSuccess;

}

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.indexdata.dk/pipermail/zoom/attachments/20080522/5b22e056/attachment-0001.htm 


More information about the ZOOM mailing list