Sending multi-part MIME package via HTTP-POST

S

squishywaffle

This has got me somewhat stumped, so I'll throw it up here in hopes
that someone has ran into this before. I'm trying to send a MIME
package to Esko Backstage. I'm a bit confused as to how to send this
to the server in a manner that it'll be able to get and de-code the
MIME package in a valid way.

The big question is does this entire mime package belong in the
headers section of an HTTP request? If not, what is the best Pythonic
way to send this thing. I'm using 2.5's email package to create the
package and was trying to use its as_string() method to pump this
through httplib, but I'm getting a very vague server error message
that seems to indicate a malformed package. Here is the broken code:

hcon = httplib.HTTPConnection(JMF_GATEWAY)
hcon.putrequest('POST', JMF_GATEWAY_PATH)
hcon.endheaders()
hcon.send(msg.as_string())

I've pasted the string representation of the MIME package I'm trying
to send below. Any ideas would be greatly appreciated.

Content-Type: multipart/related;
boundary="===============1845688244=="
MIME-Version: 1.0
start: cid:beginning

--===============1845688244==
Content-Type: application/vnd.cip4-jmf+xml
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: beginning

<?xml version="1.0" ?><JMF SenderID="QMon" Version="1.2"><Command
ID="Link1290_5" Type="SubmitQueueEntry"><QueueSubmissionParams
Hold="false" Priority="50" URL="cid:aJDF_1"/></Command></JMF>
--===============1845688244==
Content-Type: application/vnd.cip4-jdf+xml
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: aJDF_1

<?xml version="1.0" ?>
<JDF DescriptiveName="StepRepeatTab and RIP" ID="n0001"
Status="Waiting" Type="ProcessGroup" Version="1.2" xmlns="http://
www.CIP4.org/JDFSchema_1_1" xmlns:eg="http://www.esko-graphics.com/
EGschema1_0">
<ResourcePool>
<RunList Class="Parameter" DescriptiveName="1-up"
ID="SourceFileList" PartIDKeys="Run" Status="Available">
<RunList Run="Run0001">
<LayoutElement>
<FileSpec URL="/archive/49297
PEPPINOS/49297-1 DMT-20.pdf"/>
</LayoutElement>
</RunList>
</RunList>
</ResourcePool>
<JDF DescriptiveName="RIP1up" ID="n0003" Status="Waiting"
Type="eg:BackStageTask" Version="1.2" xmlns="http://www.CIP4.org/
JDFSchema_1_1" xmlns:eg="http://www.esko-graphics.com/EGschema1_0">
<NodeInfo JobPriority="50"/>
<ResourcePool>
<eg:BackStageTaskParams Class="Parameter"
ID="TaskParamLink" Status="Available" eg:Hold="false" eg:TicketName="/
fripfile_s.file_sModel1.grx/XXXPROOFTICKETXXX"/>
</ResourcePool>
<ResourceLinkPool>
<eg:BackStageTaskParamsLink Usage="Input"
rRef="TaskParamLink"/>
<RunListLink Usage="Input"
rRef="SourceFileList"/>
<RunListLink Usage="Output" rRef="TIFFList"/>
</ResourceLinkPool>
</JDF>
</JDF>

--===============1845688244==--
 
S

squishywaffle

In message



Which is?

In this case it's not really something that will be readily recognized
here, nor is it extremely helpful diagnostic-wise. This is the only
debug output I can get from the logs or stdout:

"Failed to parse content as JDF."
 
L

Lawrence D'Oliveiro

In message
In this case it's not really something that will be readily recognized
here, nor is it extremely helpful diagnostic-wise. This is the only
debug output I can get from the logs or stdout:

"Failed to parse content as JDF."

I may not recognize it, but I can Google:
<http://www.cip4.org/overview/what_is_jdf.html>.

Does the server log contain any more information? If not, is it possible to
increase the log verbosity level in the server?
 
J

Justin Ezequiel

have you tried using the

def request(self, method, url, body=None, headers={})

method instead of putrequest, endheaders, send methods?

where body is

--===============1845688244==
Content-Type: application/vnd.cip4-jmf+xml
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-ID: beginning
<?xml version="1.0" ?><JMF SenderID="QMon" Version="1.2"><Command
....
</JDF>
</JDF>
--===============1845688244==--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top