Mule 3 で GET 要求に応答するエンドポイントを作成しようとしています (正しい言葉だと思いますか?)。この Mule アプリケーションは、Web コンテナ内の JavaEE Web アプリケーション内で実行されます。
私の web.xml では、MuleRESTReceiverServlet
URL が「/rest/」で始まるすべてのリクエストを処理するように定義されたサーブレットがあります。
<web-app>
<listener>
<listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
</listener>
<servlet>
<servlet-name>muleRESTServlet</servlet-name>
<servlet-class>org.mule.transport.servlet.MuleRESTReceiverServlet</servlet-class>
<load-on-startup />
</servlet>
<servlet-mapping>
<servlet-name>muleRESTServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
私<flow>
はこのように見えます:
<flow name="myFlow">
<servlet:inbound-endpoint path="category/service" />
<component>
<singleton-object class="com.company.MyComponent" />
</component>
<outbound-endpoint ... />
</flow>
「http://localhost:8080/webappName/rest/category/service」に GET リクエストを送信すると、com.company.MyComponent
クラスが呼び出されることを期待しています。しかし、代わりに、次のエラーが表示されます。
org.mule.api.endpoint.MalformedEndpointException: The endpoint "service" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead.
エラーメッセージが示唆しているように、インバウンドエンドポイントをグローバルエンドポイントとして定義しようとしましたが、同じエラーが返されます。
<servlet:endpoint name="myEndpoint" path="category/service" />
...
<flow name="myFlow">
<inbound-endpoint ref="myEndpoint" />
<component>
<singleton-object class="com.company.MyComponent" />
</component>
<outbound-endpoint ... />
</flow>
また、「path」属性を「rest/category/service」および「/rest/category/service」に設定しようとしましたが、それでも同じエラー メッセージが表示されます。
私は何を間違っていますか?ありがとう。