How to find dbcreatestruct method in mule esb3.8.4 jar file? - mule

Recently i want to use UDT while inserting data into db through procedure call.Now UDT is supported in Mule ESB 3.8.4 version.They have given some example in MULE-11138 jira task.But when i am using MEL function defined in above task.I am getting
java.lang.AbstractMethodError: org.enhydra.jdbc.standard.StandardXAConnectionHandle.createStruct(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Struct;
Can any one help me on this?
Thanks.

Finally i am able to resolve this error all i need to do is to use type defined in db directly for creation of array or struct like.
dbCreateArray('Oracle_Configuration', 'APPS.CONTACT_INFO_ASYNC_TAB_TYPE', payload);
Thanks,
Anurag

#Anurag
This is available only in enterprise edition.

Related

How to fetch the #[app.name] , environment variable and #[exception.getMessage()] in Mule dataweave

Actually what I am trying to do is whenever exception/error occurs in application it will come to catch exception strategy, here I'm trying to create a xml request which contains application name, timestamp and error details and calling one rest service with this xml as input. Could you please help me in doing this..?? Thanks in Advance
There nothing you can do access those expressions in dataweave, you might need to store those in flowVars then access the flowVars in dataweave like flowVars."name_of_var".
Regards,
Ralph
You can find error handling block in your flow.
Inside that you can catch the exception with the MEL syntax.
#[Exception.causedBy(corresponding class)]
once if there is an exception based on some class then inside that you can define your strategy.
In general you can catch any exception by #[Exception!=null]
If there is any exception occurs automatically the control will be passed here.
In that you can setpayload #[app.name], #[server.dateTime],#[Exception.getMessage()]
Then you can proceed as you want.
Thanks!

Mule MEL, how to get a property value?

In the Mule MEL, how to get a property value ?
In the java code, I did this:
eventContext.getMessage().setInvocationProperty("amount", 100);
I have tried these options
#[message.invocationProperty.invocation]
#[message.invocationProperty('invocation')]
#[message.getInvocationProperty().get('invocation')]
I realize that message is an instance of org.mule.el.context.MessageContext, then what is the correct syntax ?
Try #[message.inboundProperties['propertyName']] or #[message.invocationProperties['propertyName']]
If you set a variable with scope INVOCATION (with Message Enricher or Variable), you can get the variable with the syntax below:
#flowVars['your_Variable_Name']
Although the sintaxis is almost the same, it depends on the scope of the property variable, but the most usual way is:
#[flowVars['flow_var_name']]
In my personal opinion I don't recommend to use:
#[flowVars.variable]
Because in some complex environment with many messageContext switches the variable could get lost. I recommend to take a look on the next post from Mulesoft oficial blog that shows how to handle Properties and variables.
This answer for your comment
<set-variable variableName="amount" value="message.invocationProperties['amount']" />
Solution is
<set-variable variableName="amount" value="#[message.invocationProperties['amount']]" />
To get the Invocation properties of a message follow this syntax:
#[flowVars.parameter] or #[flowVars['paramater']]

Message.InboundProperty always return String - MULE - AnyPoint Studio - APIkit

im developing an API using RAML + MULE AnypointStudio (APIkit) . so in my RAML file i had defined a resourse like this.
/player
post:
queryParameters:
year: type: integer
place: type: string
Then, into AnyPoint Studio, after importing my .raml file i got a flow with the post method asociated. I use the MySQL Conector to insert in a data base. the problem resides in the query:
INSERT INTO Matches (day,place,max_players)
VALUES (#[message.inboundProperties.'day'],#[message.inboundProperties'place'],
#[message.inboundProperties.'maxPlayers'])
when i call #[message.inboundProperties.day] it returns a string, but i want an integer value.
im new at MULE, so it would be great if you can explain me how.
ty
All query parameters are treated as Strings. You can use MEL to convert to an int though. Here's an example suing Java in a Mel expression to parse the parameter to an int.
#[Integer.parseInt(message.inboundProperties.day)]

Unable to resolve symbol 'ExecutionInfo'

I'm getting this error when trying to use ReportingService2010:
Unable to resolve symbol 'ExecutionInfo'
ExecutionInfo and ExecutionHeader worked in ReportingService2005. I'm using Visual Studio 2010, VB.Net, and ReportingServices2010. I can connect to the server and do things like rs.ListChildren.
Any Ideas?
I found the answer to my question. Hopefully this helps others.
There are two main type of endpoints in the Report Server web service, one for Management and one for execution.
The management endpoints are: ReportService2005, ReportService2006, ReportService2010
The execution endpoint is: ReportExecution2005
Therefore you can get report names, paths, data sets, etc. from ReportService2010, but to execute a report you must use ReportService2005.
So here's how you do it:
Add a web reference to the 2005 wsdl of your server, not 2010. So do this: http://<your server>/reportserver/ReportExecution2005.asmx Not this: http://<your server>/reportserver/ReportExecution2010.asmx
Import the referenc
Create an instance of ReportExecutionService: Dim rs As New ReportExecutionService. That is the 2005 executation service that has the ExecutionInfo and ExecutionHeader methods.
Reference: http://msdn.microsoft.com/en-us/library/ms155398.aspx

how to get the mule application name

Is there some way of getting the base mule application name of a deployed mule application?
The only two options i have found so far is:
muleContext.getConfiguration().getId() //which gives me some not so humanly-readable id of some sort.
and
muleEvent.getFlowConstruct().getName() //gives me that flow name from where this was called.
Each application is in their own application directory when deployed, is it not possible to get a hold of this or some other similar distinguished name from within the muleContext?
kind regards
The simplest way to retrieve the application name is by injecting it into your component using the ${app.name} spring placeholder
This worked for me:
String appName = ((org.mule.module.launcher.MuleApplicationClassLoader)this.getClass().getClassLoader()).getAppName();
For Mule 4.x there are predefined variables and one of those is app.name to retrieve the application name in runtime. This is the link to the Mulesoft documentation to check all the predefined variables:
https://docs.mulesoft.com/mule-runtime/4.2/dataweave-variables-context
For MuleSoft 4.2.0 you can load application name with static Java function:
ClassLoader cl = Class.forName("full-name-holding-this").getClassLoader();
Method getArtifactDescriptor = cl.getClass().getMethod("getArtifactDescriptor");
Object artifactDescriptor = getArtifactDescriptor.invoke(cl);
Method getName = artifactDescriptor.getClass().getMethod("getName");
Object appName = getName.invoke(artifactDescriptor);
return appName.toString();