I have written about it at length and prettier style at bitcoin stackexchange. Here is the link to it:
https://bitcoin.stackexchange.com/questions/62656/generate-a-p2sh-p2wsh-address-and-spend-output-sent-to-it
If you can provide any meaning full input on this problem it would be much appreciated
