Mule custom connector Invalid content was found starting with element

682 views Asked by At

I have created Custom Connector named KoreAlert. I successfully installed it to the AnypointStudio. However, when I am using it in another flow, I got this exception. Can anyone resolve the issue.

Invalid content was found starting with element 'kore-alert:alert'. One of '{"http://www.mulesoft.org/schema/mule/core":abstract-message-processor, "http://www.mulesoft.org/schema/mule/core":abstract-outbound-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-message-processor, "http://www.mulesoft.org/schema/mule/core":response}' is expected.

EDIT: Here is my connector processor signature:

@Processor(friendlyName = "Kore Alert")
public void alert(@RestPostParam("alert") String alert) throws IOException {
        koreClient.postAlertInfo(alert);
}

Here is the mule app that uses the connector:

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

<mule xmlns:kore-alert="http://www.mulesoft.org/schema/mule/kore-alert" xmlns:http="http://www.mulesoft.org/schema/mule/http" 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" version="EE-3.6.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/kore-alert http://www.mulesoft.org/schema/mule/kore-alert/current/mule-kore-alert.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" doc:name="HTTP Listener Configuration"/>
    <kore-alert:config-type name="KoreAlert_Configuration" doc:name="KoreAlert: Configuration type strategy"/>
    <flow name="kore-alert-userFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/hello" doc:name="HTTP"/>
        <kore-alert:alert config-ref="KoreAlert_Configuration" alert="'{&quot;title&quot;:&quot;ssss&quot;,&quot;body&quot;:&quot;safdsadfsa&quot;}'" doc:name="KoreAlert"/>
    </flow>
</mule>
2

There are 2 answers

1
Charu Khurana On

Mule doesn't recognize the namespace kore-alert. Did you declare it on top?

0
Rondo On

I've just worked through my own version of this. It came as a result of modifying the code for the connector config I created (the new schema)....

In the end I did a thorough cleaning: removed and recreated (in the ui) all the existing related connector configs from the xml docs in the project the connector was added to. Cleaned both projects, built connector, updated and installed it, restarted AnyPoint Studio, built 'host' project and ran.

You can hold the alt (command on mac) key down and click one the schema definition to view in the schema designer, in order to see what version the app is using.