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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

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

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

(0) ShareShare
ReportReport
Posted on by 66

Note: I originally posted this in the NAV Forum, but think BC is the better place for it.

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:

<soapenv:Header/>
<soapenv:Body>
<CreateInvLines><Purch_Rcpt_Line><No.>12345</No.></Purch_Rcpt_Line></CreateInvLines>
</soapenv:Body>
</soapenv:Envelope>

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

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at
  • SvenB Profile Picture
    66 on at

    yes that is what i have written in the beginning of my post. i just do not know how to remove the post in the NAV forum.

  • Suggested answer
    Marco Mels Profile Picture
    Microsoft Employee on at

    Missed that first line. No problem if you cross post in another forum. Hope you get the reply you need.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 728 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 545 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 328 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans