Hi
I have a plugin that fires on Update and sends data through a webservice to update an external MSsql db.
All was fine but the project was parked for a while.
I've since gone back to it and now there's an issue with no data apparently getting to the webservice.
The only change to the system is that the Webservice now runs over httpS where as before when it worked it was http.
Would this cause my problem and if so how can I fix?
The parameterized query '(@FirstName nvarchar(4000),@LastName nvarchar(4000),@Email nvarc' expects the parameter '@FirstName', which was not supplied.
*This post is locked for comments
Couldn't get this to work.
Changed to a .Net Webservice asmx from wcf and all ok now
I think the plugin is OK because I can use debug and trace all the data being generated right up to the point where the data is sent to the WS with "client.InsertUserDetails(userInfo);"
It's at that point that I get the error back from the WebService about parameters not being supplied.
I've since used this example to configure my WS but I'm still seeing the same problem.
Arrrghh
docs.microsoft.com/.../how-to-configure-an-iis-hosted-wcf-service-with-ssl
Thank you.
And is this how I'd use the function.
CrmDataInsertClient client = new CrmDataInsertClient(GetBasicHttpsBinding("xxxxx.com/.../CrmDataInsert.svc"), endPointAddress);
Hi Stuie ,
You need to change your plugin code accordingly -Here is sample code to dynamically get the binding
// For Basic HTTP binding
public static BasicHttpBinding GetBasicHttpBinding(string anyName) { var _binding = new BasicHttpBinding { Name = anyName, Security = { Mode = BasicHttpSecurityMode.None }, AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, MessageEncoding = WSMessageEncoding.Text, TextEncoding = Encoding.UTF8, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true }; return _binding; }
// For Basic HTTPS binding
public static BasicHttpsBinding GetBasicHttpsBinding(string anyName) { var _binding = new BasicHttpsBinding { Name = anyName, AllowCookies = false, BypassProxyOnLocal = false, HostNameComparisonMode = HostNameComparisonMode.StrongWildcard, MaxBufferPoolSize = Int32.MaxValue, MaxBufferSize = Int32.MaxValue, MaxReceivedMessageSize = Int32.MaxValue, MessageEncoding = WSMessageEncoding.Text, TextEncoding = Encoding.UTF8, TransferMode = TransferMode.Buffered, UseDefaultWebProxy = true }; return _binding; }
Hi Stuie,
Please refer this link to use deployment mode -
stackoverflow.com/.../dynamics-crm-plugin-calling-webclient-with-certificate-in-sandbox-mode
and refer this to call from web client.
social.msdn.microsoft.com/.../webclient-and-https
Mark as verified if this helps.
Thanks,
Sandeep
Hi. Thanks for the reply.
I'm using this from my Plugin;
myBinding.Name = "BasicHttpBinding_ICrmDataInsert"; myBinding.Security.Mode = BasicHttpSecurityMode.Transport; myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; EndpointAddress endPointAddress = new EndpointAddress("xxxxx.com/.../CrmDataInsert.svc"); CrmDataInsertClient client = new CrmDataInsertClient(myBinding, endPointAddress); CRMDataWcfService.UserDetails userInfo = new CRMDataWcfService.UserDetails();
and my .config file in the Plugin looks like this;
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_ICrmDataInsert" /> </basicHttpBinding> </bindings> <client> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICrmDataInsert" contract="ICrmDataInsert" name="BasicHttpBinding_ICrmDataInsert" /> </client> </system.serviceModel> </configuration>
How do you connect to the web service ? If you use a .Net Service Reference, then you'll need to change the configuration (either in code, or the respective .config file) to use https. However, if you use a .Net Web reference, or some of the http or web classes, then you shouldn't need to change anything other than the url. Note also that the web service may also need configuration to support https.
From the error, it looks like the issue is that you're either not passing a parameter, or the web service is not receiving it properly. This indicates that something else has probably also changed, as the changes just to use https shouldn't affect the parameters; in most cases the call would either succeed or fail
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156