In the below Mule flow, i have to implement both connection pooling and XA transaction for JDBC connectivity. which datasource API supports both connection pooling and XA distributed transaction and how to implement it using spring beans and configure it to jdbc component?
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:core="http://www.mulesoft.org/schema/mule/core"
xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:jbossts="http://www.mulesoft.org/schema/mule/jbossts" xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" 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.4.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/jbossts http://www.mulesoft.org/schema/mule/jbossts/current/mule-jbossts.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
<!-- <jdbc-ee:mysql-data-source name="MySQL_REP_Data_Source" user="${rep.db.user}"
password="${rep.db.password}" url="${rep.db.url}" transactionIsolation="UNSPECIFIED"
doc:name="MySQL Data Source" /> -->
<spring:beans>
<spring:bean id="MySQL_Data_Source"
class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close"
name="Bean">
<spring:property name="driverClass" value="com.mysql.jdbc.Driver" />
<spring:property name="jdbcUrl" value="${rep.db.url}" />
<spring:property name="user" value="${rep.db.user}" />
<spring:property name="password" value="${rep.db.password}" />
<spring:property name="maxIdleTime" value="180" />
<spring:property name="minPoolSize" value="10" />
<spring:property name="acquireIncrement" value="-1" />
<spring:property name="maxPoolSize" value="100" />
</spring:bean>
</spring:beans>
<spring:beans>
<spring:bean id="MySQL_REP_Data_Source" name="MySQL_REP_Data_Source"
class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
<spring:property name="user" value="${rep.db.user}" />
<spring:property name="password" value="${rep.db.password}" />
<spring:property name="url" ref="${rep.db.url}" />
</spring:bean>
</spring:beans>
<jbossts:transaction-manager doc:name="Transaction Manager">
<property key="com.arjuna.ats.arjuna.coordinator.defaultTimeout"
value="${trans.default.timeout}" /> <!-- timeout in seconds -->
<property key="com.arjuna.ats.arjuna.coordinator.txReaperTimeout"
value="${trans.reaper.timeout}" /> <!-- timeout in milliseconds -->
</jbossts:transaction-manager>
<jdbc-ee:connector name="Reporting_Database"
dataSource-ref="MySQL_REP_Data_Source" validateConnections="true"
queryTimeout="-1" pollingFrequency="0" doc:name="Database">
<reconnect blocking="false" frequency="10000" count="3"></reconnect>
</jdbc-ee:connector>
<vm:connector name="VM_Connector" validateConnections="true"
doc:name="VM_Connector" createMultipleTransactedReceivers="true"
numberOfConcurrentTransactedReceivers="4">
</vm:connector>
<flow name="ApiKeyLoadImplFlow" doc:name="ApiKeyLoadImplFlow"
initialState="started">
<vm:inbound-endpoint exchange-pattern="request-response"
doc:name="Impl_ApiKeyLoad_Req" path="ImplApiKeyLoadReq"
connector-ref="VM_Connector" responseTimeout="${vm.response.timeout}">
<xa-transaction action="BEGIN_OR_JOIN" />
</vm:inbound-endpoint>
<logger message="Start of Api Key Load Implementation" level="DEBUG"
doc:name="ENTRY_LOG" />
<set-variable variableName="FlowData" value="#[payload]"
doc:name="FlowData" />
<set-variable variableName="#['UserId']" value="#[payload.getUserID()]"
doc:name="UserID" />
<choice doc:name="Choice">
<when expression="#[payload.getType().equalsIgnoreCase('incremental')]">
<choice doc:name="Choice">
<when expression="#[flowData.getAction().equalsIgnoreCase('update')]">
<flow-ref name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistsFlow" />
<choice doc:name="Choice">
<when expression="#[payload.size() == '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="InsertApiKeyFlow" doc:name="InsertApiKeyFlow" />
</when>
<when expression="#[payload.size() != '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="UpdateApiKeyFlow" doc:name="UpdateApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
</when>
<when expression="#[flowData.getAction().equalsIgnoreCase('delete')]">
<flow-ref name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistsFlow" />
<choice doc:name="Choice">
<when expression="#[payload.size() == '0']">
<set-payload value="#['DataNotFound']" doc:name="Data_Not_Found" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Data_Not_Found_Status" />
</when>
<when expression="#[payload.size() != '0']">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="DeleteApiKeyFlow" doc:name="DeleteApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
</when>
<otherwise>
<set-payload value="#['InvalidAction']" doc:name="Invalid_Action" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Invalid_Action_Status" />
</otherwise>
</choice>
</when>
<when expression="#[payload.getType().equalsIgnoreCase('full')]">
<set-payload doc:name="FlowData" value="#[variable:FlowData]" />
<flow-ref name="InsertApiKeyFlow" doc:name="InsertApiKeyFlow" />
</when>
<otherwise>
<set-payload value="#['Internal Server Error']"
doc:name="Internal_Server_Error" />
<logger message="Status for UserId #[flowVars.UserId] : #[payload]"
level="WARN" doc:name="Internal_Server_Status" />
</otherwise>
</choice>
<logger message="End of Api Key Load Implementation" level="DEBUG"
doc:name="EXIT_LOG" />
<catch-exception-strategy doc:name="Catch Exception Strategy">
<logger level="WARN" doc:name="Exception_Log"
message="Exception in ApiKeyLoadImplFlow #[System.getProperty('line.separator')] Error Description = #[exception.getMessage()]" />
</catch-exception-strategy>
</flow>
<sub-flow name="CheckApiKeyExistFlow" doc:name="CheckApiKeyExistFlow">
<logger message="Start of Check Api Key Implementation" level="DEBUG"
doc:name="START_LOG" />
<jdbc-ee:outbound-endpoint exchange-pattern="request-response"
queryKey="checkdata" queryTimeout="-1" connector-ref="Reporting_Database"
doc:name="Check_Value_Exists">
<xa-transaction action="JOIN_IF_POSSIBLE" />
<jdbc-ee:query key="checkdata"
value="${ftp.db.t_bmrs_api_keys.checkdata.query}" />
</jdbc-ee:outbound-endpoint>
<logger message="End of Check Api Key Exists Implementation"
level="DEBUG" doc:name="EXIT_LOG" />
</sub-flow>
</mule>
You need to have a javax.sql.XADataSource that implements connection pooling. You will usually need a JDBC driver specific data source for this, because supporting XA (distributed transactions) requires close coordination with how the database system implements two-phase commit.
Note that contrary to what the name suggests, a javax.sql.ConnectionPoolDataSource should not provide connection pooling, it is a data source for a connection pool.
Related
I have a java code formatter xml file:
<code_scheme name="zhc" version="17">
<option name="RIGHT_MARGIN" value="120" />
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="com" withSubpackages="true" static="false" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="org" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</code_scheme>
But when I choose Code->Optimize Imports after I imorted this formatter file under Preference->Code Style->Java, It just doesn't work as the sequence written above.
Does anybody happen to know what's the problem here?
I have a list which I want to process in paraller, so after calling collection-splitter, I post each record to an outbound-endpoint, but the receiving inbound-endpoint is not been triggered.
Configuration below;
<flow name="ProcessPolledOrders" doc:name="ProcessPolledOrders">
<set-session-variable variableName="fileName" value="#[message.payload.orderBatch.orderSourceName]" />
<set-session-variable variableName="batchId" value="#[message.payload.orderBatch.id]" />
<logger message="************* Item: #[sessionVars.fileName] processing resumed. ***********" level="INFO"/>
<component>
<spring-object bean="PolledOrderSplitter"/>
</component>
<set-session-variable variableName="size" value="#[message.payload.size()"/>
<collection-splitter/>
<set-property propertyName="MULE_CORRELATION_GROUP_SIZE" value="#[sessionVars.size]" />
<set-property propertyName="MULE_CORRELATION_ID" value="#[sessionVars.fileName]" />
<choice>
<when>
<payload-type-filter expectedType="model.Order"/>
<vm:outbound-endpoint exchange-pattern="one-way" path="step2" doc:name="VM"/>
</when>
<otherwise>
<echo-component/>
</otherwise>
</choice>
</flow>
<flow name="PollerOrderProcessingFlow" doc:name="PollerOrderProcessingFlow">
<vm:inbound-endpoint exchange-pattern="one-way" path="step2" doc:name="VM"/>
<logger message="***************** Validating order with id #[message.payload.id] ********************"
level="INFO"/>
<component>
<spring-object bean="PolledOrderValidationComponent"/>
</component>
<collection-aggregator timeout="600000" failOnTimeout="false"
doc:name="Validated Orders Aggregator"/>
<component>
<spring-object bean="BatchOrderUpdateComponent"/>
</component>
<default-exception-strategy>
<flow-ref name="ValidationProcessingExceptionFlow" />
</default-exception-strategy>
</flow>
Are you getting any exception? try to debug and see where the message dropping? I tried similar flow and working fine for me.
I'm provided with a wsdl and have to access certain service (TestMessage) using the authentication credentials provided (username : test-Ser, password: XXXX). The wsdl file was generated from the given config file in C#.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="PProxyEndpoint">
<security>
<message clientCredentialType="UserName" establishSecurityContext="false" />
</security>
</binding>
<binding name="PProxyEndpointSvcCertSpecified">
<security>
<message clientCredentialType="UserName" negotiateServiceCredential="false"
establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://p-cer.test.ca/PService.svc"
binding="wsHttpBinding" bindingConfiguration="PProxyEndpoint"
contract="IPService" name="PProxyEndpoint">
<identity>
<certificate encodedValue="XXXXXXXXXXXXXXXXXX............" />
</identity>
</endpoint>
<endpoint address="http://p-cer.test.ca/PService.svc/SvcCertSpecified"
binding="wsHttpBinding" bindingConfiguration="PProxyEndpointSvcCertSpecified"
contract="IPService" name="PProxyEndpointSvcCertSpecified">
<identity>
<certificate encodedValue="XXXXXXXXXXXXXXXXXX............" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
The authentication code is in C# as below:
private static TestClient AuthUser()
{
TestClient client = new TestClient();
client.ClientCredentials.UserName.UserName = “XXXX”;
client.ClientCredentials.UserName.Password = “XXXXX”;
return client;
}
using (TestClient test = AuthUser())
{
TestListRequestItemWrapper ttt = new TestListRequestItemWrapper();
ttt.RequestItems = new ListRequestItem[1];
ttt.RequestItems[0] = new ListRequestItem();
TestListResponseItemWrapper resp = test.TestList(ttt);
}
I have to do same such thing in java, And I'm unable to do so. Please help.
How can I authenticate SOAP service using certificate encoded value in JAVA?
My configuration.xml in Mule ESB is as follow
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" basePath="test" doc:name="HTTP Listener Configuration"/>
<spring:beans>
<spring:bean name="myPasswordCallback" class="com.org.message.PasswordCallback"/>
</spring:beans>
<spring:beans>
<spring:bean id="wss4jInConfiguration" name="Bean" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<spring:constructor-arg>
<spring:map>
<spring:entry key="action" value="UsernameToken "/>
<spring:entry key="passwordType" value="PasswordText"/>
<spring:entry key="user" value="vha-test.xml"/>
<spring:entry key="passwordCallbackRef" value-ref="myPasswordCallback">
</spring:entry>
</spring:map>
</spring:constructor-arg>
</spring:bean>
</spring:beans>
<http:listener-config name="HTTP_Listener_Configuration_3" host="0.0.0.0" port="8083" doc:name="HTTP Listener Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://path.svc?wsdl" service="XService" port="XProxyEndpointSvcCertSpecified" serviceAddress="http://path.svc/SvcCertSpecified" doc:name="Web Service Consumer"/>
<flow name="testdemoFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<custom-transformer class="com.org.message.GetMessageExample" doc:name="Java"/>
<response>
<object-to-string-transformer doc:name="Object to String"/>
</response>
<cxf:jaxws-client serviceClass="com.org.IXmlService" doc:name="CXF" operation="GetMessageList" port="IXmlService" soapVersion="1.2">
<!-- <cxf:ws-security>
<cxf:ws-config>
<cxf:property key="action" value="UsernameToken"/>
<cxf:property key="user" value="uname"/>
<cxf:property key="passwordCallbackClass" value="com.org.message.PasswordCallback"/>
<cxf:property key="passwordType" value="PasswordText"/>
</cxf:ws-config>
</cxf:ws-security> -->
<cxf:inInterceptors>
<spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
<spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<spring:constructor-arg>
<spring:map>
<spring:entry key="action" value="Signature" />
<spring:entry key="signaturePropFile" value="src/main/resources/ws-sign-security.properties" />
</spring:map>
</spring:constructor-arg>
</spring:bean>
</cxf:inInterceptors>
</cxf:jaxws-client>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
<message-properties-transformer doc:name="Message Properties">
<add-message-property key="Content-type" value="application/soap+xml"/>
<add-message-property key="charset" value="UTF-8"/>
</message-properties-transformer>
<http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8084" method="POST" doc:name="HTTP"/>
</flow>
and below is another configuration.xml I've tried:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ws="http://www.mulesoft.org/schema/mule/ws" 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"
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/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd">
<http:listener-config name="HTTP_Listener_Configuration" host="localhost" port="8081" basePath="wsdl" doc:name="HTTP Listener Configuration"/>
<ws:consumer-config name="Web_Service_Consumer" wsdlLocation="http://patyh.svc?wsdl" service="XService" port="XProxyEndpoint" serviceAddress="http://path.svc" doc:name="Web Service Consumer">
<ws:security>
<ws:wss-username-token username="uname" password="password" passwordType="TEXT" addCreated="true" addNonce="true"/>
<ws:wss-timestamp expires="60000"/>
</ws:security>
</ws:consumer-config>
<flow name="wsdltestFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
<ws:consumer config-ref="Web_Service_Consumer" operation="PingWithAuthorization" doc:name="Web Service Consumer"/>
<logger level="INFO" doc:name="Logger" message="req gen : #[payload]"/>
</flow>
</mule>
I'm still not able to authenticate with any of the XMl
Some times (very frequent) mule ESB blocks some of SOAP Requests. How can i Stop Mule from doing that? i don't know what is the reason of blocking.
this is how i have configured http-listener in mule config :
<http:listener-config name="HTTP_listener" host="${MachineName}" port="${InboundPort}" doc:name="HTTP listener Configuration" />
<flow name="etryFlow" >
<http:listener allowedMethods="POST" config-ref="HTTP_listener" path="/{name}" doc:name="HTTP"/>
<set-payload value="#[app.registry.pairFactory.createInputStreamWithStringKeyInstance(message.inboundProperties['http.uri.params']['name'],payload))]" />
<jms:outbound-endpoint connector-ref="jms-connector" ref="UnsortedOrders" />
<logger level="INFO" doc:name="Logger" message="****Entry****" />
</flow>
note : the banned requests are converted into BlockingTransferInputStream instead of BufferInputStream.
thank you.
** EDIT **
this is createInputStreamWithStringKeyInstance implementation :
public static Pair<String, byte[]> createByteArrayWithStringKeyInstance(String key, byte value[]) throws IOException {
return new Pair<String, byte[]>(key, value);
}
and Pair.java is a simple Serializable Class (same as JavaFX.Pair)
Note : The input is a SOAP XML
--EDIT --
This is mule config file :
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:quartz="http://www.mulesoft.org/schema/mule/quartz"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:jms="http://www.mulesoft.org/schema/mule/jms"
xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:bpm="http://www.mulesoft.org/schema/mule/bpm"
xmlns:client="http://www.mulesoft.org/schema/mule/client"
xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:management="http://www.mulesoft.org/schema/mule/management"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.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/core http://www.mulesoft.org/schema/mule/core/3.2/mule.xsd
http://www.mulesoft.org/schema/mule/quartz http://www.mulesoft.org/schema/mule/quartz/3.2/mule-quartz.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.2/mule-vm.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/3.2/mule-jms.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/3.2/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/bpm http://www.mulesoft.org/schema/mule/bpm/3.2/mule-bpm.xsd
http://www.mulesoft.org/schema/mule/client http://www.mulesoft.org/schema/mule/client/3.2/mule-client.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.mulesoft.org/schema/mule/management http://www.mulesoft.org/schema/mule/management/current/mule-management.xsd ">
<jms:activemq-connector name="jms-connector" brokerURL="${BrokerURL}" disableTemporaryReplyToDestinations="true" specification="1.1"/>
<jms:endpoint connector-ref="jms-connector" exchange-pattern="one-way" name="UnsortedOrders" queue="UnsortedOrders"/>
<jms:endpoint connector-ref="jms-connector" exchange-pattern="one-way" name="DestinationEMC" queue="DestinationEMC" />
<jms:endpoint connector-ref="jms-connector" exchange-pattern="one-way" name="DestinationOriginal" queue="DestinationOriginal"/>
<management:jmx-default-config>
<management:credentials>
<spring:entry key="admin" value="admin"/>
</management:credentials>
</management:jmx-default-config>
<spring:beans>
<context:property-placeholder location="classpath:Application.properties"/>
<spring:bean name="NoFactsBean" class="java.util.ArrayList" scope="singleton"/>
<spring:bean id="objectStore" class="org.mule.util.store.QueuePersistenceObjectStore"/>
<spring:bean id ="requestBean" class="com.hamgam.hit.esb.bean.RequestBean" factory-method="getInstance" scope="singleton"/>
</spring:beans>
<message-properties-transformer name="contentTypeTextXML">
<add-message-property key="Content-Type" value="text/xml;charset=UTF-8;" />
</message-properties-transformer>
<http:listener-config name="HTTP_listener" host="${MachineName}" port="${InboundPort}" doc:name="HTTP listener Configuration" />
<flow name="etryFlow">
<http:listener allowedMethods="POST" parseRequest="false" config-ref="HTTP_listener" path="/{name}" doc:name="HTTP" />
<object-to-byte-array-transformer/>
<expression-component>
payload = app.registry.requestBean.createServiceRequest(message.inboundProperties['http.uri.params']['name'],payload);
</expression-component>
<jms:outbound-endpoint connector-ref="jms-connector" ref="UnsortedOrders" />
<logger level="INFO" doc:name="Logger" message="****#[payload] Enters Entry****" />
</flow>
<flow name="consumeRequestsFlow" >
<jms:inbound-endpoint ref="UnsortedOrders" connector-ref="jms-connector" />
<logger level="INFO" doc:name="Logger" message="**** #[payload] Enters consumeRequestsFlow ****" />
<choice doc:name="Choice">
<when expression="#[app.registry.requestBean.isEMCRequired(payload)]">
<jms:outbound-endpoint connector-ref="jms-connector" ref="DestinationEMC" />
</when>
<otherwise>
<jms:outbound-endpoint connector-ref="jms-connector" ref="DestinationOriginal" />
</otherwise>
</choice>
</flow>
<flow name="ConsumeEmcQ">
<jms:inbound-endpoint connector-ref="jms-connector" ref="DestinationEMC" />
<logger level="INFO" doc:name="Logger" message="**** #[payload] Enters ConsumeEmcQ ****" />
<set-payload value="#[app.registry.requestBean.sendToEMC(payload)]" />
<until-successful objectStore-ref="objectStore" maxRetries="${MaximumRetry}" secondsBetweenRetries="${RetryInterval}">
<http:outbound-endpoint address="${ECMURL}" exchange-pattern="one-way">
<transformer ref="contentTypeTextXML"/>
</http:outbound-endpoint>
</until-successful>
</flow>
<flow name="ConsumeOrigQ">
<jms:inbound-endpoint connector-ref="jms-connector" ref="DestinationOriginal" />
<logger level="INFO" doc:name="Logger" message="**** #[payload] Enters ConsumeOriginalQ ****" />
<set-payload value="#[app.registry.requestBean.sendToDestination(payload)]" />
</flow>
<flow name = "EMCResponseFlow" >
<http:inbound-endpoint host="${MachineName}" port="${EMCResponsePort}" exchange-pattern="one-way">
<set-property propertyName="SOAPAction" value="#[message.inboundProperties['SOAPAction']]"/>
<transformer ref="contentTypeTextXML"/>
</http:inbound-endpoint>
<logger level="INFO" doc:name="Logger" message="***EMCResponseEntry****" />
</flow>
</mule>
Assuming createInputStreamWithStringKeyInstance (which you don't describe, so it's really hard to help you) returns an InputStream, Mule ends up building a JMS StreamMessage (per this call).
From the Mule code, you can see it drains the streaming payload into a StreamMessage with this logic:
while ((len = value.read(buffer)) != -1)
{
streamMessage.writeBytes(buffer, 0, len);
}
which is fine, provided the stream returned by createInputStreamWithStringKeyInstance doesn't do any fancy business behind the scene.
Also note that a JMS StreamMessage is probably not what you want. Did you read its Javadoc? It says:
A StreamMessage object is used to send a stream of primitive types in the Java programming language.
I'm pretty sure you instead want to use a JMS BytesMessage. Mule creates such a message if the payload is a byte[] (per the above linked transformation logic) so you'd rather have a <object-to-byte-array-transformer/> right before the jms:outbound-endpoint.
in my axis webservice client project i have client-config.wsdd file in which i use java:org.apache.axis.handlers.LogHandler which is
<deployment name="defaultClientConfig"
xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<handler name="log"
type="java:org.apache.axis.handlers.LogHandler">
<parameter name="LogHandler.fileName" value="../logs/xyz-Axis.log" />
</handler>
<globalConfiguration>
<parameter name="disablePrettyXML" value="false" />
<requestFlow>
<handler type="log" />
</requestFlow>
<responseFlow>
<handler type="log" />
</responseFlow>
</globalConfiguration>
<transport name="http"
pivot="java:org.apache.axis.transport.http.HTTPSender" />
<transport name="local"
pivot="java:org.apache.axis.transport.local.LocalSender" />
<transport name="java"
pivot="java:org.apache.axis.transport.java.JavaSender" />
</deployment>
for generating log file so i can see request and response of webservice.
but some how it's not working, or i can't able to find it please help
you need to define client-config.wsdd into root level of project and need to change in
<handler name="log"
type="java:org.apache.axis.handlers.LogHandler">
<parameter name="LogHandler.fileName" value="xyz-Axis.log"/>
so the xyz-Axis.log will generate at same level of client-config.wsdd