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)

Consuming External WCF services in AX7

(0) ShareShare
ReportReport
Posted on by

For Dynamics AX To Talk to one of product in our product suite, to keep the data in sync within our product ecosystem, We are making use of a Service Reference added to the Project and trying to get authorization token back from external system (SIS) and trying to push some data.

 

Here we are using the below Integration Service

 3835.Image1.jpg

 

 

And we are trying to generate the in message assign values against each contracts and pushing it to external system(SIS).

 5001.Image2.jpg

7167.Image3.jpg

 

And we are getting back the error message “object reference not set to an instance of object”

While we see the WCF trace as well we get the same message.

While checking on the system in which we are trying to push data, in event viewer we are getting the below error specifies about the contract filter mismatch

 1781.Image4.jpg

 

We tried to push the same data using WCF Storm and its getting inserted properly.

Even on a console Application we create a new Service reference and Try calling the service using a C# project it works fine. Only when we call from Dynamics AX its giving a ContractFilterMissMatch error.

Any help would be Helpful. 

*This post is locked for comments

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

    Can you show us your complete code, please? Don't forget that we know nothing about the context where you use your code snippet.

  • Shashichandra K Profile Picture
    on at

     var binding = new System.ServiceModel.WSHttpBinding();

               endpointAddress = new System.ServiceModel.EndpointAddress(serviceAddress);

               sisAXIntegrationServiceClient = new CMCSISIntegration.ServiceReference.SISDynamicsAXService.DynamicsAxServiceClient(binding, endpointAddress);

        fundSource               = CMCFundSource::find(_cmcINTGFundSource.FundSourceCode, true);

                       addUpdateFundSourceInMsg = new CMCSISIntegration.ServiceReference.SISDynamicsAXService.AddUpdateFundSourceInMsg();

                       addUpdateFundSourceInMsg.set_Code(_cmcINTGFundSource.FundSourceCode);

                       addUpdateFundSourceInMsg.set_Description(fundSource.Description);

                       addUpdateFundSourceInMsg.set_TypeCode(CMCFundSourceType::findByRecId(fundSource.FundSourceType).FundSourceTypeCode);

                       addUpdateFundSourceInMsg.set_Active(_cmcINTGFundSource.IsActive);

                       addUpdateFundSourceInMsg.set_IncludeRemainNeed(true);

                       addUpdateFundSourceInMsg.set_GraceDays(0);

                       addUpdateFundSourceInMsgs = new CMCSISIntegration.ServiceReference.SISDynamicsAXService.AddUpdateFundSourceInMsg[1]();

                       addUpdateFundSourceInMsgs.SetValue(addUpdateFundSourceInMsg, 0);

                       addUpdateFundSourceRequest = new CMCSISIntegration.ServiceReference.SISDynamicsAXService.AddUpdateFundSourceRequest();

                       addUpdateFundSourceRequest.set_TokenId(tokenId);

                       addUpdateFundSourceRequest.set_AddUpdateFundSourceInMsgs(addUpdateFundSourceInMsgs);

                       addUpdateFundSourceResponse = sisAXIntegrationServiceClient.AddUpdateFundSource(addUpdateFundSourceRequest);

    Please find the code Above... to give you a small insignt,

      we have created a new serviceClient "sisAXIntegrationServiceClient" which is our Wcf Service hosted on another Server using a wshttpbinding.

    The below is the method we are calling from the service after filling in the inmesage and data contract details..

    addUpdateFundSourceResponse = sisAXIntegrationServiceClient.AddUpdateFundSource(addUpdateFundSourceRequest);

    Just to give a note here, we are consuming Soap Service and WCF service, this issue is happening only for WCF service, Soap Service is working fine.

    Let me know if you need more details....

  • AnoopNair Profile Picture
    85 on at

    You need to set the Security mode to None

    var binding = new System.ServiceModel.WSHttpBinding(System.ServiceModel.SecurityMode::None);

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