Hi
I have the following case:
I send MTOM request and receive response with embedded PDF.
I built up the MTOM body in the template, and made the below settings for my Http sender:
Multipart: No
Response Content: XML Body
Parse Multipart: Yes
I got the PDF as xml element inside the response, following an example:
HttpResponse>
<Body boundary="MIMEBoundaryurn_uuid_EB763C07A95A62816A1 426668158042" multipart="yes">
<Part>
<Headers>
<Content-Type>application/xop+xml; charset=UTF-8; type="application/soap+xml"</Content-Type>
<Content-Transfer-Encoding>binary</Content-Transfer-Encoding>
<Content-ID><0.urn:uuid:EB763C07A95A62816A1426668158044@ apache.org></Content-ID>
</Headers>
<Content multipart="no"><?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope ><soapenv:Header><wsa:Action>urn:ih e:iti:2007:RetrieveDocumentSetResponse</wsa:Action><wsa:RelatesTo>bb1906f1-5fff-4ea5-979e-55c3a2f20489</wsa:RelatesTo></soapenv:Header><soapenv:Body><xdsb:Ret rieveDocumentSetResponse ><rs:RegistryResponse status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success" /><xdsb:DocumentResponse><xdsb:Reposito ryUniqueId>1.19.6.24.109.42.1.5</xdsb:RepositoryUniqueId><xdsb:DocumentUnique Id>1.42.20141105202336.39</xdsb:DocumentUniqueId><xdsb:mimeType>text/plain</xdsb:mimeType><xdsb:Document><xop:Incl ude href="cid:1.urn:uuid:EB763C07A95A62816A14266681580 45@apache.org" /></xdsb:Document></xdsb:DocumentResponse></xdsb:RetrieveDocumentSetResponse></soapenv:Body></soapenv:Envelope></Content>
</Part>
<Part>
<Headers>
<Content-Type>text/plain</Content-Type>
<Content-Transfer-Encoding>binary</Content-Transfer-Encoding>
<Content-ID><1.urn:uuid:EB763C07A95A62816A1426668158045@ apache.org></Content-ID>
</Headers>
<Content multipart="no">........ PDF document is here ....
</Content>
</Part>
</Body>
</HttpResponse>
Now in my response channel I added the following transformer to extract the PDF into a string:
$gc('doc', msg['Body']['Part'][1]['Content'].toString());
I added a file writer destination set it into binary and put ${doc} in it's template.
I have the following error:
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: XDSb Retrieve Document Filter
CONNECTOR: To Response 2
SCRIPT SOURCE:
SOURCE CODE:
LINE NUMBER: 262
DETAILS: TypeError: Character reference "" is an invalid XML character.
If I try to change the type of inbound/outbound connector to Raw I get:
246: $gc('doc', msg['Body']['Part'][1]['Content'].toString());
247: if ('xml' === typeof msg && msg.hasSimpleContent()) { msg = msg.toXMLString(); }if ('xml' === typeof tmp && tmp.hasSimpleContent()) { tmp = tmp.toXMLString(); }
248: }
249: if (doFilter() == true) { doTransform(); return true; } else { return false; }
250: }
LINE NUMBER: 246
DETAILS: TypeError: Cannot read property "Part" from undefined
if I try to change the connector to type to document writer I get:
Document Writer error
ERROR MESSAGE: Error writing document
org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 2; The content of elements must consist of well-formed character data or markup.
If I try to pre-process the message removing control characters such as "", I end up with "The content of elements must consist of well-formed character data or markup" error ...
Any help is mostly appreciated
Regards
I have the following case:
I send MTOM request and receive response with embedded PDF.
I built up the MTOM body in the template, and made the below settings for my Http sender:
Multipart: No
Response Content: XML Body
Parse Multipart: Yes
I got the PDF as xml element inside the response, following an example:
HttpResponse>
<Body boundary="MIMEBoundaryurn_uuid_EB763C07A95A62816A1 426668158042" multipart="yes">
<Part>
<Headers>
<Content-Type>application/xop+xml; charset=UTF-8; type="application/soap+xml"</Content-Type>
<Content-Transfer-Encoding>binary</Content-Transfer-Encoding>
<Content-ID><0.urn:uuid:EB763C07A95A62816A1426668158044@ apache.org></Content-ID>
</Headers>
<Content multipart="no"><?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope ><soapenv:Header><wsa:Action>urn:ih e:iti:2007:RetrieveDocumentSetResponse</wsa:Action><wsa:RelatesTo>bb1906f1-5fff-4ea5-979e-55c3a2f20489</wsa:RelatesTo></soapenv:Header><soapenv:Body><xdsb:Ret rieveDocumentSetResponse ><rs:RegistryResponse status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success" /><xdsb:DocumentResponse><xdsb:Reposito ryUniqueId>1.19.6.24.109.42.1.5</xdsb:RepositoryUniqueId><xdsb:DocumentUnique Id>1.42.20141105202336.39</xdsb:DocumentUniqueId><xdsb:mimeType>text/plain</xdsb:mimeType><xdsb:Document><xop:Incl ude href="cid:1.urn:uuid:EB763C07A95A62816A14266681580 45@apache.org" /></xdsb:Document></xdsb:DocumentResponse></xdsb:RetrieveDocumentSetResponse></soapenv:Body></soapenv:Envelope></Content>
</Part>
<Part>
<Headers>
<Content-Type>text/plain</Content-Type>
<Content-Transfer-Encoding>binary</Content-Transfer-Encoding>
<Content-ID><1.urn:uuid:EB763C07A95A62816A1426668158045@ apache.org></Content-ID>
</Headers>
<Content multipart="no">........ PDF document is here ....
</Content>
</Part>
</Body>
</HttpResponse>
Now in my response channel I added the following transformer to extract the PDF into a string:
$gc('doc', msg['Body']['Part'][1]['Content'].toString());
I added a file writer destination set it into binary and put ${doc} in it's template.
I have the following error:
ERROR MESSAGE: Error evaluating transformer
com.mirth.connect.server.MirthJavascriptTransforme rException:
CHANNEL: XDSb Retrieve Document Filter
CONNECTOR: To Response 2
SCRIPT SOURCE:
SOURCE CODE:
LINE NUMBER: 262
DETAILS: TypeError: Character reference "" is an invalid XML character.
If I try to change the type of inbound/outbound connector to Raw I get:
246: $gc('doc', msg['Body']['Part'][1]['Content'].toString());
247: if ('xml' === typeof msg && msg.hasSimpleContent()) { msg = msg.toXMLString(); }if ('xml' === typeof tmp && tmp.hasSimpleContent()) { tmp = tmp.toXMLString(); }
248: }
249: if (doFilter() == true) { doTransform(); return true; } else { return false; }
250: }
LINE NUMBER: 246
DETAILS: TypeError: Cannot read property "Part" from undefined
if I try to change the connector to type to document writer I get:
Document Writer error
ERROR MESSAGE: Error writing document
org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 2; The content of elements must consist of well-formed character data or markup.
If I try to pre-process the message removing control characters such as "", I end up with "The content of elements must consist of well-formed character data or markup" error ...
Any help is mostly appreciated
Regards
extract PDF document
0 commentaires:
Enregistrer un commentaire