Write a Mock Service from WSO2ESB

1. Start ESB

2. Go to carbon console (https://localhost:9443/carbon)

3. Manage > APIs > Add API > switch to source view

4. Copy & Paste this code there

<api xmlns="http://ws.apache.org/ns/synapse" name="SimpleAPI" context="/simple">
   <resource methods="GET">
      <inSequence>
         <payloadFactory media-type="xml">
            <format>
               <Response xmlns="">
                  <status>OK</status>
                  <code>1</code>
               </Response>
            </format>
            <args/>
         </payloadFactory>
         <respond/>
      </inSequence>
   </resource>
</api>

5. Now run it from postman

 GET http://10.10.12.59:8280/simple

 Response

 <Response>
    <status>OK</status>
    <code>1</code>

</Response>


=============================================================
If you want to write proxy service user this code
(Manage > services > Add proxy service > Custom proxy > switch to source view)

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="MyMockProxy"
       startOnLoad="true"
       statistics="disable"
       trace="disable"
       transports="http,https">
   <target>
      <inSequence>
         <payloadFactory media-type="xml">
            <format>
               <Response xmlns="">
                  <status>OK</status>
                  <code>1</code>
               </Response>
            </format>
            <args/>
         </payloadFactory>
         <header action="remove" name="To"/>
         <property name="RESPONSE" scope="default" type="STRING" value="true"/>
         <property action="remove" name="NO_ENTITY_BODY" scope="axis2"/>
         <send/>
      </inSequence>
   </target>
   <description/>
</proxy>

Convert to OSGI & FEATURE (example workflow-core)

1. Change pom.xml in relevant project

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.wso2telco.dep</groupId>
<artifactId>component-dep</artifactId>
   <version>2.3.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>workflow-core</artifactId>
<packaging>bundle</packaging>
<name>WSO2.Telco Workflow Core Module</name>
<description>WSO2.Telco - Workflow module</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<version>1.7.2</version>
<executions>
<execution>
<id>generate-scr-scrdescriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.3.5</version>
<configuration>
<obrRepository>NONE</obrRepository>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Private-Package/>
<Export-Package>
org.workflow.*
</Export-Package>
<Import-Package>
*;resolution:=optional
</Import-Package>
<Embed-Dependency>
scribe;scope=compile|runtime;inline=false;
</Embed-Dependency>
<DynamicImport-Package>*</DynamicImport-Package>
<Carbon-Component>UIBundle</Carbon-Component>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

2. Create feature folder in component-dep like this 
com.wso2telco.dep.workflow-core.feature

3. Add pom.xml and add these contents


<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/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>com.wso2telco.dep</groupId>
        <artifactId>component-dep-feature</artifactId>
        <version>2.3.2-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>


    <artifactId>com.wso2telco.dep.workflow.core.feature</artifactId>
    <packaging>pom</packaging>
    <name>WSO2.Telco Workflow Core Service</name>
    <description>This feature contains the server bundles required for workflow core service</description>

    <build>
        <plugins>
            <plugin>
                <groupId>org.wso2.maven</groupId>
                <artifactId>carbon-p2-plugin</artifactId>
                <version>${carbon.p2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>p2-feature-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-feature-gen</goal>
                        </goals>
                        <configuration>
                            <id>com.wso2telco.dep.workflow.core</id>
                            <propertiesFile>../feature.properties</propertiesFile>
                            <adviceFile>
                                <properties>
                                    <propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
                                    <propertyDef>org.eclipse.equinox.p2.type.group:true</propertyDef>
                                </properties>
                            </adviceFile>
                            <bundles>
                                <bundleDef>com.wso2telco.dep:workflow-core:${com.wso2telco.dep.version}</bundleDef>
                            </bundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

4. Change product-hub\modules\p2-profile\product\pom.xml

<featureArtifactDef>
com.wso2telco.dep:com.wso2telco.dep.workflow.core.feature:${com.wso2telco.dep.version}
</featureArtifactDef>

<feature>
<id>com.wso2telco.dep.workflow.core.feature.group</id>
<version>${com.wso2telco.dep.version}</version>
</feature>
//7 places

5. Change component-dep\pom.xml 


<module>components/workflow-core</module>

6. Change component-dep\features\pom.xml

<module>com.wso2telco.dep.workflow.core.feature</module>


Verify product-hub dep & core versions and core-util/component-dep versions..