How to generate a P2WSH address getnewaddress "" bech32 generates a P2WPKH address (e.g. tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx).

How can I generate a P2WSH address (e.g. tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7)?
To generate a P2WSH address, you need to have some script. The most easiest one you can use is a multisig script. You can do this with the addmultisigaddress. If you do something like

addmultisigaddress 1 '["37Ju7oTbPfe5qNAHYiAKfdTtVvCSP3TTdL"]' "" "bech32"


you should get a P2WSH address.