Webservice calling problem

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi all.
I have a problem while calling the webservice defined in Nop.Plugin.Misc.WebServices
I have extend the webservices with this method (defined also in the INopService interface)

public Category GetCategoryById(string usernameOrEmail, string userPassword, int categoryId)
        {
            CheckAccess(usernameOrEmail, userPassword);
            if (!_permissionSettings.Authorize(StandardPermissionProvider.ManageCategories))
                throw new ApplicationException("Not allowed to manage categories");
            Category c = _categoryService.GetCategoryById(categoryId);
            if (c == null)
                return null;
            return c;
        }



I have deployed my NopComemrce 3.0 solution on a local instalaltion (all with default data and test data in DB) and created a simple console application to interrogate the Webservices.
This is the code

NopServiceClient nsc = new NopServiceClient("BasicHttpBinding_INopService");
Category c = nsc.GetCategoryById("USERNAME", "PASSWORD", 3);


But i receive the following error


An error occurred while receiving the HTTP response to http://custom.nopcommerce.me/Plugins/Misc.WebServices/Remote/NopService.svc. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

The default methods from webservices instead works well.
What is the problem?
Regards.

M.
10 years ago
I think you're having this issue because you're returning a Category object in your web service method. You can try redefining a new and simpler category class, map to native Category object (probably using AutoMapper) and then return that DTO. Or you can use Data Contract Known Types. Actually it is better explained in the following link: http://msdn.microsoft.com/en-us/library/ms751512.aspx.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.