Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Calling an AX AIF/Web Service using the url

(0) ShareShare
ReportReport
Posted on by 4,020

So I have created an AIF/Web service in AX 2009 called QRCode, and if i try to call it from C# it works.

Now in the service i have a method called getVersion, and i would like to be able to call it directly using an URL in a browser instead of using the c# program, but I can seem to figure out what the url is supposed to be.

The Url for the service is localhost/.../qrcode.svc

This article about calling a webservice directly from an url (Not AX) did not seem to work (link)

I tried with localhost/.../getVersion and also localhost/.../getVersion

Does anyone have any tips?

*This post is locked for comments

  • Martin Dráb Profile Picture
    Martin Dráb 231,432 Most Valuable Professional on at
    RE: Calling an AX AIF/Web Service using the url

    Addressing through URL is surely the right approach with web services, but maybe you need a different operation than GET (e.g. POST) or some extra headers.

    If I was you, I would either use the proxy classes and wouldn't bother with my own HTTP requests, or I would capture the traffic and replicated what the classes do, rather than trying to figure it out by myself from scratch.

  • Rudi Hansen Profile Picture
    Rudi Hansen 4,020 on at
    RE: Calling an AX AIF/Web Service using the url

    I get this error :

    404 - File or directory not found.

    The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

    I also asked about this in a C# Forum, and it does seem like you are not really able to call a webservice from an URL, so I am going to try to make a new application on the web server that can receive the URL and then call AX using the BC.

  • Martin Dráb Profile Picture
    Martin Dráb 231,432 Most Valuable Professional on at
    RE: Calling an AX AIF/Web Service using the url

    Then the URL you used looks good to me (I think localhost/.../getVersion should work). Which error code did you get?

    By the way, if the classes work for you, you can check what requests they produce (e.g. by capturing HTTP traffic by Fiddler).

  • Rudi Hansen Profile Picture
    Rudi Hansen 4,020 on at
    RE: Calling an AX AIF/Web Service using the url

    When I open http://localhost/MicrosoftDynamicsAXAif50/qrcode.svc I get this.

    You have created a service.
    
    To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
    
    
    svcutil.exe localhost/.../qrcode.svc
    You can also access the service description as a single file:
    
    localhost/.../qrcode.svc
    This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:
    
    C#
    
    class Test
    {
        static void Main()
        {
            QRCodeClient client = new QRCodeClient();
    
            // Use the 'client' variable to call operations on the service.
    
            // Always close the client.
            client.Close();
        }
    }
    
    Visual Basic
    
    Class Test
        Shared Sub Main()
            Dim client As QRCodeClient = New QRCodeClient()
            ' Use the 'client' variable to call operations on the service.
    
            ' Always close the client.
            client.Close()
        End Sub
    End Class


    When I open http://localhost/MicrosoftDynamicsAXAif50/qrcode.svc?wsdl I get this.

    This XML file does not appear to have any style information associated with it. The document tree is shown below.
    <wsdl:definitions xmlns:wsdl="schemas.xmlsoap.org/wsdl" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:soapenc="schemas.xmlsoap.org/.../encoding" xmlns:wsu="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="schemas.xmlsoap.org/.../soap" xmlns:soap12="schemas.xmlsoap.org/.../soap12" xmlns:tns="schemas.microsoft.com/.../services" xmlns:wsa="schemas.xmlsoap.org/.../addressing" xmlns:wsx="schemas.xmlsoap.org/.../mex" xmlns:wsap="schemas.xmlsoap.org/.../policy" xmlns:wsaw="www.w3.org/.../wsdl" xmlns:msc="schemas.microsoft.com/.../contract" xmlns:wsp="schemas.xmlsoap.org/.../policy" xmlns:wsa10="www.w3.org/.../addressing" xmlns:wsam="www.w3.org/.../metadata" name="QRCode" targetNamespace="schemas.microsoft.com/.../services">
    <wsp:Policy wsu:Id="BasicHttpBinding_QRCode_policy">
    <wsp:ExactlyOne>
    <wsp:All>
    <http:NegotiateAuthentication xmlns:http="schemas.microsoft.com/.../http"/>
    </wsp:All>
    </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
    <xsd:schema targetNamespace="schemas.microsoft.com/.../Imports">
    <xsd:import schemaLocation="localhost/.../qrcode.svc" namespace="schemas.microsoft.com/.../services"/>
    <xsd:import schemaLocation="localhost/.../qrcode.svc" namespace="schemas.microsoft.com/.../Fault"/>
    <xsd:import schemaLocation="localhost/.../qrcode.svc" namespace="schemas.microsoft.com/.../Serialization"/>
    </xsd:schema>
    </wsdl:types>
    <wsdl:message name="QRCodeSetProdStatusRequest">
    <wsdl:part name="parameters" element="tns:QRCodeSetProdStatusRequest"/>
    </wsdl:message>
    <wsdl:message name="QRCodeSetProdStatusResponse">
    <wsdl:part name="parameters" element="tns:QRCodeSetProdStatusResponse"/>
    </wsdl:message>
    <wsdl:message name="QRCode_setProdStatus_AifFaultFault_FaultMessage">
    <wsdl:part xmlns:q1="schemas.microsoft.com/.../Fault" name="detail" element="q1:AifFault"/>
    </wsdl:message>
    <wsdl:message name="QRCode_getVersion_InputMessage"/>
    <wsdl:message name="QRCodeGetVersionResponse">
    <wsdl:part name="parameters" element="tns:QRCodeGetVersionResponse"/>
    </wsdl:message>
    <wsdl:message name="QRCode_getVersion_AifFaultFault_FaultMessage">
    <wsdl:part xmlns:q2="schemas.microsoft.com/.../Fault" name="detail" element="q2:AifFault"/>
    </wsdl:message>
    <wsdl:portType name="QRCode">
    <wsdl:operation name="setProdStatus">
    <wsdl:input wsaw:Action="schemas.microsoft.com/.../setProdStatus" name="QRCodeSetProdStatusRequest" message="tns:QRCodeSetProdStatusRequest"/>
    <wsdl:output wsaw:Action="schemas.microsoft.com/.../setProdStatusResponse" name="QRCodeSetProdStatusResponse" message="tns:QRCodeSetProdStatusResponse"/>
    <wsdl:fault wsaw:Action="schemas.microsoft.com/.../setProdStatusAifFaultFault" name="AifFaultFault" message="tns:QRCode_setProdStatus_AifFaultFault_FaultMessage"/>
    </wsdl:operation>
    <wsdl:operation name="getVersion">
    <wsdl:input wsaw:Action="schemas.microsoft.com/.../getVersion" message="tns:QRCode_getVersion_InputMessage"/>
    <wsdl:output wsaw:Action="schemas.microsoft.com/.../getVersionResponse" name="QRCodeGetVersionResponse" message="tns:QRCodeGetVersionResponse"/>
    <wsdl:fault wsaw:Action="schemas.microsoft.com/.../getVersionAifFaultFault" name="AifFaultFault" message="tns:QRCode_getVersion_AifFaultFault_FaultMessage"/>
    </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BasicHttpBinding_QRCode" type="tns:QRCode">
    <wsp:PolicyReference URI="#BasicHttpBinding_QRCode_policy"/>
    <soap:binding transport="schemas.xmlsoap.org/.../http"/>
    <wsdl:operation name="setProdStatus">
    <soap:operation soapAction="schemas.microsoft.com/.../setProdStatus" style="document"/>
    <wsdl:input name="QRCodeSetProdStatusRequest">
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="QRCodeSetProdStatusResponse">
    <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="AifFaultFault">
    <soap:fault name="AifFaultFault" use="literal"/>
    </wsdl:fault>
    </wsdl:operation>
    <wsdl:operation name="getVersion">
    <soap:operation soapAction="schemas.microsoft.com/.../getVersion" style="document"/>
    <wsdl:input>
    <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="QRCodeGetVersionResponse">
    <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="AifFaultFault">
    <soap:fault name="AifFaultFault" use="literal"/>
    </wsdl:fault>
    </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="QRCode">
    <wsdl:port name="BasicHttpBinding_QRCode" binding="tns:BasicHttpBinding_QRCode">
    <soap:address location="localhost/.../qrcode.svc"/>
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>


  • Martin Dráb Profile Picture
    Martin Dráb 231,432 Most Valuable Professional on at
    RE: Calling an AX AIF/Web Service using the url

    You can look into WSDL for details about service operations. This is what Visual Studio uses to generate the service client, so it clearly contains all necessary information.

    Also, don't you get a list of operations with links when you open localhost/.../qrcode.svc in browser?

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans