Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Binding SAP webservice within CRM plugin

Posted on by 900

Hello,

I am trying to call webservice through plugin for . I can access the same webservice externally, but when i am trying to consume the same, it gives an error.

Please suggest how to bind it within CRM without  using app config as CRM doesn't allow to use appconfig  within plugin.

I want to call web service with out use of .config file.

Please refer below code :

            BasicHttpBinding binding = new BasicHttpBinding();
            binding.Security.Mode = BasicHttpSecurityMode.Transport;
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

            var address = new EndpointAddress("https://****************/XISOAPAdapter/MessageServlet?senderParty=&senderService=BC_CRM&receiverParty=&receiverService=BC_PRD&interface=SI_Inventory_Out&interfaceNamespace=http%3A%2F%2Fknack.com%2FCRM%2FInventory");

            SI_Inventory_OutClient client = new SI_Inventory_OutClient();
            client.ClientCredentials.UserName.UserName = "*****";
            client.ClientCredentials.UserName.Password = "******";
            client.Open();

 DT_Inventory_ReqRecords Inventory_ReqRecords = new DT_Inventory_ReqRecords();
            Inventory_ReqRecords.Material = "100000035";
            Inventory_ReqRecords.Plant = "1100";
            Inventory_ReqRecords.Storage_Loc = "";
            // Inventory_ReqRecords.Storage_Loc = "";

            DT_Inventory_ReqRecords[] DT_Inventory_ReqRecords = new DT_Inventory_ReqRecords[] { Inventory_ReqRecords };
            try
            {
                var Response = client.SI_Inventory_Out(DT_Inventory_ReqRecords);

}

*This post is locked for comments

  • Gmanunta81 Profile Picture
    Gmanunta81 315 on at
    RE: Binding SAP webservice within CRM plugin

    Hi Keyur,

    Can you show to the community the tech details of what you did? 

    I think that could help a lot of people 

  • Suggested answer
    keyur7379 Profile Picture
    keyur7379 900 on at
    RE: Binding SAP webservice within CRM plugin

    Hi,

    Now I am calling web service in different way. I have converted this web service in rest API using azure API management service. I don't know what exact issue in web service. I got this issue in only SAP web service while calling through CRM plugin. I have also called NAV web service in plugin and it is working fine. I think there are some issue in SAP web service.

    Thanks,

    Keyur Shah.

  • Seren S Profile Picture
    Seren S 400 on at
    RE: Binding SAP webservice within CRM plugin

    Hi Keyur,

    Have you tried to add properties for ProxyCredentialType for possible proxy blocks and Message.ClientCredentialType?

    I generally use the same method without no config files and it works with below-stated sample configuration.

                WSHttpBinding myBinding = new WSHttpBinding();
                myBinding.Name = "WsHttpBinding";
                myBinding.Security.Mode = SecurityMode.Transport;
                myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
    myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; myBinding.Security.Message.ClientCredentialType = MessageCredentialType.None; EndpointAddress endPointAddress = new EndpointAddress("xxx.azurewebsites.net/.../CustomerService"); YYY.CustomerServiceClient myClient = new YYYCustomerServiceClient(myBinding, endPointAddress); return myClient;

    Cheers, Seren.

  • gdas Profile Picture
    gdas 50,085 on at
    RE: Binding SAP webservice within CRM plugin

    Hi Keyur,

    I would suggest keep all the configuration key and value (URL, Credentials etc ) in a CRM entity , using organization service call retrieve all configuration value and assign it dynamically .

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans