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

SOAP on Business Central Saas

(3) ShareShare
ReportReport
Posted on by 16
Hi experts,
 
I am trying to write a codeunit in BC SaaS to receive the following request:
 
<s:Body>
    <saveCustVend xmlns="http://tempuri.org">
      <DC xmlns:d4p1="http://schemas.datacontract.org/2004/07/Dynamics" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
        <d4p1:No>1</d4p1:No>
        <d4p1:Name>Test</d4p1:Name>
      </DC>
    </saveCustVend>
  </s:Body>
 
My codeunit looks like this:
 
codeunit 50100 "CustVendWebService"
{
    [ServiceEnabled]
    procedure saveCustVend(var DC: Text[100240]): Text
    var
        CustVendRecord: Record "Customer";
        AccountNum: Text[20];
        Name: Text[100];
 
    begin
 
 
        AccountNum := GetValueFromXML(DC, '<d4p1:AccountNum>', '</d4p1:AccountNum>');
        Name := GetValueFromXML(DC, '<d4p1:Name>', '</d4p1:Name>');
 
        CustVendRecord.Init();
        CustVendRecord."No." := AccountNum;
        CustVendRecord."Name" := Name;
        CustVendRecord.Insert();
 
        MESSAGE('Customer record inserted: %1', AccountNum);
    end;
 
    local procedure GetValueFromXML(XMLText: Text; StartTag: Text; EndTag: Text): Text
    var
        StartPos: Integer;
        EndPos: Integer;
        Value: Text;
        FullStartTag: Text;
    begin
        FullStartTag := StartTag;
        StartPos := StrPos(XMLText, FullStartTag);
        EndPos := StrPos(XMLText, EndTag);
        if (StartPos > 0) and (EndPos > StartPos) then
            Value := CopyStr(XMLText, StartPos + StrLen(FullStartTag), EndPos - StartPos - StrLen(FullStartTag));
        exit(Value);
    end;
}
 
I have published web service, and when I test it in postman, I get this error:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
        <s:Fault>
            <faultcode xmlns:a="urn:microsoft-dynamics-schemas/error">a:Microsoft.Dynamics.Nav.Service.SOAP.ServiceBrokerException</faultcode>
            <faultstring xml:lang="en-US">Parameter DC in method saveCustVend in service CustVendWebService is null! </faultstring>
            <detail>
                <string xmlns="http://schemas.microsoft.com/2003/10/Serialization/">Parameter DC in method saveCustVend in service CustVendWebService is null! </string>
            </detail>
        </s:Fault>
    </s:Body>
</s:Envelope>
 
Please help what to do :(
I have the same question (0)
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,175 Super User 2026 Season 1 on at
    The error likely occurs because BC SaaS expects structured input, not raw XML text. Instead of using Text for the parameter, try defining a table or record that matches the XML structure. If you're set on using XML, make sure the SOAP payload is formatted exactly as BC expects.
     
    Maybe This will give you a hint to resolve your problem.
     
    Checkout this bloghttps://yzhums.com/63037/
     
     
    ✅ Mark this answer as verified if it helps you.
  • Suggested answer
    Pallavi Phade Profile Picture
    5,510 Super User 2026 Season 1 on at
    Greetings !

    It means that your SOAP web service method saveCustVend expects a parameter named DC, and it is currently receiving a null value when you test it through Postman.
     
    Xml Format generated is incorrect .
    Check the WSDL from URL and you can check format
    Ensure the header is correct while testing in postman ( Content header type is correct)
     
    OR 
    Second Option
    Test the format with Soap Client - SoapUI ( testing tool) , it will give the generated structure in expected format.

     
    If you could get the solution based on above hints  , mark the answer as verified 
     
    Regards
    Pallavi Phade
     
  • Gerardo Rentería García Profile Picture
    26,427 Most Valuable Professional on at

    Hi, good day
    I hope this can help you, and give you some hints.

    Parameter No in method Read in service 'SOAP Endpoint' is null!

    Best Regards
    Gerardo

  • Suggested answer
    YUN ZHU Profile Picture
    100,471 Super User 2026 Season 1 on at
    Hi, hope the following helps as well.
    Dynamics 365 Business Central: Using OData V4 unbound action (Codeunit API?) to communicate and exchange data seamlessly
     
    Thanks.
    ZHU
  • Suggested answer
    RockwithNav Profile Picture
    9,099 Super User 2026 Season 1 on at
    Why not to go something new instead of previous way. Try unbound actions and see if this seems acceptable to 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,072 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,129 Super User 2026 Season 1

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 650 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans