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

Community site session details

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

Consuming SOAP webservices (Codeunit) from Azure Functions.

(0) ShareShare
ReportReport
Posted on by 38
Hi, I am trying to consume a Business Central webservices (SOAP) in an Azure function. 


The problem I have is that I do not know how to enter the credentials.

I am getting this error when I try to call any procedure from my SOAP: HTTP request is unauthorized with client authentication scheme 'Anonymous'

Thank you very much.
I have the same question (0)
  • Suggested answer
    raelhefn Profile Picture
    on at
    RE: Consuming SOAP webservices (Codeunit) from Azure Functions.

    Please refer to this doc. how to generate a web service key for authentication

    docs.microsoft.com/.../web-services-authentication

    Related Topic

    community.dynamics.com/.../how-to-test-api-s-in-d365-business-central

  • ivanrjlg Profile Picture
    38 on at
    RE: Consuming SOAP webservices (Codeunit) from Azure Functions.

    Hello, thank you very much for your answer. Currently I already have the Web Service Access Key established, and I do the test in postman as you suggest and it works perfectly, which I don't know how to pass those credentials through C # in my Azure Function.

  • Suggested answer
    ivanrjlg Profile Picture
    38 on at
    RE: Consuming SOAP webservices (Codeunit) from Azure Functions.

    Hello, I found the solution and I want to share it with you:

    private static void InitializeEndPoint(string URI)
            {
                BasicHttpBinding myBinding = new BasicHttpBinding();
                myBinding.Security.Mode = BasicHttpSecurityMode.Transport;
                myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
                myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
                myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
                myBinding.MaxReceivedMessageSize = 2147483647;
                myBinding.MaxBufferPoolSize = 2147483647;   
                myBinding.MaxBufferSize = 2147483647;   
    
                EndpointAddress endPoint = new EndpointAddress(URI);
                service = new ServiceClient(myBinding, endPoint);
    
                service.ClientCredentials.UserName.UserName = "UserName";
                service.ClientCredentials.UserName.Password = "Password";
            }

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

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

#1
Sumit Singh Profile Picture

Sumit Singh 2,163

#2
OussamaSabbouh Profile Picture

OussamaSabbouh 1,908

#3
YUN ZHU Profile Picture

YUN ZHU 1,878 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans