Get the BizDocEnvelope using Java


I am new to webMethods, can anybody please let me know how to get the existing BizDocEnvelope from trading network using Java. I need to extract internal id from BizDocEnvelope using Java. Please help.

Why dont use WmTN tn.query folder services to extract already persisted bizdoc? Any reason why you want custom java service for that?