Posting Invoice to Purchase Order

Hi everyone,

I am trying to post an invoice for a purchase order that has been received. I am trying to achieve this through web services or odata services. I would like to know how we can use the  codeunit 90/91 to achieve this job? Is it even possible as I am unable to see where i can pass which PO number to post invoice over codeunit 90 web service.

Secondly, the other way I was am trying is to use the "Purchase Invoice 51" to directly create an invoice however from front end we can associate receipts with that purchase invoice but through this service I am unable to find a way to associate receipts with the purchase invoice.

Any help would be great!