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
Hi Keyur,
Can you show to the community the tech details of what you did?
I think that could help a lot of people
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.
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.
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 .
Mohamed Amine Mahmoudi
83
Super User 2025 Season 1
Community Member
54
Victor Onyebuchi
6