src/main/java/org/hyperledger/fabric/sdk/Fabrichelper.java
/**
     * Invoke blockchain query
     *
     * @param client The HF Client
     * @throws ProposalException
     * @throws InvalidArgumentException
     */
Invoke blockchain query
@param client The HF Client
@throws ProposalException
@throws InvalidArgumentException
Invoke blockchain query @param client The HF Client @throws ProposalException @throws InvalidArgumentException
public static String queryBlockChain(HFClient client,String ccid,String fcnname,String[] args) throws ProposalException, InvalidArgumentException {
        Channel channel = client.getChannel("mychannel");
        QueryByChaincodeRequest qpr = client.newQueryProposalRequest();
        ChaincodeID fabcarCCId = ChaincodeID.newBuilder().setName(ccid).build();
        qpr.setChaincodeID(fabcarCCId);
        qpr.setFcn(fcnname);
        qpr.setArgs(args);
        Collection<ProposalResponse> res = channel.queryByChaincode(qpr);
        String stringResponse=null;
        for (ProposalResponse pres : res) {
            stringResponse = new String(pres.getChaincodeActionResponsePayload());
        }
        return stringResponse;
    }
public static String queryBlockChain ( HFClient client , String ccid , String fcnname , String [ ] args ) throws ProposalException , InvalidArgumentException { Channel channel = client . getChannel ( "mychannel" ) ; QueryByChaincodeRequest qpr = client . newQueryProposalRequest ( ) ; ChaincodeID fabcarCCId = ChaincodeID . newBuilder ( ) . setName ( ccid ) . build ( ) ; qpr . setChaincodeID ( fabcarCCId ) ; qpr . setFcn ( fcnname ) ; qpr . setArgs ( args ) ; Collection < ProposalResponse > res = channel . queryByChaincode ( qpr ) ; String stringResponse = null ; for ( ProposalResponse pres : res ) { stringResponse = new String ( pres . getChaincodeActionResponsePayload ( ) ) ; } return stringResponse ; }
Invoke blockchain query
 @param client The HF Client
 @throws ProposalException
 @throws InvalidArgumentException
Invoke blockchain query @param client The HF Client @throws ProposalException @throws InvalidArgumentException
// get channel instance from client // create chaincode request // build cc id providing the chaincode name. Version is omitted here. // CC function to be called // display response //    log.info(stringResponse);