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>