0
votes

I am trying to use MULE to post an XML file to a web service via HTTP, but whatever I try it complains about the payload type. My current Mule configuration is:

<file:connector name="File" writeToDirectory="C:\Users\mark.gordon\Documents\Timesheets" readFromDirectory="C:\Users\mark.gordon\Documents\Timesheets" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
<http:request-config name="HTTP_Request_Configuration" protocol="HTTPS" host="cpa-test.mcnicholas.co.uk" port="443" basePath="/cgi-bin/portal" doc:name="HTTP Request Configuration" tlsContext-ref="TLS_Context">
</http:request-config>
<tls:context name="TLS_Context" doc:name="TLS Context">
    <tls:trust-store path="C:\Program Files\Java\jre7\lib\security\cacert" password="changeit"/>
</tls:context>
<http:request-config name="HTTP_Request_Configuration1" protocol="HTTPS" host="cpa-live.mcnicholas.co.uk" port="443" basePath="/cgi-bin/portal" doc:name="HTTP Request Configuration"/>
<flow name="timesheetsFlow">
    <file:inbound-endpoint path="C:\Users\mark.gordon\Documents\Timesheets" moveToDirectory="C:\Users\mark.gordon\Documents\Timesheets\Processed" connector-ref="File" responseTimeout="10000" doc:name="File">
        <file:filename-regex-filter pattern="A.*\.xml" caseSensitive="false"/>
    </file:inbound-endpoint>
    <mulexml:xslt-transformer xsl-file="C:\Users\mark.gordon\AnypointStudio\workspace\timesheets\Stylesheets\ts-sp-to-cpa.xsl" maxIdleTransformers="2" maxActiveTransformers="5" doc:name="XSLT"/>
    <set-attachment attachmentName="timesheet" value="#[payload]" contentType="text/xml" doc:name="Attachment"/>
    <http:request config-ref="HTTP_Request_Configuration1" path="main" method="POST" doc:name="HTTP" followRedirects="true" responseTimeout="300">
        <http:request-builder>
        </http:request-builder>
    </http:request>
</flow>

Later on I will be transforming the XML using XSLT before posting it, but I've stripped that out since I can't even get it to post without that!

With the code as posted I get the following exception:

Message               : Error sending HTTP request. Message payload is of type: byte[]
Code                  : MULE_ERROR--2
--------------------------------------------------------------------------------
Exception stack is:
1. null (java.util.concurrent.TimeoutException)
  org.glassfish.grizzly.impl.SafeFutureImpl$Sync:357 (null)
2. Error sending HTTP request. Message payload is of type: byte[] (org.mule.api.MessagingException)
  org.mule.module.http.internal.request.DefaultHttpRequester:190 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/MessagingException.html)
--------------------------------------------------------------------------------
Root Exception stack trace:
java.util.concurrent.TimeoutException
    at org.glassfish.grizzly.impl.SafeFutureImpl$Sync.innerGet(SafeFutureImpl.java:357)
    at org.glassfish.grizzly.impl.SafeFutureImpl.get(SafeFutureImpl.java:264)
    at com.ning.http.client.providers.grizzly.GrizzlyResponseFuture.get(GrizzlyResponseFuture.java:173)
    + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)
********************************************************************************
1
What exception do you get? Can you please add it to the question?David Dossot
Please post what exception you are gettingSatheesh Kumar

1 Answers

0
votes

You're getting a TimeoutException: I suspect a firewall preventing you to POST to this particular endpoint.