Restful service call through mule multiple inbound methods one Service

View: New views
1 Messages — Rating Filter:   Alert me  

Restful service call through mule multiple inbound methods one Service

by Gerwin Postma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to access two different methods on a Restful service using http:inbound-enpoints. I am getting an error when I try to use more than one endpoint.  The config file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:spring="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns="http://www.mulesource.org/schema/mule/core/2.2"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:jersey="http://www.mulesource.org/schema/mule/jersey/2.2"
       xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.2"
       xmlns:vm="http://www.mulesource.org/schema/mule/vm/2.2"
       xmlns:http="http://www.mulesource.org/schema/mule/http/2.2"
       xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.2"
       xsi:schemaLocation="
               http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
               http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd
               http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
               http://www.mulesource.org/schema/mule/jersey/2.2 http://www.mulesource.org/schema/mule/jersey/2.2/mule-jersey.xsd
               http://www.mulesource.org/schema/mule/stdio/2.2 http://www.mulesource.org/schema/mule/stdio/2.2/mule-stdio.xsd
               http://www.mulesource.org/schema/mule/vm/2.2 http://www.mulesource.org/schema/mule/vm/2.2/mule-vm.xsd
               http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd
                http://www.mulesource.org/schema/mule/xml/2.2 http://www.mulesource.org/schema/mule/xml/2.2/mule-xml.xsd">

        <spring:beans>
                <spring:import resource="classpath:remittance-applicationContext.xml" />
        </spring:beans>
       
       
        <xm:object-to-xml-transformer name="ObjectToXml"/>
        <custom-transformer name="HttpParamToGetCreditBodTransformer" class="com.lifeway.easervices.remittance.transformers.HttpParamToGetCreditBodTransformer" />
       
        <model name="RemittanceRequest">
       
                <service name="Remittance">
                        <inbound>
                <http:inbound-endpoint address="http://localhost:65094?method=getCreditMemos" method="GET" transformer-refs="HttpParamToGetCreditBodTransformer" responseTransformer-refs="ObjectToXml" synchronous="true"/>
                <http:inbound-endpoint address="http://localhost:65094?method=getPayments" method="GET"  transformer-refs="HttpParamToGetCreditBodTransformer" responseTransformer-refs="ObjectToXml" synchronous="true"/>
              </inbound>
              <component>      
              <spring-object bean="remittanceService" />
              </component>
                </service>
        </model>
</mule>

There are multiple examples of using multiple inbound endpoints, but they are always showing two separate types.  The error I get is below.  If anyone knows the configuration I need to make this work I would appreciate an example.



org.mule.api.lifecycle.LifecycleException: Failed to invoke lifecycle phase "start" on object: SedaService{Remittance}
        at org.mule.lifecycle.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:277)
        at org.mule.lifecycle.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:129)
        at org.mule.lifecycle.GenericLifecycleManager.firePhase(GenericLifecycleManager.java:84)
        at org.mule.DefaultMuleContext.start(DefaultMuleContext.java:170)
        at org.mule.tck.AbstractMuleTestCase.setUp(AbstractMuleTestCase.java:382)
        at junit.framework.TestCase.runBare(TestCase.java:132)
        at org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:255)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:124)
        at org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:235)
        at junit.framework.TestSuite.runTest(TestSuite.java:232)
        at junit.framework.TestSuite.run(TestSuite.java:227)
        at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.mule.api.transport.ConnectorException: There is already a listener registered on this connector on endpointUri: http://localhost:65094. Connector that caused exception is: HttpConnector{this=5527e404, started=true, initialised=true, name='connector.http.0', disposed=false, numberOfConcurrentTransactedReceivers=4, createMultipleTransactedReceivers=true, connected=true, supportedProtocols=[http], serviceOverrides=null}
        at org.mule.transport.AbstractConnector.registerListener(AbstractConnector.java:1120)
        at org.mule.transport.http.HttpConnector.registerListener(HttpConnector.java:203)
        at org.mule.service.AbstractService.registerListeners(AbstractService.java:593)
        at org.mule.service.AbstractService.start(AbstractService.java:316)
        at org.mule.service.AbstractService.start(AbstractService.java:293)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.mule.lifecycle.DefaultLifecyclePhase.applyLifecycle(DefaultLifecyclePhase.java:273)
        ... 20 more

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email