I need to migrate a http NoSessionConnector defined in mule 3.3.1 in this way:
<http:connector name="NoSessionConnector">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:connector>
to the new http:listener-config but I cannot put service-overrides inside http:listener-config tag nor inside http:listener tag. Both configurations are not permitted:
<http:listener-config name="httpListener" host="localhost">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:listener-config>
<http:listener config-ref="httpListener" path="/ecommerce/*">
<service-overrides sessionHandler="org.mule.session.NullSessionHandler" />
</http:listener>
is there a way to configure a custom sessionHandler in mule 3.7.0? I need it to avoid a OptionalDataException as described on this stackoverflow
If the problem is the message property "MULE_SESSION" that is past as HTTP header, then you can try removing it from the outbound scope of the message in order to avoid sending "MULE_SESSION" as HTTP header. You can do it by using the "message-property-transformer" element:
<message-properties-transformer scope="outbound">
<delete-message-property key="MULE_SESSION" />
</message-properties-transformer>
Remember that you have to place it before the SOAP call in the flow.
Related
I am using mule API gateway , I have deployed my package in it. But in API gateway that
org.mule.module.launcher.DeploymentInitException: SAXParseException: Premature end of file.
I have tried in version 1.3.0 and 3.8.0. In both I got same error.
Please help me.
File :
<http:connector name="httpConnector" />
<esper:config name="esperModule" configuration="esper-config.xml" />
<mxml:dom-to-xml-transformer name="domToXmlTransformer" />
<flow name="websocket-esper-bridge">
<http:inbound-endpoint address="niohttp://localhost:8080/websocket/events"
exchange-pattern="one-way">
<http:websocket path="events" />
</http:inbound-endpoint>
<custom-processor
class="com.mulesoft.demo.mule.websocket.EsperWebSocketUpdateListener">
<spring:property name="esperModule" ref="esperModule" />
<spring:property name="httpConnector" ref="httpConnector" />
<spring:property name="domToXmlTransformer" ref="domToXmlTransformer" />
</custom-processor>
</flow>
<flow name="signupEventsGenerator">
<poll frequency="3000">
<set-payload value="<signup id='fake' />"/>
</poll>
<mxml:xml-to-dom-transformer returnClass="org.w3c.dom.Document" />
<esper:send eventName="SignupEvent" eventPayload-ref="#[message.payload]" />
</flow>
This is a current known issue with 3.8.0. The error is not very descriptive but it means you are missing a schema declaration for a component. Could you post the entire XML file contents? It's probably one you're using, like http, esper, mxml.
HTH
I'm new to Mule ESB.
I have the following config file for Mule which was taken from the Spell Checker tutorial:
<file:connector name="FILE" streaming="false" doc:name="File" autoDelete="true" validateConnections="false"/>
<flow name="SpellCheckerFlow1" doc:name="SpellCheckerFlow1">
<file:inbound-endpoint connector-ref="FILE" path=".\xmlIn" pollingFrequency="3000" responseTimeout="10000" doc:name="Incoming File" moveToDirectory=".\xmlProcessed"/>
<http:outbound-endpoint exchange-pattern="request-response" host="www.google.com/tbproxy/spell?lang=en" port="80" doc:name="Invoke API"/>
<echo-component doc:name="Echo"/>
<file:outbound-endpoint path=".\xmlOut" outputPattern="#[function:datestamp:dd-MM-yy]_#[function:systime].xml" responseTimeout="10000" doc:name="File"/>
</flow>
I'm trying to extend the FunctionalTestCase class and test this flow. Below is the extracted code I'm using to do that:
MuleClient client = new MuleClient(muleContext);
client.dispatch("file://./xmlIn", "<valid_xml />", null);
MuleMessage message = client.request("file://./xmlOut", 1000000000);
When I execute this code it creates a data file in the /xmlIn folder. The rest of the flow does not get executed. The flow should poll on this folder to pick up the file.
Thanks in advance!
The time-out parameter is ineffective when requesting from a file endpoint: Mule is not going to wait for the file to appear.
This means that your test doesn't block and always fails. The easiest/less refined way to solve the issue is to loop on a { Thread.wait(); client.request(); } until you get a non-null message, ie until the file in xmlOut has been read.
No need to add a retry counter: Mule's FunctionalTestCase will automatically fail the test after getTestTimeoutSecs() has elapsed (60 seconds by default).
Side notes:
To make your config work in my environment, I had to replace the .\ with ./ in the file paths of the XML config.
The outbound HTTP endpoint is mis-configured: the path is mixed in the host, use instead:
<http:outbound-endpoint exchange-pattern="request-response"
host="www.google.com" path="tbproxy/spell?lang=en" port="80"
doc:name="Invoke API" />
It's slightly more efficient to get the Mule client this way:
MuleClient muleClient = muleContext.getClient();
I have a Mule flow, with a custom interceptor, which constructs an Object and forwards it to a JMS outboud endpoint. The JMS endpoint throws an exception trying to convert the Object to a JMS StreamMessage. What I want is for the endpoint to convert the Object to a JMS ObjectMessage, instead. How would that be done?
here's my flow;
<spring:beans>
<spring:bean id="connectionFactoryFactory" name="connectionFactoryFactory"
class="ConnectionFactoryFactory">
<spring:property name="properties">
<spring:props>
<spring:prop key="imqAddressList">mqtcp://localhost:30001/jms</spring:prop>
<spring:prop key="imqReconnectAttempts">-1</spring:prop>
</spring:props>
</spring:property>
</spring:bean>
<spring:bean id="connectionFactory" name="connectionFactory"
factory-bean="connectionFactoryFactory" factory-method="createConnectionFactory" />
</spring:beans>
<jms:connector name="JMSConnector" connectionFactory-ref="connectionFactory"
specification="1.1" doc:name="JMS" />
<flow name="Request" doc:name="Request">
<quartz:inbound-endpoint responseTimeout="10000"
doc:name="InfoRequest" jobName="InfoRequest" repeatInterval="5000">
<quartz:event-generator-job />
</quartz:inbound-endpoint>
<custom-interceptor class="StateRequest"/>
<jms:outbound-endpoint connector-ref="JMSConnector"
doc:name="JMS" topic="requests"/>
</flow>
I have also tried adding an Object to JMS Message Transformer;
<jms:object-to-jmsmessage-transformer returnClass="javax.jms.ObjectMessage" name="Object_to_JmsMessage" doc:name="Object to JmsMessage"/>
<jms:outbound-endpoint connector-ref="JMSConnector"
doc:name="JMS" topic="requests" transformer-refs="Object_to_JmsMessage"/>
Because Request extends LinkedList<RequestId> implements Serializable, Mule will automatically convert this type to a StreamMessage.
Unfortunately this behavior is in a static class so it's hard to swap with another one. Either create your own JMS ObjectMessage from code or subclass AbstractJmsTransformer to create your own flavor of ObjectToJMSMessage that would call JmsMessageUtils.serializableToMessage for payloads of type Request.
I'm using mule 3.2.0 and
I'm invoking muleclient.send method in java-class which sends soap-request to a mule flow(not present here), which sends it to the http endpoint which receives request, logs it to my db with proxy pattern and propagates it to "ServiceFlow" which has Dispatcher transformer - java class, which uses invocation of MuleClient.send(String url, Object payload, Map messageProperties) method to dispatch one object of the payload array to an endpoint.
Then it gets processed by cxf:jax-ws-client, logged to a db once again and transferred to another instance of Dispatcher (where incoming payload is again of type Object[]). There I have http endpoint which does the service invocation. This part works okay.
But trouble appears at the receiving of the response. I've put Test1(2,3,4) transformers to print the invocation chain in my flows (They just do the System.out.println()), and saw that they're invoked in a weird sequence: I have it like 1,3 then TestTransformer (which is also the sysouter) then I get the error "NullPayload" in the caller of the main flow "Service flow" and then I receive the Test 4 and Test 2 outs. The responseTransformer-refs in patterns "1Proxy" are ignored, so as in "ServiceProxy". I've been looking for the solution for like a week now, and can't find it. In debugging, I can see that transformer called "TestTransformer" in has expected payload (Object[]) but when I receive it in my class caller, it appears as "NullPayload". I can see now that one of my endpoints has the path element instead of ref, not sure if this cause any impact on flow, but will check it. Also tried to use the "response" block to ensure my flow runs as expected. Any suggestions appreciated. Thanks
Here is what my config looks like:
<http:endpoint name="httpService" address="${service.soap}" exchange-pattern="request-response" responseTimeout="${timeout}" />
<vm:endpoint name="vmService" path="vmService" exchange-pattern="request-response"/>
<pattern:web-service-proxy
name="ServiceProxy"
inboundEndpoint-ref="httpService"
transformer-refs="to-string logging"
responseTransformer-refs="to-string logging"
outboundEndpoint-ref="vmService" />
<flow name="ServiceFlow" >
<inbound-endpoint ref="vmService"/>
<cxf:jaxws-service serviceClass="pkg.ServiceImpl" wsdlLocation="${service.wsdl}" enableMuleSoapHeaders="false" validationEnabled="true"/>
<custom-transformer class="pkg.Dispatcher">
<spring:property name="vmFlowPath" value="vm.logService"/>
</custom-transformer>
<custom-transformer name="TestTransformer" class="pkg.TestTransformer"/>
</flow>
<vm:endpoint name="vm1In" path="vm1In" exchange-pattern="request-response"/>
<vm:endpoint name="vm1Out" path="vm1Out" exchange-pattern="request-response"/>
<custom-transformer name="arrayGenerator" class="pkg.ArrayGenerator"/>
<custom-transformer name="objectExtractor" class="pkg.ObjectExtractor"/>
<custom-transformer name="faultChecker" class="pkg.FaultChecker"/>
<custom-transformer name="objectLogging" class="pkg.ObjectLogger">
<pattern:web-service-proxy
name="1Proxy"
inboundEndpoint-ref="vm1In"
transformer-refs="arrayGenerator objectLogging"
responseTransformer-refs="objectLogging objectExtractor faultChecker"
outboundEndpoint-ref="vm1Out" />
<flow name="logService">
<vm:inbound-endpoint path="vm.logService exchange-pattern="request-response"/>
<custom-transformer class="Test1"/>
<vm:outbound-endpoint ref="vm1In">
<cxf:jaxws-client
serviceClass="pkg.ServiceImpl"
operation="import"
enableMuleSoapHeaders="false"/>
<object-to-string-transformer/>
</vm:outbound-endpoint>
<object-to-xml-transformer>
<xm:xml-to-object-transformer returnClass="pkg.WSResponseClass"/>
<custom-transformer class="Test2"/>
</flow>
<flow name="DispatcherToServiceFlow">
<custom-transformer class="Test3"/>
<vm:inbound-endpoint path="vm1.Out"/>
<custom-transformer class="pkg.Dispatcher">
<spring:property name="vmFlowPath" value="vm.import"/>
</custom-transformer>
</flow>
<flow name="import">
<vm:inbound-endpoint path="vm.import" exchange-pattern="request-response"/>
<http:outbound-endpoint address="${importService}" responseTimeout="${timeout}" exchange-pattern="request-response" />
<object-to-string-transformer/>
<custom-transformer class="Test4"/>
</flow>
well, my problem really was the "path" element instead of referring to an existing vm endpoint with "ref" element like
<inbound-endpoint ref="vm1Out"/>
I am relatively new to mule and trying to define a mule flow which takes request XML via soap-based Web service. The XML is based on a complex schema and I have generated classes using WSDL2Java
After receiving the request cxf:jaxws-service executes the method submitOrder(SubmitOrderRequest parameters). After this method's execution I would like to transform the request XML to a little bit different format. Then this XML needs to be forwarded to another web service. The problem is that the mule message that comes out of ServiceImpl contains SubmitOrderResponse whereas I still want to work on SubmitOrderRequest.
<flow name="testService">
<http:inbound-endpoint address="http://localhost:62005/test"
exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.test.ServicePortType" />
</http:inbound-endpoint>
<component class="com.test.ServiceImpl" />
<!-- transformer ref="MVIRequestTransformer" / -->
<!-- xm:object-to-xml-transformer / -->
<!-- logger message="XML payload is #[payload]" level="INFO" / -->
<!-- SEND TRASNFORMED MESSAGE TO ANOTHER SERVICE -->
</flow>
#WebService(endpointInterface = "com.pennmutual.services.mvi.MVIServicePort")
public class ServiceImpl implements ServicePortType {
...
#Override
public SubmitOrderResponse submitOrder(SubmitOrderRequest parameters) {
...
}
...
}
What are my options are. I can think of the following –
1. Put the request object somewhere in the context and retreive it later on for processing.
2. Change the return type of submitOrder to Object and return SubmitOrderRequest instead of SubmitOrderResponse.
Please suggest the best possible way to handle this situation. I am using mule 3.2.
I think there are two elegant way to do that (excluding the one that involves changing the webservice interface)
Store the request into a session variable and restore it afterwards.
Here is how your flow would look like:
<flow name="testService">
<http:inbound-endpoint address="http://localhost:62005/test" exchange-pattern="request-response">
<cxf:jaxws-service serviceClass="com.test.ServicePortType" />
</http:inbound-endpoint>
<message-properties-transformer scope="session">
<add-message-property value="payload" key="originalPayload" />
</message-properties-transformer>
<component class="com.test.ServiceImpl" />
</flow>
Use the enricher around the component to store the returned value into a variable so that it won't become the payload of your flow. Following an example of how to achieve this
<flow name="Echo" doc:name="Echo">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="6090" path="echo" encoding="UTF-8" />
<cxf:jaxws-service serviceClass="org.mule.example.echo.Echo" />
<enricher target="#[variable:echo]">
<component class="org.mule.example.echo.Echo" />
</enricher>
<logger level="ERROR" message="#[variable:echo]"/>
</flow>
You can find more informations on the enricher here