Skip to main content
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

  • Suggested answer
    Marco Mels Profile Picture
    on at
    RE: How to figure out SOAP Body / Odata body of exposed Codeunit webservice

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

  • SvenB Profile Picture
    60 on at
    RE: How to figure out SOAP Body / Odata body of exposed Codeunit webservice

    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
    RE: How to figure out SOAP Body / Odata body of exposed Codeunit webservice

    This is a duplicate of posting:

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

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

News and Announcements

Now Available: 2025 Release Wave 2

Quick Links

Ramesh Kumar – Community Spotlight

We are honored to recognize Ramesh Kumar as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

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

#1
Sohail Ahmed Profile Picture

Sohail Ahmed 2,655

#2
Mansi Soni Profile Picture

Mansi Soni 1,574

#3
YUN ZHU Profile Picture

YUN ZHU 1,453 Super User 2025 Season 1

Featured topics

Product updates

Dynamics 365 release plans