Darshan,
When you tested the Custom Function/BAPI in ERP were you logged in as the same user as what the MII JCo Connection is using? Also, did you test this in SE37 or somewhere else? Looks to me like the ABAP logic used to replace the <server> keyword is not working for the remote call. Also, you may want to use the URL Decode function in the MII Link editor to unencode the URL string into one that you can call directly.
Sam