web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

How to figure out SOAP Body / Odata body of exposed Codeunit webservice

(0) ShareShare
ReportReport
Posted on by 60

Hi community,

I am exposing the codeunit 74 Purch.-Get Receipt as a webservice. My goal is to add purchase receipt lines to a purchase invoice via a webservice call.

This I want to achieve both with a SOAP request AND with an Odata request. (Reason: i have to set this up in a NAV16 and BC).

I gave the the webservice the name PurchGetReceipt.

Current Odata:

URL: api.businesscentral.dynamics.com/.../PurchGetReceipt_CreateInvLines DE'

Body: not sure what to put here.

Response: "Resource not found for the segment 'PurchGetReceipt_CreateInvLines'.

Current SOAP:

URL: api.businesscentral.dynamics.com/.../PurchGetReceipt

SOAPAction: urn:microsoft-dynamics-schemas/page/PurchGetReceipt:CreateInvLines

Body:

Response: Parameter purchRcptLine2 of the type INavRecordHandle in method CreateInvLines in service PurchGetReceipt is invalid!

I can't figure out how to construct the HTTP calls, neither in SOAP nor in OData in order to make this run.

Can you give me some pointers about the bodies and params I am missing.

I am attaching a screenshot of the codeunit, found in the AL Object Designer in Vscode.

Thanks Sven

Bildschirmfoto-2022_2D00_01_2D00_18-um-08.49.55.png

I have the same question (1)
  • Lars Lohndorf-Larsen Profile Picture
    on at

    Hello,

    You can see metadata like this:

    api.businesscentral.dynamics.com/.../$metadata

    Then search that for PurchGetReceipt and see if this gives you any ideas about how to call it.

    I think what you are looking for, is unbound actions (if not bound to a table but a function), for example:

    www.kauffmann.nl/.../

    Or if you want to add data, then usually it wold be via an api that exposes a page, which is bound to the table. A list of apis available in standard:

    docs.microsoft.com/.../endpoints-apis-for-dynamics

    Then use POST call to insert a record:

    docs.microsoft.com/.../devenv-connect-apps-tips

    another good resource for this is https://www.hougaard.com/

    I hope this helps you?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,226

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 2,047 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,257 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans