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)

AX 2009 - Web services

(0) ShareShare
ReportReport
Posted on by

Hello,

I have configured AIF through some guildlines on http://msdn.microsoft.com/en-us/library/aa496452(v=ax.10).aspx

Also, created the webservice through some guidlines:

Create AIF from AX:
---------------------
Before - create query.

1.tools -> development tools -> application integration framework -> create document service.
2.do next, check all insert/update/delete methods.
3.project on private. Check the class ends with 'service' + add new method.
4.extends the web service. Change security key, and adding new operation (of the previous method).

*****
Setup.

1. Site should be declared with web applications (api).
2. Basics -> Setup -> AIF -> Web sites. web url should have bin directory
3. Basics -> Setup -> AIF -> Services.
4. Doing Refresh (for getting new methods). Checking all service operations exists.
5. Find the service + Enable + Generate.
6. There is API created on the site (bin folder)

I can see the service as fine on the directory and API is created.

The service can be accessed via: http://myip:myport/services/myservice.xsd (ON IE BROWSERS).

When I add new service reference to VISUAL STUDIO (2008) The webservice is found, but I cannot see any of methods of the web-service (with the above address)

I don't know what to do in order to check if the the service (even hello world) is declared correctly, and searching for ways to know that.

Also, the namespace is always default : 'http://tempuri.org' - is that matter, and how can I change that?

I have seen guidlines on site: http://msdn.microsoft.com/en-us/library/cc652581(v=ax.50).aspx

and try browsing svc file, but I got the error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Source Error:


Line 13: mode used by ASP.NET to identify an incoming user.
Line 14: -->
Line 15: <authentication mode="Windows"/>
Line 16:
Line 17: <!--

Source File: C:\AXMobile\services\web.config Line: 15

Show Additional Configuration Errors:


It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (C:\AXMobile\services\web.config line 33)


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4241; ASP.NET Version:2.0.50727.4244

Help, please.

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Dick Wenning Profile Picture
    8,705 Moderator on at

    in general , AX only know an file share where it placed generated files. this file share is the virtual directory for IIS. (AIF site)

    some tips.

    - set allow directory browsing on IIS active makes life more easy.

    next thing you should know, the stuff in the file share is original generated in the application tree file directory , from there it is copied.

    the application pool user of iis should be similar to the ax proxy user.

    is this all working fine?

    also look at

    msdn.microsoft.com/.../cc652581(v=ax.50).aspx

    important to know, in case on iis integrated security is used, iis does security and you will end up in ax default company

    incase anomies exes on iis is set, the authentication should be placed in the header of the message, validation is done in AX

    I know this is a lot of info in a small massage. good luck

  • Community Member Profile Picture
    on at

    You have answered me once that kind of question.

    Pay attention for the error I get (even I declared a virtual directory, and do changes for web.config, as the link you gave). I am sure I missed something ...

    Again, here is the error message (after browsing svc file):

    Server Error in '/' Application.

    --------------------------------------------------------------------------------

    Configuration Error

    Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

    Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

    Source Error:

    Line 13: mode used by ASP.NET to identify an incoming user.

    Line 14: -->

    Line 15: <authentication mode="Windows"/>

    Line 16:

    Line 17: <!--

    Source File: C:\AXMobile\services\web.config Line: 15

    Show Additional Configuration Errors:

    It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. (C:\AXMobile\services\web.config line 33)

    --------------------------------------------------------------------------------

    Version Information: Microsoft .NET Framework Version:2.0.50727.4241; ASP.NET Version:2.0.50727.4244

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    please add the web.config file, I will compare it with my own installation

  • Community Member Profile Picture
    on at

    I have changed configuration as recommanded (binding="wsHttpBinding" bindingConfiguration="wsHttpWindowsAuthAif")

    Here is the web.config:

    *********************************************

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

     <system.web>

       <!--

               The <customErrors> section enables configuration of what to do if/when an unhandled

               error occurs during the execution of a request.  Specifically, it enables developers

               to configure html error pages to be displayed in place of a error stack trace.

           -->

       <customErrors mode="RemoteOnly" />

       <!--

               The <authentication> section enables configuration of the security authentication

               mode used by ASP.NET to identify an incoming user.

           -->

       <authentication mode="Windows"/>

     <!--

               The below settings (httpModules,trust) are in place to make sure AIF works

               when deployed with Windows Sharepoint Server (WSS). E.g. With Enterprise Portal (EP).

               WSS overrides certain Asp.NET configuration which makes standard Asp.NET applications to fail.

               For more details refer to support.microsoft.com

           -->

     <httpModules>

     <add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" />

     <add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" />

     <add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" />

     </httpModules>

     <!--

               Set the trust back to Full.    

             WSS configures a very restrictive trust policy that does not allow most applications to run correctly.

           -->

     <trust level="Full" originUrl="" />

     </system.web>

     <!-- Configure tracing information for debugging in production version -->

     <system.diagnostics>

       <!-- This is relevant only for DEBUG build.

            This disables assert dialog when Debug.Assert() is used in code. Since code will be running in IIS (no-ui)

            we have to disable dialogs. We will redirect it to a file

            Please make sure to give a full file path to where the assertion file should be located

         -->

       <assert assertuienabled="false" logfilename="AifDebugAsserts.webinfo" />

       <!-- This is used for enabling tracing in retail and debug builds.

              AIF Service processing stack outputs information messages used for debugging.

              Possible values for switch are Off, Warning, Information, Critical, Verbose.

              Change switchValue to Information to enable this.

         -->

       <sources >

         <source name="AifServiceProcessing" switchValue="Off">

           <listeners >

             <add name="TextWriterListener"

                  type="System.Diagnostics.TextWriterTraceListener"

                  initializeData="AifServiceTrace.webinfo" >

             </add>

             <remove name="Default" />

           </listeners>

         </source>

       </sources>

     </system.diagnostics>

     <appSettings>

       <!--

               This is the name of the 'system wide'/'global' configuration that should be used to log on using .NET Business Connector.

               The default case of the value being empty is - Business connector will log on to Microsoft Dynamics using the first available

               configuration from the registry and use it.

               The value of the key can be:

               1. The name specified for the new global configuration.

               2. The file name (with full path) to the exported configuration.

               If this value is specified, this configuration is used to log on to Microsoft Dynamics

               Usage: Override this value in case you dont want the default behavior of configuration.

               E.g. connect to different AOS server, or use a different default company etc.

           -->

       <add key="BUSINESS_CONNECTOR_CONFIGURATION" value=""/>

     </appSettings>

     <system.serviceModel>

       <bindings>

     <wsHttpBinding>

           <binding name = "wsHttpWindowsAuthAif" />

         </wsHttpBinding>

         <basicHttpBinding>

           <binding name="basicHttpBindingWindowsAuth">

             <security mode="TransportCredentialOnly">

               <transport clientCredentialType="Windows" />

             </security>

           </binding>

         </basicHttpBinding>

       </bindings>

       <services>

         <service behaviorConfiguration="serviceBehaviorConfiguration"

           name="Microsoft.Dynamics.IntegrationFramework.Service.SPLPurchReqTableMobService">

           <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpWindowsAuthAif"

             bindingNamespace="http://tempuri.org" contract="Microsoft.Dynamics.IntegrationFramework.Service.SPLPurchReqTableMobService" />

         </service>

       </services>

       <behaviors>

         <serviceBehaviors>

           <behavior name="serviceBehaviorConfiguration">

             <serviceMetadata httpGetEnabled="true" />

             <serviceDebug includeExceptionDetailInFaults="true" />

           </behavior>

         </serviceBehaviors>

       </behaviors>

     </system.serviceModel>

    </configuration>

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    IIS: Turn anonymous access on

    Web.config

    <system.serviceModel>

       <bindings>

         <wsHttpBinding>

           <binding name="wsHttpWindowsAuthAif"

                    closeTimeout="00:10:00"

                    openTimeout="00:10:00"

                    receiveTimeout="01:00:00"

                    sendTimeout="01:00:00"

                    maxReceivedMessageSize="2147483647" >

             <readerQuotas maxArrayLength="10000000" />

             <!-- security mode="TransportCredentialOnly"-->

             <!--transport clientCredentialType="Windows" /-->

             <!--/security-->

           </binding>

         </wsHttpBinding>

       </bindings>

    using System;

    using SysXml = System.Xml;

    using SysSvcmod = System.ServiceModel;

    using SysSvcmodChan = System.ServiceModel.Channels;

    namespace DynamicsAIFTester

    {

       class AIFHeader

       {

           private Uri AIFUri;

           private string AIFendpoint;

           public AIFHeader(Uri AIF_Uri, string AIF_endpoint)

           {

               AIFUri = AIF_Uri;

               AIFendpoint = AIF_endpoint;

               this.SetHeader_DestinationEndpoint(AIFendpoint);

               this.SetHeader_SourceEndpointUser(AIFUri);

               this.SetHeader_MessageId(Guid.NewGuid());

           }

           private void SetHeader_MessageId(Guid guidMessageId)

           {

               SysXml.UniqueId guidUniqueId;

               guidUniqueId = new SysXml.UniqueId(guidMessageId);

               SysSvcmod.OperationContext.Current.OutgoingMessageHeaders.MessageId = guidUniqueId;

           }

           protected void SetHeader_SourceEndpointUser(Uri uriEndpoint)

           {

               SysSvcmodChan.AddressHeader addressHeader;

               SysSvcmod.EndpointAddressBuilder epAddressBuilder;

               SysSvcmod.EndpointAddress epAddress1, epAddress2;

               addressHeader = SysSvcmodChan.AddressHeader.CreateAddressHeader

                       ("SourceEndpointUser"

                       , "schemas.microsoft.com/.../services"

                       , Environment.ExpandEnvironmentVariables("%userdomain%\\%username%"));

               epAddress1 = new SysSvcmod.EndpointAddress(uriEndpoint, addressHeader);

               epAddressBuilder = new SysSvcmod.EndpointAddressBuilder(epAddress1);

               epAddress2 = epAddressBuilder.ToEndpointAddress();

               SysSvcmod.OperationContext.Current.OutgoingMessageHeaders.From = epAddress2;

           }

           protected void SetHeader_DestinationEndpoint(string sDestinationEndpointName)

           {

               SysSvcmodChan.MessageHeader messageHeader;

               messageHeader = SysSvcmodChan.MessageHeader.CreateHeader

                       ("DestinationEndpoint"

                       , "schemas.microsoft.com/.../services"

                       , sDestinationEndpointName);

               SysSvcmod.OperationContext.Current.OutgoingMessageHeaders.Add(messageHeader);

           }

       }

    }

    MSDynamics.Journal.GeneralJournalServiceClient svc = new GeneralJournalServiceClient();

    operContextScope = new System.ServiceModel.OperationContextScope(svc.InnerChannel);

    using (operContextScope)

    {

    AIFHeader header = new AIFHeader(new Uri("urn:001"), "001"); AIFHeader(EndPoint-ID, localEndpointID)

    AxdLedgerGeneralJournal journal = new AxdLedgerGeneralJournal();

    svc.create(journal)

    }    

  • Community Member Profile Picture
    on at

    I changes to the script of yours, and Anonymous Autentication is enabled.

    I have the same problem (same error).

    IIS, Web site -> features view -> Autentication.

    Anonymous Autentication is enabled (Only Anonymous Authentication).

    Anonymous Autentication - Enabled

    ASP.NET Impression - Disabled

    Basic Authentication - Disabled

    Digest Authentication - Disabled

    Forms Authentication - Disabled

    Windows Authentication - Disabled

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    please send a screan dump of the endpoint configurations

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    also look in the windows event log when consuming the service (IIS server)

  • Community Member Profile Picture
    on at

    I think we shall next discuss in private messages via this forum.

    I want to check the service on the same machine.

    I can connect via RDP to the machine (of the same domain in network).

    How can I dump the endpoint configuration?

  • Dick Wenning Profile Picture
    8,705 Moderator on at

    please mail me on dwenning@kaya-consulting.com

    or use Lync with dwenning@kaya-consulting.com

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