Over the years I’ve seen a number of people whose environments aren’t configured correctly and don’t have MWS Designer installed correctly. This post is to run through the setup and creating some webservices. I deliberately haven’t gone in to detail on how to consume those webservices as this post is quite long as it is.
Please be aware that MWS is the only Infor supported method of querying the database (there is currently no supported method for directly updating the database). Incidentally over the years we’ve heard the ‘M3 caches’ data and MWS is cache aware and there has been some anecdotal evidence to suggest that this may infact be the case in the later versions of M3 (eg 15.1.2).
So what is MWS Designer?
MWS Designer is a front-end to develop webservices to wrap SQL queries, M3 APIs and M3 Display Programs. It also provides the ability to deploy the xml files to your MWS servers and to create unit tests.
Be aware that the files MWS Designer creates for the webservices can be created by hand if you live and breath XML.
Note: Infor license MWS and MWS Designer separately. Often they sell them separately, which is ridiculous and I know a number of very unhappy customers that have been left in this situation.
Requirements:
- LWSDIG/MWSDIG pdf (install guide)
- lws/mws designer plugin (this must match the version of LWS/MWS on the server)
- Eclipse Classic (the version is specific to the plugins and can be determined from the install guide)
- JDK appropriate for your version of LWS/MWS
- Extract the Eclipse zip file to a location of your choosing
(Eclipse doesn’t install, it can just be run from the directory of your choosing)
- This will extract in to the directory of your choosing and create a subdirectory called eclipse
- Double click on the eclipse.exe
- Remove the tick from “Always ask before opening this file”
-
If you get an error about being able to create the VM then we need to the edit the Eclipse.ini file.
At the bottom, under the –vmargs change the settings so they are as follows-XX:MaxPermSize=256m
-Xms40m
-Xmx256m
Now Eclipse should start
- Help -> Install New Software
- Click Add -> Archive and select designer plug in then click on open.
- Click OK
- Select MWS Designer
- Click Next
- Click Next
- Accept the terms
- Click Finish
- Windows -> Open Perspective -> Other
- Select the MWS Designer and click on OK
- We should now see the MWS Designer opens
(note: the workspace defines where the webservices location and servers settings etc are read from)
- Web Service Repositories is where the websevices and their methods will be displayed
Verifying the Servers have been set up correctly
Often Infor miss a couple of steps in the setup of the environment, notably database connections.
- Start LifeCycle Manager
- Under the Applications Tab expand out the environment to find the LWS/MWS instance
- Right click and Select Manage Application
- Click on Configurations
You should have a database connection set up and a M3 Configuration -
Click on the spanner/and screwdriver to look at the details
- Example M3 Configuration
- Example Database configuration (Microsoft SQL)
- Example database configuration against an AS400
- Example M3 Configuration
- Check the database drivers that have been registered by clicking on JDBC
Uploading Database Drivers
Chances are that if your database connections weren’t configured, you won’t have the appropriate database drivers.
It is important but not critical to use a database driver that is available on both the server and the client. If they don’t match then you won’t be able to automatically generate the output fields for SQL queries.
On the AS400 the default that is registered tends to be the DB2Driver. There is no equivalent for the windows environment where you will run MWS Designer. The IBM documentation makes reference to the JT400 driver which can be obtained from http://jt400.sourceforge.net/
Note that each driver has a different syntax for connecting to a database, so review the appropriate documentation for the JDBC driver
- Start LifeCycle Manager
- Under the Applications Tab expand out the environment to find the LWS/MWS instance
- Right click and Select Manage Application
- Click on JDBC
- Click on Browse
- Locate the driver you want to upload and click on Open
- Click on Upload and you should get a message confirming the upload and it should appear in the uploaded JDBC Drivers. You will need to restart LWS/MWS to register the driver.
Adding Servers
We need to add connections to our LWS/MWS servers so we can deploy our WebServices
To do this we need to know the URI to the LWS/MWS server endpoints.
Discoverying your LWS/MWS Endpoints
- Start LifeCycle Manager
- Under the Applications Tab expand out the environment to find the LWS/MWS instance
- Right Click and Select Monitor Application
- Select Web Components
- Expand the Context Roots
- Record the entry point on the server that the LWS/MWS component is installed on (you can right click and select “Copy Shortcut”
http://ifbenp.indfish.co.nz:22104/mws
Adding LWS/MWS Connections to the WebServices Designer
- In the servers, click on the + button
- Provide a meaningful name and enter the URI that we got from MWS in LifeCycle Manager earlier
- Click on Finish and this should now be added to our servers list
- Click on the little chevron to the left of the server name to test our connection to the server
- Log in with a user that has rights to LWS/MWS
- And we shall have a list of the different configurations that we have set up in LWS/MWS
Create a Repository for your WebServices
A repository is there the XML files that define the webservices will be created.
You should save these files to be in a location that is backed up.
- In MWS Designer click on the Add Repository Location
- Specify a location where you would like to save the files
- Click on Finish
Creating WebServices
We have three options when creating our webservices.
SQL Queries Wrapped in a WebService
These allow you to wrap SQL queries and have data returned through a webservice. You can call Stored Procedures, DELETE, INSERT, SELECT and UPDATE
This is the only supported method for direct database interaction.
Most installs that I have come across can’t use the Populate output from statement
Which creates the resultset automatically based upon your query. This generally occurs because MWS wants to use the same database JDBC driver as the server to make the query, but it will do so from your computer.
Figure 1 – jdbc driver for this connection is missing
We can fix this issue by having the same jdbc driver on your computer. This can be imported in to the appropriate Eclipse directory by clicking Window -> Preferences -> MWS Designer -> Development Settings -> Import
In my instance you can see that I have the jt400.jar which was the same version as that which I used for my AS400 based M3 install and sqljdbc4-4.0.jar which is what is now used for the Windows based install of M3.
Note: please make sure that you uniquely name the resultsets per webservice. If a method has the same resultset as another method within the webservice, then you will enter a world of hurt using tools like Visual Studio whenever you make changes to the webservice.
I typically use the format <methodname>Result
M3 APIs Wrapped in a WebService
We can wrap the standard M3 APIs in a webservice. This has the advantage of external applications not needing the M3 API Toolset installed. It can also provide a nice, easy and consistent method of interfacing.
M3 Display Programs Wrapped in a WebService
This is the most difficult of types to create and get correct. M3 Display Programs will look at the ViewDefinitions and simulate what would be entered at the presentation layer.
This also has the highest risk of not working correctly and consistently after upgrades.
M3 Display Programs Build Example
We will use CRS055 to extract the Rate Factor, Name, Description and Currency for a specific currency.
- In MWS Designer
- Right Click on your Repo and select “New Web Service”
- Give the currency a name
- Select M3 Display Program to a type
- Select the server you want deploy this against
- We need to authenticate with a user that has at a minimum app-admin rights to MWS and use a user that exists in your authentication source
This will allow MWS to retrieve the configurations from the MWS Application - Select your Configuration
- Select the View configuration
- We will select CRS055
- Provide a meaningful name
- It will check to see if there is a M3 API with the same name and warn you if it exists (in general you should use the API instead)
- We need to enter the sequence we would use if we were using it in Smart Office
We want to be in panel B, then we want to go to Panel E before we exit (F3)
Entering the panels in here will populate the Inputs we can select from - To get to panel E, we need to select Option 5 (Display). We also need to specify the default currency (AUD) and we need to ensure that our Panel Sequence has panel E as our first entry
- Now we need select the E panel fields we want to extract
- Save our newly created WebService
- Click on the Overview tab and then click on Deployment Wizard
- Select the environment to deploy to
- Select the context (if you haven’t authenticated to MWS yet, you will be prompted)
- You should get a confirmation that the webservice has been deployed
- Go to MWS Configuration Page to confirm that we deployed our webserivce
Click on List
- Select the service context we deployed to and then click on our webservice
- We can see the WSDL Addresses that we can use to load in to an application like SoapUI or Visual Studio
I have created a web service and it works great in MWS designer. I am playing around with this so that I can get some experience using the M3 WS APIs. For an exercise I’d like to use a WS API from within Excel to add or change records in M3. In the past I have use the socket connectors but I’d like to do something new. I have been looking around for some documentation that would help me but have not come across the right things. For instance, in Excel there is a WEBSERVICE function that looks pretty interesting and I’d like to use that. Can you point me in the right direction? I have a feeling that I may get past a lot of security issues too.
Thanks,
Mike
Hi Mike,
I’ve never used the WebService function however it looks pretty primitive and I don’t see any way to provide credentials.
I’ve seen people use PocketSOAP in conjunction with Excel to interact with MWS – I’m not a big fan as it requires additional software to be installed.
What security issues are you experiencing? The user saving their password in the spreadsheet? Or cert issues?
Cheers,
Scott
Scott,
I am anticipating cert issues. With using the socket method I can prompt for credentials in VBA. I’m thinking it might not be so easy with Excel and WS API, Unless there is another toolkit available. I’m trying to do things in as modern a method as possible and sometimes I find documentation that seems just too old.
Just for starters, I’d like to find the formatting for the http command to use with the web services. For instance, I know if I paste something like this in my web browser that I get a nice response from the server:
http://server.companyname.com:21107/mws-ws/services/WS_MWS001MI?wsdl
I’d like to expand on that and add the actual transaction information to get some response on a transactional level, I just don’t know how to format it.
Great post – Thanks
I’ll be happy to get more details on the MDP
Can you use a M3 display program webservice to get the list of the B panels that match the criteria?
To be honest, I can’t remember if MWS allows you to pull back the list, but I’d not recommend approaching it from this direction as it’s a fairly fragile approach. I’d use standard APIs.