How do you "accept" a file upload in Mule 3.8? (Not deprecated) - mule

How does one upload a file using an API in Mule 3.8? Can someone provide an example for a multipart/form-field POST using an example log file? Here's an old way but the connector is deprecated.
<http:connector name="httpConnector" doc:name="HTTP\HTTPS">
<service-overrides
messageFactory="org.mule.transport.http.HttpMultipartMuleMessageFactory" />
</http:connector>
I'm testing a process API that creates an import and then "will" call another service to upload itself. I'm modeling my own file upload using Mule and I can't seem to get anything to work. I have a Spring Boot servlet that uses Apache Commons Upload but I would prefer to have my upload prototype in Mule with my real projects until our Mule servers are installed.

Related

Unable to consume WSDL in Mule 4

I am using anypoint studio 7.3.1 with Mule 4.1.x. trying to load the WSDL using Web Service Consumer.
First I placed my WSDL file under src/main/resources of my project.
In Web Service Consumer, under connector configuration I selected my WSDL and at this point the mulesoft should automatically populate “Service”, “Port” and “Address”.
However that is not happening. I read somewhere that WSDL file needs to be exported to mule-artifact.json which I did, but still doesn’t work.
To make sure my WSDL is good, I was able to load the same WSDL in soapUI and was able to access the web service.
What is it that I need to do to get this working? Is there any error log that tells what’s going on? By the way, the endpoint is http so I know there is no cert issue.
the problem was due to the xsd that was referred in the WSDL. Removed that and it worked

How to migrate read file from ftp flow to mule 4.1.4 Kernel version?

people! I am migrating to mule 4 Kernel version.
I'm stuck in this moment: requirement is to read file from FTP and then process it. In old version it was like a few components:
1. quartz,
2. transformer
3. transformer
4. queue
Can somebody help me to migrate it to mule 4 kernel?
How to do this? How to put file content as string into queue like it was in older version? It would be nice if we could talking about Mule Kernel version. I'm new member of this community and of Mule developers, to pls dont hate me.
In next step I'm gonna split this file (splitter) but I know in Kernel there is not splitters anymore, so I have to use for each, right?
Now I've got
1. http listener (but it should be job. For my own tests It is http listener, I'm gonna to change this).
2. FTP read with FTP connector
3. ????
<flow>
<quartz
with cronExpression
and with conector to FTP>
</quartz>
<gzip-uncompress-transformer encoding="UTF-8"></gzip-uncompress-transformer>
<byte-array-to-string-transformer encoding="UTF-8"></byte-array-to-string-transformer>
<jms:outbound-endpoint queue="xxx" ></jms:outbound-endpoint>
</flow>
You should first try to read the migration guide and try to migrate each component to its equivalent in Mule 4: https://docs.mulesoft.com/mule-runtime/4.2/index-migration
For the example you mentioned it should very straightforward.
Quar
tz: it was already deprecated in Mule 3 by the Poll element. Its
replacement in Mule 4 is the Scheduler:
https://docs.mulesoft.com/mule-runtime/4.2/migration-core-poll
FTP:
there is a new FTP connector, which works in operations rather than
inbound/output:
https://docs.mulesoft.com/mule-runtime/4.2/migration-connectors-ftp-sftp
gzip uncompress: this isn't mentioned in the migration guide but just a search shows that there is a replacement: https://docs.mulesoft.com/connectors/compression/compression-module#gzip-decompressor-strategy
jms outbount: https://docs.mulesoft.com/mule-runtime/4.2/migration-connectors-jms#SendingMessages
: this kind of low level transformation is usually not needed anymore in Mule 4. (https://docs.mulesoft.com/mule-runtime/4.2/migration-core)
Most of the information is already in the documentation.
Another suggestion is try to use the latest available version of Mule and connectors.

Mule Web Service Consumer not loading WSDL

I am trying to load WSDL using mule's Web Service Consumer but no success. If I try same WSDL from SOAPUI it works without running into any issues.
I tried below 2 options and both directing me to different issues. Any suggestion?
Option#1. Tried to load WSDL with URL gives me PKIX path building failed as below
Option#2. Also, tried to load WSDL as resource i.e. by saving it into src/main/resources folder. This gives me below
NOTE: I am using Anypoint Studio 6.4.4 with mule Community Edition 3.9 and JDK 1.8.
WSDL: https://esweb.revenue.louisiana.gov/fsettest/fsetgatewaywebservice.asmx?wsdl
you need to add the wsdl certificate to Java cacerts keystore. Here you have a useful link:
https://knowledge.digicert.com/solution/SO4085.html
On the other hand, you are getting the second error, because that wsdl you downloaded has an import of another wsdl (this is the other wsdl http://esweb.revenue.louisiana.gov/fsettest/fsetgatewaywebservice.asmx?wsdl=wsdl1).
If you want to do it this way (that I would not recommend), you will need to download all the wsdls that are imported, and reference them locally.

Integration of cloud hub with on premise splunk

In one of the requirement i want to integrate splunk with existing mule esb server that we are using(we are using cloudhub).
How can we achieve that?
Any help will be great.
You can use the Splunk connector to integrate within your applications. If you want to just send event data from existing applications see this other documentation page: Sending Data from Runtime Manager to External Monitoring Software
Add below configuration in your log4j file.
<Configuration packages="com.mulesoft.ch.logging.appender,com.splunk.logging">
<Http name="SPLUNK" url="https://input-prd-p-3ppsrv6qrg3h.cloud.splunk.com:8088" token="19954BDA-7A21-4FFA-A1E5-B3DFB7C75D55" disableCertificateValidation="true">
<PatternLayout pattern="%m" />
</Http>
where you should prefix "input-" to the domain name you have for splunk & the token will be the one that of http even collector.
Also while logging give reference of above http splunk appender :
<Root level="INFO">
<AppenderRef ref="SPLUNK" />
</Root>
Let me know if it works

How to pass java.io.File from Mule 3 inbound file endpoint

Using Mule 3, how can I pass a java.io.File object payload from an inbound file endpoint to a Groovy script rather than the file's content?
You need to turn streaming off and override the default message factory on the file connector:
<file:connector name="fileConnector" streaming="false" autoDelete="false">
<service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>
Note that it is up to you to move / delete the file either before you start or once you've done processing it, otherwise Mule will poll it again and again.