Repository: wso2/micro-integrator
Issue: Issues in Management APIs

**Description:**
1. The transport values in data-services are missing GET data-services from the management api.
2. The sequence name is missing in response form GET sequence from the management api
3. If there is a de-active proxy service, an AxisFault is thrown when retrieving data-services
4. Missing fields such as default values in endpoint configurations

**Suggested Labels:**
<!-- Optional comma separated list of suggested labels. Non committers can’t assign labels to issues, so this will help issue creators who are not a committer to suggest possible labels-->

**Suggested Assignees:**
<!--Optional comma separated list of suggested team members who should attend the issue. Non committers can’t assign issues to assignees, so this will help issue creators who are not a committer to suggest possible assignees-->

**Affected Product Version:**

**OS, DB, other environment details and versions:**    

**Steps to reproduce:**

**Data-services**

1. Deploy a data service with transports.
`<data name="Accout_dataservice" serviceNamespace="http://ws.wso2.org/dataservice" serviceGroup="" transports="http https local">`

2. The values for transport property is getting missed at the response of the Management API as below.
`<data name=\\"Accout_dataservice\\" serviceNamespace=\\"http://ws.wso2.org/dataservice\\" description=\\"\\" enableBatchRequests=\\"false\\" enableBoxcarring=\\"false\\" disableLegacyBoxcarringMode=\\"false\\" transports=\\"\\">`

3. Deploy a proxy and deactivate the proxy service. (You can use MI dashboard). An AxisFault is thrown when retrieving data-services.

**Sequences**

1. Create a sequnces and deploy.
2. Invoke the get sequence request using the management api. The name of the sequence is missing in the configuration.

**Related Issues:**
<!-- Any related issues such as sub tasks, issues reported in other repositories (e.g component repositories), similar problems, etc. -->

Changed files:
components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DataServiceFactory.java
components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DBUtils.java
components/org.wso2.micro.integrator.extensions/org.wso2.micro.integrator.management.apis/src/main/java/org/wso2/micro/integrator/management/apis/SequenceResource.java

diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DBUtils.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DBUtils.java
index a214dc1c8..3982a7ed6 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DBUtils.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DBUtils.java
@@ -439,11 +439,20 @@ public class DBUtils {
         Map<String, AxisService> map = axisConfiguration.getServices();
         Set<String> set = map.keySet();
         for (String serviceName : set) {
-            AxisService axisService = axisConfiguration.getService(serviceName);
-            Parameter parameter = axisService.getParameter(DBConstants.AXIS2_SERVICE_TYPE);
-            if (parameter != null) {
-                if (DBConstants.DB_SERVICE_TYPE.equals(parameter.getValue().toString())) {
-                    serviceList.add(serviceName);
+            try {
+                AxisService axisService = axisConfiguration.getService(serviceName);
+                Parameter parameter = axisService.getParameter(DBConstants.AXIS2_SERVICE_TYPE);
+                if (parameter != null) {
+                    if (DBConstants.DB_SERVICE_TYPE.equals(parameter.getValue().toString())) {
+                        serviceList.add(serviceName);
+                    }
+                }
+            } catch (AxisFault axisFault) {
+                if (axisFault.getMessage().contains("inactive")) {
+                    log.debug("Ignoring axisFault due to inactive service.");
+                } else {
+                    log.error("Error occurred while populating service " + serviceName + " : "
+                              + axisFault.getMessage(), axisFault);
                 }
             }
         }
diff --git a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DataServiceFactory.java b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DataServiceFactory.java
index 429848a2d..d232ff1dd 100644
--- a/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DataServiceFactory.java
+++ b/components/data/data-services/org.wso2.micro.integrator.dataservices.core/src/main/java/org/wso2/micro/integrator/dataservices/core/DataServiceFactory.java
@@ -41,6 +41,7 @@ import org.wso2.securevault.SecurityConstants;
 
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -146,6 +147,13 @@ public class DataServiceFactory {
             /* set disable legacy boxcarring mode */
             dataService.setDisableLegacyBoxcarringMode(disableLegacyBoxcarringMode);
 
+            /* set transports */
+            String transports = dbsElement.getAttributeValue(new QName(DBSFields.TRANSPORTS));
+            if (transports != null && !transports.isEmpty()) {
+                List<String> transportsList = Arrays.asList(transports.split("\\\\s"));
+                dataService.setTransports(transportsList);
+            }
+
             /* add the password manager */
             Iterator<OMElement> passwordMngrItr = dbsElement.getChildrenWithName(
                     new QName(SecurityConstants.PASSWORD_MANAGER_SIMPLE));
diff --git a/components/org.wso2.micro.integrator.extensions/org.wso2.micro.integrator.management.apis/src/main/java/org/wso2/micro/integrator/management/apis/SequenceResource.java b/components/org.wso2.micro.integrator.extensions/org.wso2.micro.integrator.management.apis/src/main/java/org/wso2/micro/integrator/management/apis/SequenceResource.java
index 9d7547ba8..1b018bd70 100644
--- a/components/org.wso2.micro.integrator.extensions/org.wso2.micro.integrator.management.apis/src/main/java/org/wso2/micro/integrator/management/apis/SequenceResource.java
+++ b/components/org.wso2.micro.integrator.extensions/org.wso2.micro.integrator.management.apis/src/main/java/org/wso2/micro/integrator/management/apis/SequenceResource.java
@@ -175,7 +175,7 @@ public class SequenceResource extends APIResource {
         }
         sequenceObject.put("mediators", mediatorTypes);
         sequenceObject.put(Constants.SYNAPSE_CONFIGURATION,
-                new SequenceMediatorSerializer().serializeAnonymousSequence(null, sequenceMediator));
+                new SequenceMediatorSerializer().serializeSpecificMediator(sequenceMediator));
 
         return sequenceObject;
     }