Web Service Advice

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Looking for help using the Web Services plugin.

1. How can I access the object types (e.g. Order, Customer) from within my client app? E.G. Order order = foo bar

2. Can objects be sent via http? I.E. If I call a method using the webservice that returns an order object, can I receive it on the client? My attepts at doing this so far have not succeeded.

Thanks for any help or advice.

Darren
12 years ago
I think you should extend the web service plugin by adding new methods for loading orders. It's also recommended to create DTO objects for this purpose (for each entity you want to return).
http://en.wikipedia.org/wiki/Data_transfer_object
http://martinfowler.com/eaaCatalog/dataTransferObject.html
12 years ago
Thats funny, I was reading about a webservice lib ServiceStack based on Marks comments.
12 years ago
a.m. wrote:
I think you should extend the web service plugin by adding new methods for loading orders. It's also recommended to create DTO objects for this purpose (for each entity you want to return).
http://en.wikipedia.org/wiki/Data_transfer_object
http://martinfowler.com/eaaCatalog/dataTransferObject.html


Any suggestions on how I can use the existing nop objects in my strongly types DataSet?

The DataSet designer wants me to drag objects from the db server. I'd prefer to use the existing objects in nop.core/Domain

I've tried inheriting the "Order" class but the DataSet class already inherits global::System.Data.DataSet

Do I need to create an interface for each nop object? E.g. IOrder
11 years ago
Dear I have the same problem.
I changed alttle a bit the current webservice plugin to have the methods I need.
For example I created a method

void AddProduct(string name, string productGID, string shortDescription, string fullDescription,
            byte[] pictureBinary, decimal price, string categoryName, string usernameOrEmail, string userPassword);

in order to insert products. That works fine

Now I need to create a second in order to receive Orders from my client

for example my method should have signature

IEnumerable<Order> LoadAllOrders(string usernameOrEmail, string userPassword);

In order to make the Order objects seriazible I added the [DataContract] attribute both in Order class as well as in baseEntity class.
I also added [DataMember] attribute to each member of this class.

When from my client try to call this method I get HTTP error. The only way I have managed to get data from nopcommerce back to my client is by calling
public DataSet ExecuteDataSet(string[] sqlStatements, string usernameOrEmail, string userPassword)

The problem is I do not want DATASETS. I need objects.

Any suggestions?

Thank you very much in advance
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.