Problem with wsdl Service Reference in the plugin

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hey guys
Recently I'm working on a payment plugin for zarinpal.com gate way.
I have to add a service reference by this URL :

https://sandbox.zarinpal.com/pg/services/WebGate/wsdl

Every thing is ok but in PostProcessPayment I face with the error :

Could not find default endpoint element that references contract 'ServiceReference.PaymentGatewayImplementationServicePortType' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

and this is my PostProcessPayment method

   public void PostProcessPayment(PostProcessPaymentRequest postProcessPaymentRequest)
        {

            string urlToRedirect = "";
            var zarinpal = new ServiceReference.PaymentGatewayImplementationServicePortTypeClient();
            string outResult = "";
            int code = zarinpal.PaymentRequest("5607e960-d64c-4a8b-b03b-0e645bef37d4", 2500, "Our Test Store Name", "[email protected]", "0999999999", "http://" + _webHelper.GetStoreLocation(false) + "/Plugins/ZarinPal/PDTHandler", out outResult);// test
            if (code == 100)
            {
                urlToRedirect = string.Concat("https://sandbox.zarinpal.com/pg/StartPay/", outResult);
            }
            _httpContext.Response.Redirect(urlToRedirect);

        }


I would better to mention that if i add the Service Reference to Nop.Web Project too, it works well, but I want to build this as a module and adding the Service Reference Manually to Nop.Web is Unpleasant.
could you please help me ?
6 years ago
Im running into a similar issue.  What was the fix for this problem?  Thanks!
6 years ago
I've found the issue.
You must add web reference instead of adding service reference.
In the solution of your plugin project at first right click on references then click on add service references next instead of adding address and clicking OK button, you must click on advanced button.
after that click on add web reference button then add a WSDL url like this
https://zarinpal.com/pg/services/WebGate/wsdl
at last click on add reference button
I had attached two tutorial images let's see them.

1 :


2 :


if pictures doesn't show lets see this picture below.
here I had uploaded the pictures
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.