If you want to define the web service automatically, double click on the "webServices.lws" file in the definition folder on your java project and we will define the web service class on the screen that comes up.

The changes we made to the web service in this way will be automatically changed during each deployment. Recommended method.

Note: The changes we make to the classes defined for the web services must be turned on and off before deploying.

Warning:
Manual and Automatic The steps that we need to take when we see that the actions or changes you have made since making the definitions are not working on the customers' computers are in this order.


  • First, remove the aar file from our project and empty it
  • Afterwards we delete our file with aar extension which is found in Logo> WebContent> services> (name of our file) .aar.
  • Then we close the server, perform clean operations, and deploy the file with the extension aar.


    Kaynak Kod:
    Custom Web Service in Java.zip

In the adaptation project, a class is created as the first process to write a web service and the operations to be performed are coded in this class. In the following example class, the MMQOItemBrowser query of the material browser is executed and the resulting client is returned.


package com.acme.customization;
 
public class CustomWebService
{
 
public String[] getFirstNItems(int firm, int period, String language, int rowCount)
{
try
{
       IServerContext context = WebServiceHelper.getContext(firm, period, language);
       IServerQueryFactory factory = context.getServerQueryFactory();
       QueryParams params = new QueryParams();
       QueryBusinessObjects items = new QueryBusinessObjects();
       factory.first("MMQOItemBrowser", params, items, rowCount, true);
       String[] results = new String[rowCount];
       if(items != null && items.size() > 0)
       {
              for(int i = 0; i < items.size(); i++)
             {
                    QueryBusinessObject item = (QueryBusinessObject) items.get(i)
                    String code = QueryUtil.getStringProp(item, "Code");
                    String name = QueryUtil.getStringProp(item, "Name");
                    String searchText = QueryUtil.getStringProp(item, "SearchText");
                    results[i] = "Code: " + code + " Name: " + name + " Search Text: " + searchText;
             }
       }
       return results;
}
catch (Exception e)
{
       e.printStackTrace();
}
return null;
}
}


Once this step is completed, the adaptation project is compiled. In the adaptation project's directory, the class (CustomWebService) written in webservice/workspace/bin/ bin is created and objects in this class are created or accessed through static methods (ProjectUtil) .class extensions of classes that are in use and used. All these classes are placed in the corresponding folders as in the package definition (for the CustomWebService class ../com/acme/customization). Then the files with the .aar extension are placed inside these folders. Structure of this file with .aar extension:

  • META-INF
  • services.xml
  • MANIFEST.MF

Figs. In the above steps, other folders obtained by placing .class extension files are placed in this file, as in the same directory as META-INF.

After this, the contents of the services.xml file is changed as follows.



<service name="CustomWebService">
      <description>Description ...</description>
      <parameter name="ServiceClass">com.acme.customization.CustomWebService</parameter>
     
      <parameter name="InflowSecurity">
            <action>
                  <items>UsernameToken</items>
                  <passwordCallbackClass>com.lbs.ws.LbsUserPasswordCallback</passwordCallbackClass>
            </action>
      </parameter>
 </service>



In this XML, the name of the service tag is given the name of the web service. For the name property of the parameter label, the package information of the written class is written and the other parts are left as they are. Once all these operations are completed, the name of your .aar extension file should be named in the same way as the service name specified in the service tag in services.xml.


.After the aar file is renamed, it is placed under AlignmentProject / WebContentExtensionsWEB-INF / services under the adaptation project. Once this is done, the project is deployed. The following link is run on any internet browser to check if the web service has been created.


http://localhost:8080/logo/services/CustomWebService?wsdl

Telif HakkıKullanım KoşullarıGizlilik
Copyright © 2018 Logo Yazılım