web
You’re offline. This is a read only version of the page.
close
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,075

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

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    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?

  • Rudi Hansen Profile Picture
    4,075 on at

    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
    237,965 Most Valuable Professional on at

    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
    4,075 on at

    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
    237,965 Most Valuable Professional on at

    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.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans