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

Invalid function when consuming SOAP web service

(0) ShareShare
ReportReport
Posted on by 95

Hi.
I have a problem to consume a web service made with SOAP in .net with Microsoft Business Central. It does not recognize the functions.
The fact is that I have been using the same web service since Nav 2009 and I have never had problems, but since Business Central (BC14 and BC15), it gives errors.
I discovered that the functions became [External] -> Scope ('Extension') -> Scope ('Cloud') depending on the version, but I've tried everything and it still doesn't work.
The SOAP Services of the service is active.
This is the error you make when calling the web service:

System.Web.Services.Protocols.SoapException: Method "Gfu_ObtUsuarios" is invalid!
en System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
en System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
en PasarelaWebServiceDvMobileLogistics.WS_Sailor.WS_MobileLogistic.Gfu_ObtUsuarios(String ps_Usuario, String ps_Password, String ps_IdAndroid, String& ps_xml)
en PasarelaWebServiceDvMobileLogistics.ServicioClientesAndroid.ObtUsuarios(Int32 p_nUsuario, Int32 p_nPassword, String p_strIdAndroid)

And in event viewer it gives this error:

Server instance: BC150
Category: Runtime
ClientSessionId: 15235b5c-0cf0-4507-82ea-1a1adbc21c47
ClientActivityId: e337ad39-51e8-40da-8837-dc15cd80fd6b
ServerSessionUniqueId: 3a8c2b8d-8354-439b-91dd-05995c6dbc89
ServerActivityId: bced3485-a43e-445f-95f8-ff333f0c46f7
EventTime: 12/17/2019 12:00:33
Message (ServiceBrokerException): RootException: ServiceBrokerException
Method "Gfu_User" is invalid!
ExceptionStackTrace:
at Microsoft.Dynamics.Nav.Service.SOAP.ServiceCodeunitXmlAdapter.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.SOAP.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.SOAP.XmlWWriter.Element(String name, XmlCallback elementHandler)
at Microsoft.Dynamics.Nav.Service.SOAP.XmlWWriter.SetNamespace(QNamespace namespace, XmlCallback nodeHandler)
at Microsoft.Dynamics.Nav.Service.SOAP.SoapHandler.Microsoft.Dynamics.Nav.Service.SOAP.IXmlRequestHandler.Dispatch(XmlElement input, XmlWWriter output)
at Microsoft.Dynamics.Nav.Service.SOAP.ServiceBroker.DispatchSoap(WebServiceUrlInfo relivantURLPart, XmlReader input, TextWriter output, NavTenant tenant, PerformanceLog perfLog)
at Microsoft.Dynamics.Nav.Service.SOAP.ServiceBroker.Invoke(Boolean isSoapMessage, Uri url, XmlReader input, TextWriter output, NavUserAuthentication navUserAuthentication, PerformanceLog performanceLog)
CallerStackTrace:
at Microsoft.Dynamics.Nav.Service.SOAP.ServiceBroker.Invoke(Boolean isSoapMessage, Uri url, XmlReader input, TextWriter output, NavUserAuthentication navUserAuthentication, PerformanceLog performanceLog)
at Microsoft.Dynamics.Nav.Service.SOAP.NavWebService.<>c__DisplayClass3_3.<ProcessMessage>b__2()
at Microsoft.Dynamics.Nav.Service.SOAP.Disposer.Scope(Code code)
at Microsoft.Dynamics.Nav.Service.SOAP.WCFUtil.GetPopulatedMemoryStream(StreamFillingCallback callback)
at Microsoft.Dynamics.Nav.Service.SOAP.NavWebService.ProcessMessage(Message message)
at SyncInvokeProcessMessage(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
at System.ServiceModel.Dispatcher.MessageRpc.Wrapper.Resume(Boolean& alreadyResumedNoLock)
at System.ServiceModel.Dispatcher.ThreadBehavior.ResumeProcessing(IResumeMessageRpc resume)
at Microsoft.Dynamics.Nav.Runtime.NavSynchronizationContext.<>c__DisplayClass1_0.<ClearThreadLocalStorageDelegate>b__0(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()


ProcessId: 9464
Tag: 000000D
ThreadId: 24
CounterInformation:
CustomParameters: 00000000-0000-0000-0000-000000000000

If anyone knew the problem, I would be very grateful, because I have been behind the problem for a long time.
Thanks.

  • Suggested answer
    cjstudioguy Profile Picture
    10 on at
    RE: Invalid function when consuming SOAP web service

    This appears to be resolved, as explained in this post:  demiliani.com/.../

    by changing the "FunctionVisibility" to external in the globals > funciton > properties of the CU

  • cjstudioguy Profile Picture
    10 on at
    RE: Invalid function when consuming SOAP web service

    We have just upgraded to BC 14, and it appears that web services based on code units no longer work.  The XML produced by the web service is not the same as the NAV 2015 version...it's missing several nodes.

  • ShanilAlg Profile Picture
    17 on at
    RE: Invalid function when consuming SOAP web service

    Did Anyone find a solution for this? I am also having a very similar issue and would like to know how this was resolved.

  • Business Central Profile Picture
    95 on at
    RE: Invalid function when consuming SOAP web service

    Hi.

    I've added it again but it still fails.

    The web service is mounted on Nav:

    Codeunit  50100  MobileLogistics  WS_MobileLogistic  0  1  dvlogisticbc15.davisa.local:7047/.../WS_MobileLogistic

    And if I click on the link, open the web service:

    <definitions xmlns="schemas.xmlsoap.org/.../" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/WS_MobileLogistic" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/WS_MobileLogistic">

    <types>

    <schema xmlns="www.w3.org/.../XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/WS_MobileLogistic">

    <element name="gfu_User">

    <complexType>

    <sequence>

    <element minOccurs="1" maxOccurs="1" name="user" type="string"/>

    </sequence>

    </complexType>

    </element>

    <element name="gfu_User_Result">

    <complexType>

    <sequence>

    <element minOccurs="1" maxOccurs="1" name="return_value" type="boolean"/>

    </sequence>

    </complexType>

    </element>

    </schema>

    </types>

    <message name="gfu_User">

    <part name="parameters" element="tns:gfu_User"/>

    </message>

    <message name="gfu_User_Result">

    <part name="parameters" element="tns:gfu_User_Result"/>

    </message>

    <portType name="WS_MobileLogistic_Port">

    <operation name="gfu_User">

    <input name="gfu_User" message="tns:gfu_User"/>

    <output name="gfu_User_Result" message="tns:gfu_User_Result"/>

    </operation>

    </portType>

    <binding name="WS_MobileLogistic_Binding" type="tns:WS_MobileLogistic_Port">

    <binding xmlns="schemas.xmlsoap.org/.../" transport="schemas.xmlsoap.org/.../>

    <operation name="gfu_User">

    <operation xmlns="schemas.xmlsoap.org/.../" soapAction="urn:microsoft-dynamics-schemas/codeunit/WS_MobileLogistic:gfu_User" style="document"/>

    <input name="gfu_User">

    <body xmlns="schemas.xmlsoap.org/.../" use="literal"/>

    </input>

    <output name="gfu_User_Result">

    <body xmlns="schemas.xmlsoap.org/.../" use="literal"/>

    </output>

    </operation>

    </binding>

    <service name="WS_MobileLogistic">

    <port name="WS_MobileLogistic_Port" binding="tns:WS_MobileLogistic_Binding">

    <address xmlns="schemas.xmlsoap.org/.../" location="dvlogisticbc15.davisa.local:7047/.../>

    </port>

    </service>

    </definitions>

    The problem is calling that function from the web service.

    Is it because the web service is made in visual studio 2012 and may it be old or has the access url changed in the version of Business central 15?

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Invalid function when consuming SOAP web service

    Yes, this method is accessible from the outside. Can you try to re-add the web service reference in Visual Studio?

  • Business Central Profile Picture
    95 on at
    RE: Invalid function when consuming SOAP web service

    I think that there has to be the problem, that something must be defined in the function to be externally accessible.

    It is a simple codeunit that only returns the true value if it is entered:

    codeunit 50100 "MobileLogistics"

    {

       trigger OnRun()

       begin

       end;

       procedure gfu_Prueba(Usuario: Text[30]): Boolean

       begin

           exit(true);

       end;

    }

    I understand that if nothing is put before the show, it is public.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Invalid function when consuming SOAP web service

    What page and method are you trying to call? How is the function you're calling defined in D365BC? Public or not?

  • Business Central Profile Picture
    95 on at
    RE: Invalid function when consuming SOAP web service

    Hi Stefano. Thanks for answering.

    The ultimate goal of the web service is to link data from a PDA with Navision through an application made in .net. It has always worked well for me with previous versions, but not with the central business extensions.

    I discovered in version BC14 that the functions had to be set as external, but in version BC15 that has disappeared and the function defined as [Scope ('Cloud')] is supposed to be, but it does not work. It is as if I find the function I call or because it is in an extension or because I cannot access it externally.

    Greetings and thank you.

  • Suggested answer
    Stefano Demiliani Profile Picture
    37,166 Most Valuable Professional on at
    RE: Invalid function when consuming SOAP web service

    SOAP web services works without problems. What is the object exposed as web service? Please give more details about your scenario.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

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

#1
YUN ZHU Profile Picture

YUN ZHU 576 Super User 2025 Season 1

#2
Mansi Soni Profile Picture

Mansi Soni 435

#3
Sagar Dangar, MCP Profile Picture

Sagar Dangar, MCP 386

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans