Monday, December 2, 2019

sample GET method API(here getting details DS)

<api xmlns="http://ws.apache.org/ns/synapse" name="DataBase" context="/ds">
   <resource methods="GET" uri-template="/employee/{userId}">
      <inSequence>
         <property name="User Id" expression="get-property('uri.var.userId')" scope="default" type="STRING"/>
         <log level="custom">
            <property name="User Id" expression="get-property('User Id')"/>
         </log>
         <property name="ContentType" value="text/xml" scope="axis2" type="STRING"/>
         <property name="SOAPAction" value="urn:_getselect" scope="transport" type="STRING"/>
         <payloadFactory media-type="xml">
            <format>
               <p:select xmlns:p="http://ws.wso2.org/dataservice">
                  <xs:id xmlns:xs="http://ws.wso2.org/dataservice">$1</xs:id>
               </p:select>
            </format>
            <args>
               <arg xmlns:ds="http://ws.wso2.org/dataservice" evaluator="xml" expression="get-property('User Id')"/>
            </args>
         </payloadFactory>
         <log level="full" separator="," description="Request"/>
         <send>
            <endpoint key="DataServiceWsdl"/>
         </send>
      </inSequence>
      <outSequence>
         <respond/>
      </outSequence>
      <faultSequence/>
   </resource>
</api>
                        

No comments:

Post a Comment