Plugin: Wordpress Soap integration
- Maintainer: User:habib.salhi
- License: GPLv2 - Free as in Freedom not Free Lunch
- Guide: installation [1]
- Guide: demo [2]
- Sources: archive.softwareheritage.org
Description
With The increasing popularity of wordpress, I felt that many projects in iDempiere might benefit from having a little interaction with outside users, weather it be business partners logging in to view their orders or make new orders or any form of communication with the ERP organizations.
This page will describe the process of creating the wordpress plugin that will connect to idempiere (SOAP as the communication protocol) and allow the below (functionality) interactions with wordpress site visitors.
Installation
steps to implement
- download the project
on idempiere (GardenWorld):
- Pack in the included webservices (9 no) from wp-idempiere-soap/PackIn
- for each one of the 9 imported webservice, go to "WebService Access" Tab add an access for Role "Web Service Execution"
- open Role Window, find the record "Web Service Execution" and check the box for "Access Advanced" - this is required to be able to add a record to "AD_User_Roles" Table as per our example
- add a role for the newly registered users we added role "External Partner User" (AD_Role_ID=1000000)
- add a Request Type "New User Notification" (R_RequestType_ID=1000000) and a Request Category "CRM Requests" (R_Category_ID=1000000)
on wordpress:
- modify the file wp-idempiere-soap/includes/general-setting.php to adapt to your access settings (AD_Client_ID, AD_Role_ID, UserName, Password, serviceURL of your server, p_AD_Role_ID, p_R_RequestType_ID, p_R_Category_ID, p_SalesRep_ID) as per the included sample
- zip the project into wp-idempiere-soap.zip and import the plugin from wp-admin
- add a menu and the pages to the theme
Functionality Overview
[puser-registration]
Here user can register to become a user of a certain Business Partner, the script will run the following 3 webservice in a compositeOperation wp-compositeWrapper:
- run wp-createUpdateUser webservice to add a new user to the chosen bPartner. The User will be locked and will have a random verification code assigned, awaiting verification
- run wp-AddUserRole and add the new user to a predefined Role
- run wp-userRQ and create a new request for the company CRM team to notify them of the new user registration and email the new user with their login credentials and a link to verify their login
[user-verification]
This page will be used by the user to verify his registration, typically they would have received an email with this format:
http://siteurl/wordpress/index.php?username=newuser&code=fsd78dfs6df
then do the following verification:
- run the wp-queryUsers webservice to query the AD_User_ID from the passed username parameter and the EMailVerify Code in iDempiere to be compared with the code parameter
- if the EMailVerify matches the passed code then run the wp-VerifyUser webservice to set the EMailVerifyDate timestamp and IsLocked to N
this will allow the user to login
[user-login]
This page has 2 forms
- User login using the wp-queryUsers webservice
- reset of the password using the wp-compositeWrapper and that internally will run 2 webservices
1. wp-createUpdateUser to change the user password with a random string
2. wp-userRQ will create a request that will email the user the new password and alert the system admin of the change
[user-profile]
after a successful login, the user is directed to this page, which again has 2 forms
1- view user profile using wp-queryUsers webservice
2- Edit user profile using the wp-createUpdateUser
[partner-orders]
This page will display the order history for the Business partner and requires 2 steps:
1- fetch the C_BPartner_ID of the logged in user by running the wp-queryUsers webService
2- run the wp-queryOrders webService and display the history of orders of that user
Credits & Other Resources
special thank to evenos Consulting GmbH (Jan Thielemann) for the great educational videos (link below) that jump started the project, I will highly recommend for anyone that wants to develop webservices in iDempiere
Ameet Kumar Srivastava (amtsrivastava007@gmail.com) for doing all the php coding for the wordpress plugin
My role in the project was initiating the idea for the plugin, all the base preparation in iDempiere, XML file on SmartBear (soupui), sponsoring, guiding and testing the implementation and documenting the open source project