public ChainCodeResponse invoke ( InvokeRequest invokeRequest ) throws ChainCodeException , NoAvailableTCertException , CryptoException , IOException { logger . debug ( String . format ( "Received invoke request: %s" , invokeRequest ) ) ; // Get a TCert to use in the invoke transaction setAttrs ( invokeRequest . getAttributes ( ) ) ; if ( null == getMyTCert ( ) && getChain ( ) . isSecurityEnabled ( ) ) { logger . debug ( "Failed getting a new TCert" ) ; throw new NoAvailableTCertException ( "Failed getting a new TCert" ) ; } logger . debug ( "Got a TCert successfully, continue..." ) ; Transaction transaction = InvocationTransactionBuilder . newBuilder ( ) . context ( this ) . request ( invokeRequest ) . build ( ) ; Fabric . Response response = execute ( transaction ) ; if ( response . getStatus ( ) == StatusCode . FAILURE ) { throw new ChainCodeException ( response . getMsg ( ) . toStringUtf8 ( ) , null ) ; } return new ChainCodeResponse ( transaction . getTxBuilder ( ) . getTxid ( ) , transaction . getChaincodeID ( ) , Status . SUCCESS , response . getMsg ( ) . toStringUtf8 ( ) ) ; }
Issue an invoke on chaincode