#StackBounty: #xml #rest-api #web-services #soap-api #2.3.3-p1 Call to the “Get_Item_Quantity” function in the web service (trying to c…

Bounty: 350

I have a function in xml document and I want to return it’s parameters. My knowledge of connecting the two services is very limited. Do I need to create some middleware or is it possible just to call from magento swagger? Any help or resources to point me in the right direction would be super!

    Function name: Get_Item_Quantity

This function takes Type, Code fields and returns Qty1, Qty2, Qty3 Qty4
Parameters:

Type = 0 – input value
Code = ‘product100317’ – input value
Qty 1 – return value
Qty 2 – return value
Qty 3 – return value
Qty 4 – return value

How do i go about this?

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="urn:microsoft-dynamics-schemas/codeunit/myWSAPI" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/myWSAPI">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x00000" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x00000">
<complexType name="APIDataCapture">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Type" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Code" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty1" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty2" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty3" type="string"/>
<element minOccurs="1" maxOccurs="1" name="Qty4" type="string"/>
</sequence>
</complexType>
<complexType name="Root" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="unbounded" name="APIDataCapture" type="tns:APIDataCapture"/>
</sequence>
</complexType>
<element name="Root" type="tns:Root"/>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:microsoft-dynamics-nav/xmlports/x50014" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-nav/xmlports/x50014">
<complexType name="APIDataCapture">
<sequence>
<element minOccurs="1" maxOccurs="1" name="Type" type="string"/>
<element minOccurs="1" maxOccurs="1" default="0" name="EntryNo" type="int"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderFound" type="string"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderNo" type="string"/>
<element minOccurs="1" maxOccurs="1" default="0" name="SalesOrderLineNo" type="int"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderETADate" type="string"/>
<element minOccurs="1" maxOccurs="1" name="SalesOrderItemNo" type="string"/>
</sequence>
</complexType>
<complexType name="Root" mixed="true">
<sequence>
<element minOccurs="1" maxOccurs="unbounded" name="APIDataCapture" type="tns:APIDataCapture"/>
</sequence>
</complexType>
<element name="Root" type="tns:Root"/>
</schema>
<schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="urn:microsoft-dynamics-schemas/codeunit/MyWSAPI">
<element name="Get_Item_ETA_Date">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="itemNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_ETA_Date_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="date"/>
</sequence>
</complexType>
</element>
<element name="Find_Duplicate_Ext_Doc_No">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="custNo" type="string"/>
<element minOccurs="1" maxOccurs="1" name="extDocNo" type="string"/>
</sequence>
</complexType>
</element>
<element name="Find_Duplicate_Ext_Doc_No_Result">
<complexType>
<sequence>
<element minOccurs="1" maxOccurs="1" name="return_value" type="boolean"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_Quantity">
<complexType>
<sequence>
<element xmlns:q1="urn:microsoft-dynamics-nav/xmlports/x00000" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q1:Root"/>
</sequence>
</complexType>
</element>
<element name="Get_Item_Quantity_Result">
<complexType>
<sequence>
<element xmlns:q2="urn:microsoft-dynamics-nav/xmlports/x00000" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q2:Root"/>
</sequence>
</complexType>
</element>
<element name="GetSalesOrderETA">
<complexType>
<sequence>
<element xmlns:q3="urn:microsoft-dynamics-nav/xmlports/x50014" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q3:Root"/>
</sequence>
</complexType>
</element>
<element name="GetSalesOrderETA_Result">
<complexType>
<sequence>
<element xmlns:q4="urn:microsoft-dynamics-nav/xmlports/x50014" minOccurs="1" maxOccurs="1" name="aPIDataCapture" type="q4:Root"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="Get_Item_ETA_Date">
<part name="parameters" element="tns:Get_Item_ETA_Date"/>
</message>
<message name="Get_Item_ETA_Date_Result">
<part name="parameters" element="tns:Get_Item_ETA_Date_Result"/>
</message>
<message name="Find_Duplicate_Ext_Doc_No">
<part name="parameters" element="tns:Find_Duplicate_Ext_Doc_No"/>
</message>
<message name="Find_Duplicate_Ext_Doc_No_Result">
<part name="parameters" element="tns:Find_Duplicate_Ext_Doc_No_Result"/>
</message>
<message name="Get_Item_Quantity">
<part name="parameters" element="tns:Get_Item_Quantity"/>
</message>
<message name="Get_Item_Quantity_Result">
<part name="parameters" element="tns:Get_Item_Quantity_Result"/>
</message>
<message name="GetSalesOrderETA">
<part name="parameters" element="tns:GetSalesOrderETA"/>
</message>
<message name="GetSalesOrderETA_Result">
<part name="parameters" element="tns:GetSalesOrderETA_Result"/>
</message>
<portType name="MyWSAPI_Port">
<operation name="Get_Item_ETA_Date">
<input name="Get_Item_ETA_Date" message="tns:Get_Item_ETA_Date"/>
<output name="Get_Item_ETA_Date_Result" message="tns:Get_Item_ETA_Date_Result"/>
</operation>
<operation name="Find_Duplicate_Ext_Doc_No">
<input name="Find_Duplicate_Ext_Doc_No" message="tns:Find_Duplicate_Ext_Doc_No"/>
<output name="Find_Duplicate_Ext_Doc_No_Result" message="tns:Find_Duplicate_Ext_Doc_No_Result"/>
</operation>
<operation name="Get_Item_Quantity">
<input name="Get_Item_Quantity" message="tns:Get_Item_Quantity"/>
<output name="Get_Item_Quantity_Result" message="tns:Get_Item_Quantity_Result"/>
</operation>
<operation name="GetSalesOrderETA">
<input name="GetSalesOrderETA" message="tns:GetSalesOrderETA"/>
<output name="GetSalesOrderETA_Result" message="tns:GetSalesOrderETA_Result"/>
</operation>
</portType>
<binding name="MyWSAPI_Binding" type="tns:MyWSAPI_Port">
<binding xmlns="http://schemas.xmlsoap.org/wsdl/soap/" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="Get_Item_ETA_Date">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/MyWSAPI:Get_Item_ETA_Date" style="document"/>
<input name="Get_Item_ETA_Date">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Get_Item_ETA_Date_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="Find_Duplicate_Ext_Doc_No">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:Find_Duplicate_Ext_Doc_No" style="document"/>
<input name="Find_Duplicate_Ext_Doc_No">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Find_Duplicate_Ext_Doc_No_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="Get_Item_Quantity">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:Get_Item_Quantity" style="document"/>
<input name="Get_Item_Quantity">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="Get_Item_Quantity_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
<operation name="GetSalesOrderETA">
<operation xmlns="http://schemas.xmlsoap.org/wsdl/soap/" soapAction="urn:microsoft-dynamics-schemas/codeunit/myWSAPI:GetSalesOrderETA" style="document"/>
<input name="GetSalesOrderETA">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</input>
<output name="GetSalesOrderETA_Result">
<body xmlns="http://schemas.xmlsoap.org/wsdl/soap/" use="literal"/>
</output>
</operation>
</binding>
<service name="myWSAPI">
<port name="myWSAPI_Port" binding="tns:MyWSAPI_Binding">
<address xmlns="http://schemas.xmlsoap.org/wsdl/soap/" location="http://nav-devapp.myrugs.local:7947/NAV80TEST_Staging/WS/My%20Living%252C%20Inc./Codeunit/MyWSAPI"/>
</port>
</service>
</definitions>


Get this bounty!!!

#StackBounty: #web-services #xamarin #master-detail #project-template Is Xamarin Master-Detail Template Broken When used with Azure Bac…

Bounty: 50

The Master-Detail template in Xamarin has typically been a great starting point for many of my apps that work with .Net Core Backing Service. For review it has a Dependency service in the Client that allows Mocking of the Azure Backing Service or connection to a real or local service while in development.

The control variable generated by the template is public static bool UseMockDataStore = true;

All Code discussed is completely found here: https://github.com/BicycleMark/SignalRGB

I created a Xamarin Master-Detail project naming it SignalRGB and did the following:

  1. The solution project structure looks like:
    Solution Explored Visual Studio 2019
  2. I start Instance one Visual Studio 2019 And Run SignalRGB.Web
    enter image description here

3) Made Note of url: [https://localhost:44300]
4) Opened another Instance of Visual Studio (2) to run client with UseMockDataSource=false / The default it displayed results in Client using MockDataSource

5)went to these lines and updated Client for talking to my local server waiting for an http request :

 public static string AzureBackendUrl =
            //DeviceInfo.Platform == DevicePlatform.Android ? "http://10.0.2.2:5000" : "http://localhost:44300";
            DeviceInfo.Platform == DevicePlatform.Android ? "http://localhost:44300" : "http://localhost:44300";
        public static bool UseMockDataStore = false;
        public App()
        {
            InitializeComponent();
            if (UseMockDataStore)
            {
                DependencyService.Register<MockDataStore>();
            }
            else
            {
                DependencyService.Register<AzureDataStore>();
            }
            MainPage = new MainPage();
        }
  1. Went and ran SignalRGB.UWP from VS Instance(2) and client application hung on the line GetStringAsync():
         bool IsConnected => Connectivity.NetworkAccess == NetworkAccess.Internet;
         public async Task<IEnumerable<Item>> GetItemsAsync(bool forceRefresh = false)
         {
             if (forceRefresh && IsConnected)
             {
                 var json = await client.GetStringAsync ($"api/item");
                 items = await Task.Run(() => JsonConvert.DeserializeObject<IEnumerable<Item>>(json));
             }
    
             return items;
         }
    

I have tried other platforms iOS and get same result:

What Am I doing wrong here?


Get this bounty!!!

#StackBounty: #ruby-on-rails #ruby #web-services #httpclient #httparty Send multiple files using HTTParty

Bounty: 50

Here is the code which is working using Net::HTTP::Post

request = Net::HTTP::Post.new(url)
...
form_data = [
  ['attachments[]', File.open('file1.txt')],
  ['attachments[]', File.open('file2.txt')]
]
request.set_form form_data, 'multipart/form-data'
http.request(request)

Now, I am trying to use httparty like below but it is not working.

body = { attachments: [ File.open('file1.txt'), File.open('file2.txt') ] }

HTTParty.post(url, body: body)

The response I am getting from web service call is below:

#<HTTParty::Response:0x557d7b549f90 parsed_response={"error"=>true, "error_code"=>"invalid_attachment", "error_message"=>"Attachmen
t(s) not found or invalid."}, @response=#<Net::HTTPBadRequest 400 Bad Request readbody=true>, @headers={"server"=>["nginx"], "date"=>[
"Mon, 20 May 2019 07:41:50 GMT"], "content-type"=>["application/json"], "content-length"=>["102"], "connection"=>["close"], "vary"=>["
Authorization"], "set-cookie"=>["c18664e1c22ce71c0c91742fbeaaa863=uv425hihrbdatsql1udrlbs9as; path=/"], "expires"=>["Thu, 19 Nov 1981
08:52:00 GMT", "-1"], "cache-control"=>["no-store, no-cache, must-revalidate", "private, must-revalidate"], "pragma"=>["no-cache", "no
-cache"], "x-ratelimit-limit"=>["60"], "x-ratelimit-remaining"=>["59"], "strict-transport-security"=>["max-age=63072000; includeSubdom
ains;"]}>

It looks like it is not able to read the contents of files. Does HTTParty supports this or I need to use some other gem?


Get this bounty!!!

#StackBounty: #java #web-services #jersey #jersey-2.0 org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: o…

Bounty: 50

I have project in eclipse it’s an WebService Project REST API’s and i have also added another project in Configure Build path -> Add Project and i have added one another Project in my API method i am calling TestNGCreator class look below.

Basically this project uses jersey framework in java creating REST API and when i am calling any perticular method i.e. execute it will call another class which resides in another project i have added project in Build path of this project my other methods are working fine but when i am calling method from different project i having this error.

Do i need to declare some where that i am using this class and this method in POM.xml or some where else

I need to run the automation by calling this TestNGCreator.main(null);
my another project is automation project in java TestNGCreator class resides in automation project.By calling this method i need to call above class and when i am doing it i am getting error.

Error :

    May 17, 2019 4:20:51 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [Jersey Web Application] in context with path [/webservices] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: org/testng/TestNG] with root cause
java.lang.ClassNotFoundException: org.testng.TestNG
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1955)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1798)
    at testDrivers.TestNGCreator.runTestNGTest(TestNGCreator.java:44)
    at testDrivers.TestNGCreator.main(TestNGCreator.java:165)
    at com.xyz.webservices.Resource.executeScript(Resource.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:143)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:160)
    at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:158)
    at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:97)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
    at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
    at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:303)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:286)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1072)
    at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:399)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344)
    at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:110)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:1025)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1137)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:317)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

File : Resource.java

      @POST
      @Path("/execute")
      @Consumes(MediaType.APPLICATION_JSON)
      @Produces(MediaType.APPLICATION_JSON)
      public Response executeScript(String data) throws JSONException
        {   
            ArrayList<Object> testCases = new ArrayList<Object>();
            JSONArray jsonArray = new JSONArray();
            JSONObject json = new JSONObject(data);
            String configFile = (String) json.get("ConfigFiles");
            String sheetName = (String) json.get("Sheetname");
            jsonArray = (JSONArray) json.get("testCases");

            for (int i = 0 ; i < jsonArray.length() ; i++)
            {
                testCases.add(jsonArray.get(i));
            }

            try {
                TestNGCreator.main(null); //here  i am calling that class main method
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            Response response = null;
            System.out.println(jsonArray);
            System.out.println(testCases);
            return response;
        }

File : TestNGCreator.java

package testDrivers;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.testng.TestNG;
import org.testng.xml.XmlClass;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;

import projlib.Globals;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Iterator;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;

import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;




public class TestNGCreator 
{

    public void runTestNGTest() throws IOException 
    {

            System.out.println("Print this line in console");
            //Create an instance on TestNG
            TestNG myTestNG = new TestNG();

            //Create an instance of XML Suite and assign a name for it.
            XmlSuite mySuite = new XmlSuite();
            mySuite.setName(Globals.SUITE_NAME);

            //Create a list of XmlTests and add the Xmltest you created earlier to it.
            List<XmlTest> myTests = new ArrayList<XmlTest>();

            XSSFSheet excelWSheet = null;
            XSSFWorkbook excelWBook = null;
            XSSFCell cell = null;
            XSSFRow row = null;

            Double dblCellVal;
            String strCellVal = null;
            Boolean blnCellVal;

            FileInputStream excelFile = new FileInputStream(Globals.CONFIG_FILE_DIR+"/CropRecordConfig.xlsx");
            excelWBook = new XSSFWorkbook(excelFile);
            excelWSheet = excelWBook.getSheet("CropAdd");


            Iterator <Row> rowIterator = excelWSheet.iterator(); 
            //Iterator <Cell> cellIterator = row.cellIterator();
            String testName = null;
            int colCount;

            if (rowIterator.hasNext())
            {
                row = (XSSFRow) rowIterator.next();
                colCount = row.getPhysicalNumberOfCells();
            }
            while (rowIterator.hasNext())
            {
                row = (XSSFRow) rowIterator.next();
                Iterator <Cell> cellIterator = row.cellIterator();
                int curCell = 0;
                while (cellIterator.hasNext())
                {
                    cell = (XSSFCell) cellIterator.next();
                    curCell++;
                    switch (cell.getCellType())
                    {
                    case Cell.CELL_TYPE_NUMERIC:
                        dblCellVal = cell.getNumericCellValue();
                        strCellVal = dblCellVal.toString();
                        break;
                    case Cell.CELL_TYPE_STRING:
                        strCellVal = cell.getStringCellValue();
                        break;
                    case Cell.CELL_TYPE_BOOLEAN:
                        blnCellVal = cell.getBooleanCellValue();
                        strCellVal = blnCellVal.toString();
                        break;
                    }

                    //If it is first cell then store the Test Name
                    if (cell.getColumnIndex()== 0)
                    {
                        testName = strCellVal;
                    }

                    if (curCell == 5) {
                        if (strCellVal.equals("1.0")) {
                            //Adding to suite
                            //Create an instance of XmlTest and assign a name for it.
                            XmlTest myTest = new XmlTest(mySuite);
                            myTest.setName(testName);

                            //Add any parameters that you want to set to the Test.
                            Map<String, String> testngParams = new HashMap<String,String> ();
                            testngParams.put("testId", testName);
                            myTest.setParameters(testngParams);

                            //Create a list which can contain the classes that you want to run.
                            List<XmlClass> myClasses = new ArrayList<XmlClass> ();
                            myClasses.add(new XmlClass("TestDriver"));

                            //Assign that to the XmlTest Object created earlier.
                            myTest.setXmlClasses(myClasses);

                            //Adding the test to test list created earlier
                            myTests.add(myTest);
                            break;

                        }
                    }
                }

            }

            excelWBook.close();

            //add the list of tests to your Suite.
            mySuite.setTests(myTests);

            //Add the suite to the list of suites.
            List<XmlSuite> mySuites = new ArrayList<XmlSuite>();
            mySuites.add(mySuite);

            //Set the list of Suites to the testNG object you created earlier.
            myTestNG.setXmlSuites(mySuites);

            File file = new File(Globals.TESTNG_FILE_NAME);
            System.out.println("File is: " + file);

            FileWriter writer = new FileWriter(file);
            writer.write(mySuite.toXml());
            writer.close();

            //invoke run() - this will run your class.
            //myTestNG.run();




    }
    public static void main(String args[]) throws IOException
    {
        TestNGCreator testDriver = new TestNGCreator();
        testDriver.runTestNGTest();
    }
}

File : POM.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.xyz</groupId>
    <artifactId>webservices</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>webservices</name>

    <build>
        <finalName>webservices</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <inherited>true</inherited>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.jersey</groupId>
                <artifactId>jersey-bom</artifactId>
                <version>${jersey.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.glassfish.jersey.containers</groupId>
            <artifactId>jersey-container-servlet</artifactId>
            <!-- use the following artifactId if you don't need servlet 2.x compatibility -->
            <!-- artifactId>jersey-container-servlet</artifactId -->
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
        </dependency>
        <!-- uncomment this to get JSON support-->
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-moxy</artifactId>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
             <version>20080701</version>
       </dependency>
         <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.15</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.15</version>
    </dependency>
    </dependencies>

    <properties>
        <jersey.version>2.16</jersey.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
</project>

Any suggestion will be appreciated thank you ^.^


Get this bounty!!!

#StackBounty: #web-services #ecommerce #magento #point-of-sale Developer-friendly, e-commerce (Magento)-adapted, EU-compliant PoS softw…

Bounty: 50

I’m currently looking for a Point of Sales software to plug in with our Magento website. Currently we use Hiboutik, but the connector is not so good and the API does not allow us to handle all the entities we can create inside it (like gift card accounts). This software is a good reference, but it is still a very young technology and lacks many functionalities.
Here are our requirements :

  • compliance with EU laws (RGPD)
  • completely API-ready
  • if possible, a web interface (so we can use the software as well on PC as tablets)
  • if possible also, existing Magento connector
  • advanced functionalities, like gift card accounts, discount campaigns, mail sending, client profiles and such

The whole goal is to pilot the software and the campains of our physical shop from our e-shop, with CRONs, scripts, and to centralize stock and orders data on our e-shop.

We already looked into those software, which didn’t satisfy our needs :

  • Fastmag
  • Lineosoft


Get this bounty!!!

#StackBounty: #web-services #ecommerce #magento #point-of-sale Good developer-friendly, e-commerce (Magento) adapted, EU compliant PoS …

Bounty: 50

I’m currently looking for a Point of Sales software to plug in with our Magento website. Currently we use Hiboutik, but the connector is not so good and the API does not allow us to handle all the entities we can create inside it (like gift card accounts). This software is a good reference, but it is still a very young technology and lacks many functionalities.
Here are our requirements :

  • compliance with EU laws (RGPD)
  • completely API-ready
  • if possible, a web interface (so we can use the software as well on PC as tablets)
  • if possible also, existing Magento connector
  • advanced functionalities, like gift card accounts, discount campaigns, mail sending, client profiles and such

The whole goal is to pilot the software and the campains of our physical shop from our e-shop, with CRONs, scripts, and to centralize stock and orders data on our e-shop.

We already looked into those software, which didn’t satisfy our needs :

  • Fastmag
  • Lineosoft


Get this bounty!!!

Installing Apache UserGrid on linux

About the Project

Apache Usergrid is an open-source Backend-as-a-Service (BaaS or mBaaS) composed of an integrated distributed NoSQL database, application layer and client tier with SDKs for developers looking to rapidly build web and/or mobile applications. It provides elementary services and retrieval features like:

  • User Registration & Management
  • Data Storage
  • File Storage
  • Queues
  • Full Text Search
  • Geolocation Search
  • Joins

It is a multi-tenant system designed for deployment to public cloud environments (such as Amazon Web Services, Rackspace, etc.) or to run on traditional server infrastructures so that anyone can run their own private BaaS deployment.

For architects and back-end teams, it aims to provide a distributed, easily extendable, operationally predictable and highly scalable solution. For front-end developers, it aims to simplify the development process by enabling them to rapidly build and operate mobile and web applications without requiring backend expertise.

Usergrid 2.1.0 Deployment Guide

Though the Usergrid Deployment guide seems to be simple enough, I faced certain hiccups and it took me about 4 days to figure out what I was doing wrong.

This document explains how to deploy the Usergrid v2.1.0 Backend-as-a-Service (BaaS), which comprises the Usergrid Stack, a Java web application, and the Usergrid Portal, which is an HTML5/JavaScript application.

Prerequsites

Below are the software requirements for Usergrid 2.1.0 Stack and Portal. You can install them all on one computer for development purposes, and for deployment you can deploy them separately using clustering.

Linux or a UNIX-like system (Usergrid may run on Windows, but we haven’t tried it)

Download the Apache Usergrid 2.1.0 binary release from the official Usergrid releases page:

After untarring the files that you need for deploying Usergrid Stack and Portal are ROOT.war and usergrid-portal.tar.

Stack STEP #1: Setup Cassandra

As mentioned in prerequisites, follow the installation guide given in link

Usergrid uses Cassandra’s Thrift protocol
Before starting cassandra, on Cassandra 2.x releases you MUST enable Thrift by setting start_rpc in your cassandra.yaml file:

    #Whether to start the thrift rpc server.
    start_rpc: true

Note:DataStax no longer supports the DataStax Community version of Apache Cassandra or the DataStax Distribution of Apache Cassandra. It is best to follow the Apache Documentation

Once you are up and running make a note of these things:

  • The name of the Cassandra cluster
  • Hostname or IP address of each Cassandra node
    • in case of same machine as Usergrid, then localhost. Usergrid would then be running on single machine embedded mode.
  • Port number used for Cassandra RPC (the default is 9160)
  • Replication factor of Cassandra cluster

Stack STEP #2: Setup ElasticSearch

Usergrid also needs access to at least one ElasticSearch node. As with Cassandra, you can setup single ElasticSearch node on your computer, and you should run a cluster in production.

Steps:

  • Download and unzip Elasticsearch
  • Run bin/elasticsearch (or bin\elasticsearch -d on Linux as Background Process) (or bin\elasticsearch.bat on Windows)
  • Run curl http://localhost:9200/

Once you are up and running make a note of these things:

  • The name of the ElasticSearch cluster
  • Hostname or IP address of each ElasticSearch node
    • in case of same machine as Usergrid, then localhost. Usergrid would then be running on single machine embedded mode.
  • Port number used for ElasticSearch protocol (the default is 9200)

Stack STEP #3: Setup Tomcat

The Usergrid Stack is contained in a file named ROOT.war, a standard Java EE WAR ready for deployment to Tomcat. On each machine that will run the Usergrid Stack you must install the Java SE 8 JDK and Tomcat 7+.

Stack STEP #4: Configure Usergrid Stack

You must create a Usergrid properties file called usergrid-deployment.properties. The properties in this file tell Usergrid how to communicate with Cassandra and ElasticSearch, and how to form URLs using the hostname you wish to use for Usegrid. There are many properties that you can set to configure Usergrid.

Once you have created your Usergrid properties file, place it in the Tomcat lib directory. On a Linux system, that directory is probably located at /path/to/tomcat7/lib/

The Default Usergrid Properties File

You should review the defaults in the above file. To get you started, let’s look at a minimal example properties file that you can edit and use as your own.

Please note that if you are installing Usergrid on the same machine as Cassandra Server, then set the following property to true

   #Tell Usergrid that Cassandra is not embedded.
   cassandra.embedded=true

Stack STEP #5: Deploy ROOT.war to Tomcat

The next step is to deploy the Usergrid Stack software to Tomcat. There are a variety of ways of doing this and the simplest is probably to place the Usergrid Stack ROOT.war file into the Tomcat webapps directory, then restart Tomcat.

Look for messages like this, which indicate that the ROOT.war file was deployed:

INFO: Starting service Catalina
Jan 29, 2016 1:00:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.59
Jan 29, 2016 1:00:32 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /usr/share/tomcat7/webapps/ROOT.war

Does it work?

you can use curl:

curl http://localhost:8080/status

If you get a JSON file of status data, then you’re ready to move to the next step. You should see a response that begins like this:

{
“timestamp” : 1454090178953,
“duration” : 10,
“status” : {
“started” : 1453957327516,
“uptime” : 132851437,
“version” : “201601240200-595955dff9ee4a706de9d97b86c5f0636fe24b43”,
“cassandraAvailable” : true,
“cassandraStatus” : “GREEN”,
“managementAppIndexStatus” : “GREEN”,
“queueDepth” : 0,
“org.apache.usergrid.count.AbstractBatcher” : {
“add_invocation” : {
“type” : “timer”,
“unit” : “microseconds”,
… etc. …

Initialize the Usergrid Database

Next, you must initialize the Usergrid database, index and query systems.

To do this you must issue a series of HTTP operations using the superuser credentials. You can only do this if Usergrid is configured to allow superused login via this property usergrid.sysadmin.login.allowed=true and if you used the above example properties file, it is allowed.

The three operation you must perform are expressed by the curl commands below and, of course, you will have ot change the password test to match the superuser password that you set in your Usergrid properties file.

curl -X PUT http://localhost:8080/system/database/setup -u superuser:test
curl -X PUT http://localhost:8080/system/database/bootstrap -u superuser:test
curl -X GET http://localhost:8080/system/superuser/setup -u superuser:test

When you issue each of those curl commands, you should see a success message like this:

{
“action” : “cassandra setup”,
“status” : “ok”,
“timestamp” : 1454100922067,
“duration” : 374
}

Now that you’ve gotten Usergrid up and running, you’re ready to deploy the Usergrid Portal.

Deploying the Usergrid Portal

The Usergrid Portal is an HTML5/JavaScript application, a bunch of static files that can be deployed to any web server, e.g. Apache HTTPD or Tomcat.

To deploy the Portal to a web server, you will un-tar the usergrid-portal.tar file into directory that serves as the root directory of your web pages.

Once you have done that there is one more step. You need to configure the portal so that it can find the Usergrid stack. You do that by editing the portal/config.js and changing this line:

Usergrid.overrideUrl = ’http://localhost:8080/‘;

To set the hostname that you will be using for your Usergrid installation.

I have deployed a sample instance and tested the same. You can find the system ready configurations in TechUtils repository

Unirest: Lightweight HTTP Request Client Libraries

UniRest

Unirest is a set of lightweight HTTP libraries available in multiple languages, built and maintained by the Mashape team.

Unirest.post("http://httpbin.org/post")
  .queryString("name", "Mark")
  .field("last", "Polo")
  .asJson()

Features

  • Make GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS requests
  • Both syncronous and asynchronous (non-blocking) requests
  • It supports form parameters, file uploads and custom body entities
  • Easily add route parameters without ugly string concatenations
  • Supports gzip
  • Supports Basic Authentication natively
  • Customizable timeout, concurrency levels and proxy settings
  • Customizable default headers for every request (DRY)
  • Customizable HttpClient and HttpAsyncClient implementation
  • Automatic JSON parsing into a native object for JSON responses
  • Customizable binding, with mapping from response body to java Object

Installing

Is easy as pie. Kidding. It’s about as easy as doing these little steps:

With Maven

You can use Maven by including the library:

<dependency>
    <groupId>com.mashape.unirest</groupId>
    <artifactId>unirest-java</artifactId>
    <version>1.4.7</version>
</dependency>

There are dependencies for Unirest-Java, these should be already installed, and they are as follows:

<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpclient</artifactId>
  <version>4.3.6</version>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpasyncclient</artifactId>
  <version>4.0.2</version>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpmime</artifactId>
  <version>4.3.6</version>
</dependency>
<dependency>
  <groupId>org.json</groupId>
  <artifactId>json</artifactId>
  <version>20140107</version>
</dependency>

If you would like to run tests, also add the following dependency along with the others:

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>commons-io</groupId>
  <artifactId>commons-io</artifactId>
  <version>2.4</version>
  <scope>test</scope>
</dependency>

Without Maven

Alternatively if you don’t use Maven, you can directly include the JAR file in the classpath:http://oss.sonatype.org/content/repositories/releases/com/mashape/unirest/unirest-java/1.4.7/unirest-java-1.4.7.jar

Don’t forget to also install the dependencies (org.json, httpclient 4.3.6, httpmime 4.3.6,httpasyncclient 4.0.2) in the classpath too.

There is also a way to generate a Unirest-Java JAR file that already includes the required dependencies, but you will need Maven to generate it. Follow the instructions at http://blog.mashape.com/post/69117323931/installing-unirest-java-with-the-maven-assembly-plugin

Creating Request

So you’re probably wondering how using Unirest makes creating requests in Java easier, here is a basic POST request that will explain everything:

HttpResponse<JsonNode> jsonResponse = Unirest.post("http://httpbin.org/post")
  .header("accept", "application/json")
  .queryString("apiKey", "123")
  .field("parameter", "value")
  .field("foo", "bar")
  .asJson();

Requests are made when as[Type]() is invoked, possible types include Json, Binary, String, Object.

If the request supports and it is of type HttpRequestWithBody, a body it can be passed along with.body(String|JsonNode|Object). For using .body(Object) some pre-configuration is needed (see below).

If you already have a map of parameters or do not wish to use seperate field methods for each one there is a.fields(Map<String, Object> fields) method that will serialize each key – value to form parameters on your request.

.headers(Map<String, String> headers) is also supported in replacement of multiple header methods.

Full Documentation @ unirest.io