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...
Suggested Answer

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

(0) ShareShare
ReportReport
Posted on by 60

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

I have the same question (0)
  • Suggested answer
    Marco Mels Profile Picture
    on at

    This is a duplicate of posting:

    community.dynamics.com/.../how-to-figure-out-soap-body-odata-body-of-exposed-codeunit-webservice

  • SvenB Profile Picture
    60 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
    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

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 2,664

#2
YUN ZHU Profile Picture

YUN ZHU 960 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 773 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans