Hmm looks like you wanna replace the functionality (of validation) provided in your stored procedure by a java service. What I don’t quite understand (as Mark said) how and where are you using the stored procedure. Doesn’t makes much sense but let’s assume that once you receive the published document in your subscription service, you send it off (somehow) to the stored procedure to validate it. Now, with this assumption -
You will need to create a java service (read the webM Java API) that will take the subscribed document as input (IData input), traverse the IData object to get individual fields in it and performs the validation. Based on the result of the validation, the service should return (possibly) a flag and a message. Once the java service is created and saved without error (a java service in IS is compiled when you save it), it is no different from a flow service for all practical uses. In your subscription service, invoke the java this service and give the subscribed document as input - use the result of this service to do - whatever.
Use the services in the idata folder of the WmSamples package to learn about traversing an IData using a java service.