MuleSoft Integration connectivity problem

MuleSoft Integration connectivity problem

  

Hi all,

I've developed an RESTful API on mulesoft platform, which is deployed on premises, but as I'm trying to acess that API with outsystem, it shows as Unable To connect to remote server. Do any one have any Idea how to resolve it?

Regards,

Abhishek

You have to explain more if possible with code how and what are you trying to do

Filipe Lourenço wrote:

You have to explain more if possible with code how and what are you trying to do

Hi Filipe,

I'm having a Mule ESB flow, which answers to an Http Request, and operates CRUD on database linked to it. You may find the mule flow xml code below. The ESB flow is perfect and responding when requested through postman, problem arises when I'm trying to consume the same through OutSystems, it shows that Unable to Connect to remote server.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:json="http://www.mulesoft.org/schema/mule/json"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/ee/tracking ">http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
<http:listener-config name="HTTP_Listener_Configuration"
host="0.0.0.0" port="8081" basePath="/OutsystemsCRUD" doc:name="HTTP Listener Configuration" />
<db:mysql-config name="MySQL_Configuration" host="localhost"
port="3306" user="root" password="admin" database="outsystems"
doc:name="MySQL Configuration" />
<flow name="viewEmp">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/getEMP" allowedMethods="GET" doc:name="HTTP" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from emp;]]></db:parameterized-query>
</db:select>
<json:object-to-json-transformer
doc:name="Object to JSON" />
<logger message="Responding with employee details: #[payload]"
level="INFO" doc:name="Logger" />
<set-property propertyName="Content-Type" value="application/json"
doc:name="Property" />
</flow>
 <flow name="insertEmp">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/insertEmp" doc:name="HTTP" allowedMethods="POST" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<json:json-to-object-transformer
returnClass="java.util.HashMap" doc:name="JSON to Object" />
<db:insert config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[INSERT INTO Emp VALUES(#[payload.Emp_id], #[payload.Emp_First_Name], #[payload.Emp_Last_Name], #[payload.Sex], #[payload.Date_of_Birth], #[payload.Experience], #[payload.High_Quali], #[payload.Qualities], #[payload.Address_contact], #[payload.Permanent_Address], #[payload.Contact_Number], #[payload.Alternative_Contact], #[payload.Department], #[payload.Manager], #[payload.Project], #[payload.Date_Of_Joining], #[payload.Date_of_resignation], #[payload.Location], #[payload.Designation], #[payload.Feedback]);]]></db\:parameterized-query>
</db\:insert>
<set-payload
value="{"Status"\:"Employee Added Sucessfully"}"
doc:name="Set Payload" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<set-property propertyName="Content-Type" value="application/json"
doc:name="Property" />
</flow>
<flow name="viewEmpByID">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/getEMP/{ID}" allowedMethods="GET" doc:name="HTTP" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[select * from emp Where Emp_ID =#[message.inboundProperties.'http.uri.params'.ID];]]></db:parameterized-query>
</db:select>
<json:object-to-json-transformer
doc:name="Object to JSON" />
<logger message="Responding with employee details: #[payload]"
level="INFO" doc:name="Logger" />
<set-property propertyName="Content-Type" value="application/json"
doc:name="Property" />
</flow>
<!--<flow name="updateEmp">
<http:listener config-ref="HTTP_Listener_Configuration"
path="/updateEmp" allowedMethods="PUT" doc:name="HTTP" />
<logger message="#[message.inboundProperties.'http.query.params'.docid]"
level="INFO" doc:name="Logger" />
<json:object-to-json-transformer
doc:name="Object to JSON" />
<db:update config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[UPDATE Emp SET Qualities = #[payload.Qualities], Address_contact = #[payload.Address_contact], Contact_Number = #[payload.Contact_Number], Alternative_Contact = #[payload.Alternative_Contact], Department = #[payload.Department], Manager = #[payload.Manager], Project = #[payload.Project], Date_of_resignation = #[payload.Date_of_resignation], Location = #[payload.Location], Designation = #[payload.Designation], Feedback = #[payload.Feedback] WHERE Emp_id =#[payload.Emp_id]]]></db:parameterized-query>
</db:update>
<db:select config-ref="MySQL_Configuration" doc:name="Database">
<db:parameterized-query><![CDATA[Select * from emp;]]></db:parameterized-query>
</db:select>
<json:object-to-json-transformer
doc:name="Object to JSON" />
<logger message="#[payload]" level="INFO" doc:name="Logger" />
<set-property propertyName="Content-Type" value="application/json"
doc:name="Property" />
</flow> -->
</mule>