Mark Veenstra
Mark Veenstra

Reputation: 4739

Howto add a connector to rest-service-component

In my Mule 2.X configuration I need to post a message as a URL parameter. Therefore I created a service that has an inbound and then tries to send the message using rest-service-component, as follows:

<service name="myService">
    <inbound>
        <vm:inbound-endpoint path="path/inbound" synchronous="true" connector-ref="myVmConnector"/>
    </inbound>
    <http:rest-service-component serviceUrl="http://www.domain.com/path/insert.asp" httpMethod="POST">
        <http:payloadParameterName value="data_xml"/>
    </http:rest-service-component>
</service>

But when I process a message through it I receive the following information:

Message               : There are at least 2 connectors matching protocol "http", so the connector to use must be specified on the endpoint using the 'connector' property/attribute (java.lang.IllegalStateException)
Type                  : org.mule.transport.service.TransportFactoryException
Code                  : MULE_ERROR--2
http://www.mulesource.org/docs/site/current2/apidocs/org/mule/transport/service/TransportFactoryException.html

Normally this error can occur when you have multiple HTTP connectors configured and then you need to specify the connector on the endpoint (connector-ref). But the rest-service-component does not have such an attribute or child elements (http://www.mulesoft.org/documentation-3.2/display/MULE2USER/HTTP+Transport)

Upvotes: 0

Views: 511

Answers (1)

Anton Kupias
Anton Kupias

Reputation: 4015

This is a very old bug that remained unresolved:

https://www.mulesoft.org/jira/browse/MULE-4272

Try to use http:outbound-endpoint instead.

UPDATE:

Try using a Groovy script component in place of the rest component to create calls to dynamic URLs in Mule 2. Something like this might work:

eventContext.sendEvent(message,"http://www.domain.com/path/insert.asp?data_xml=${payload}")

Depending on your payload, you may also have to URL encode that.

Upvotes: 1

Related Questions