Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

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

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

Categories:
  • Suggested answer
    Marco Mels Profile Picture
    Marco Mels 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
    SvenB 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
    Marco Mels 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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans