Changing content type of xml file to pdf
Hello,
I have an xml file (extension is *.xdp) which can locally be opened with Adobe Reader and displays as a regular pdf file. Adobe has a technology that allows xml to be merged with a pdf shell, and thus populating the pdf file with the values retrieved from the xml file.
My issue is that I want this to be done on an application server level (jboss in particular). In a servlet, I stream the xml file for the contents to be printed out within a browser (IE). I specify the content type to be application/pdf, however, the data is not being displayed within Adobe Reader, but rather as a regular xml file.
Any help is greatly appreciated. Here is the code below:
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=30");
response.setContentType("application/pdf");
ServletOutputStream out = response.getOutputStream();
byte[] fileBytes = readFile();
out.write(fileBytes);
Yes, the xml does contain a reference to the shell pdf. This works fine if I do so manually (open the xml file using Adobe Reader). However, through a browser, it seems that the forced content type is completely ignored:
<?xml version="1.0"?>
<?xfa generator="XFA2_0" APIVersion="1.4.4127.0"?>
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
<xfa:datasets xmlns="" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">
<xfa:data>
<DocRoot>
<Cldemographics<Cldatecreated>7/21/05</Cldatecreated...
</DocRoot>
</xfa:data>
</xfa:datasets>
<pdf href="/opt/jboss-tomcat-server-build-4.0.0-2/.../pdfShell/Shell.pdf"
xmlns="http://ns.adobe.com/xdp/pdf/"/>
</xdp:xdp>
Similar Messages
-
Hi,
How can I change the content-type (text/xml;charset=utf-8) sent by the SOAP adapter to an external webservice?
I need to sent text/xml as content-type to the webservice, otherwise I get an error.
I have tried with different adapter modules but so far no positive results.
Thanks.
Edited by: Roberto Viana on Mar 26, 2009 2:02 PMHi Stefan, many thanks for your answer.
According to your answer it is not possible to manipulate/change the way PI fills the content-Type.
I was hoping to solve the issue with a custom built adapter module that sets the HTTP header content-type to text/xml without the charset entry, but I understand that's not the case.
Regards,
Roberto Viana -
How to change content/type from applicaiton/xml to text/xml??
Hi B2B Gurus,
Now that i have worked out file transfer. I was now trying to post the same document onto a HTTP URL.
I see in the headers that the
Content-Type=application/XML
However i need the Content-Type to be text/XML
Where can i get this changed?
Edited by: user773213 on Apr 8, 2009 4:48 AMi tried it but it still shows the same content-type
***************************B2B.LOG************************************************
2009.04.08 at 18:45:29:500: Thread-10: Repository - (INFORMATION) BIND VARS = (5B7A966871774858A1C935F4ADEECA85-95-1, 95, 1, N, http://ap604fin.us.oracle.com:7787/HTTPService/Receiver, <0AB05E5912085DE6D600000082D60500@AS2_Mycompany>, null, null, , Processing, oracle.tip.repos.core.driver.BinaryImpl@10bbd42, , null, , oracle.tip.repos.core.driver.BinaryImpl@1b6772a, null, null, null, HTTP, , 1.0, Wed Apr 08 18:45:29 GMT+05:30 2009, , Message-ID=<0AB05E5912085DE6D600000082D60500@AS2_Mycompany>
Content-Transfer-Encoding=binary
MIME-version=1.0
From=AS2_Mycompany
Receipt-Delivery-Option=file://localhost/ORACLE_HOME\MyCompany
Disposition-Notification-To=[email protected]
AS2-To=AS2_Supplier1
User-Agent=AS2 Server
Date=Wed, 08 Apr 2009 13:15:17 GMT
AS2-Version=1.1
AS2-From=AS2_Mycompany
Content-Type=application/XML; name=ShipOrder
Connection=close
, null, 0AB05E5912085DE72520000082D60600, null, 3C4DF09FF3304FA698C287DA35154FDB, 826050DF70374FF389E372DB6D126D46)
2009.04.08 at 18:45:29:906: Thread-10: Repository - (DEBUG) CatalogDriver.writeObjectList()
*********************************************************************************** -
Unable to change content types for pptx, xslx and docx files
I'm running into an issue where I cannot change the content type of any xml-based Office documents. Here's what I've done:
1 - Create a custom content (A) type based off the Document content type
2 - Enable the custom content type in a document library
3 - Add a document or select an existing document and edit the content type to the custom content type
4 - The custom content type will save for documents such as .ppt, .doc, etc. The custom content type will now save for .docx, .pptx or .xlsx files. The properties window will save without displaying any errors but the content type will not change
I ran several tests including creating another custom content type (B) based off of the Document content type. I proved that:
The custom content type (B) can be saved to .docx, .pptx or .xlsx files IF no additional columns are added to the custom content type
As soon as I add a column to the custom content type the aforementioned documents cannot be saved as that custom content type
Documents created through the File option in a document library also fail to change content type to the custom content type when saved. Most of my files are .docx, .pptx, or .xlsx files, and this issue poses a significant roadblock in our SharePoint roll-out.
I appreciate any advise you can provide.Hi,
According to your post, my understanding is that the custom content type could not save with .docx, pptx and xlsx files when with a additional column.
I tested with your issue as the steps below, the custom content type worked well.
Create a custom column Doc1
Create a custom content type Doc1, the parent content type from chose the Document Content Types, Parent Content Type chose Document.
Add the custom Doc1 to the custom content type Doc1.
Add the custom content type into the library LIbA.
Upload the files with .docx, .pptx and .xlsx files into the library with the custom content type, they all save well with the custom content type.
I also create other content type with other Parent Content Type, they all worked.
Did the issue occur in other library? You can create a new library then use the custom content type to check whether it works.
You can also use the other browsers to check whether it works, such as Chrome, Firefox.
Thanks & Regards,
Jason
Jason Guo
TechNet Community Support -
Hi all,
We are trying to interact with Documentum server through DFS exposed WCF which communicates through port 9443 and we are provided with documentum issued Public Key certificates. We have successfully imported the certificates in client machine and configured
the bindings as below in our .Net web application config file.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding
name="ObjectServicePortBinding1">
<security
mode="Transport">
<transport
clientCredentialType="None"
proxyCredentialType="None"
realm=""
/>
<message
clientCredentialType="Certificate"
algorithmSuite="Default"
/>
</security>
</binding>
<binding
name="QueryServicePortBinding">
<security
mode="Transport">
<transport
clientCredentialType="None"
proxyCredentialType="None"
realm=""
/>
<message
clientCredentialType="Certificate"
algorithmSuite="Default"
/>
</security>
</binding>
</wsHttpBinding>
</bindings>
Also, we set the message encoding as MTOM and the wcf client object initialization code snippet is as below,
ObjectServicePortClient
serviceClient = new
ObjectServicePortClient(new
WSHttpBinding("ObjectServicePortBinding1"),
new
EndpointAddress(UriUtil.ObjectServiceUri));
if (serviceClient.Endpoint.Binding
is
WSHttpBinding)
WSHttpBinding
wsBinding = serviceClient.Endpoint.Binding as
WSHttpBinding;
wsBinding.MessageEncoding =
"MTOM".Equals(transferMode) ?
WSMessageEncoding.Mtom :
WSMessageEncoding.Text;
serviceClient.Endpoint.Behaviors.Add(new
ServiceContextBehavior(Config.RepositoryName,
Config.DocumentumUserName,
Config.DocumentumPassword));
When we execute the above code, we are getting error message as below,
Exception: The content type text/xml;charset=utf-8 of the response message does not match the content type of the binding (multipart/related; type="application/xop+xml"). If using a custom encoder, be sure that the IsContentTypeSupported
method is implemented properly. The first 407 bytes of the response were: '<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><S:Fault xmlns:ns4="http://www.w3.org/2003/05/soap-envelope"><faultcode>S:VersionMismatch</faultcode><faultstring>Couldn't
create SOAP message. Expecting Envelope in namespace http://schemas.xmlsoap.org/soap/envelope/, but got http://www.w3.org/2003/05/soap-envelope </faultstring></S:Fault></S:Body></S:Envelope>'
Then, we changed the bindings as below
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding
name="ObjectServicePortBinding1">
<security
mode="Transport">
<transport
clientCredentialType="Certificate"
proxyCredentialType="None"
realm=""
/>
<message
clientCredentialType="Certificate"
algorithmSuite="Default"
/>
</security>
</binding>
<binding
name="QueryServicePortBinding">
<security
mode="Transport">
<transport
clientCredentialType="
Certificate"
proxyCredentialType="None"
realm=""
/>
<message
clientCredentialType="Certificate"
algorithmSuite="Default"
/>
</security>
</binding>
</wsHttpBinding>
</bindings>
We are getting another error message,
Exception: The client certificate is not provided. Specify a client certificate in ClientCredentials.
Any pointers on resolving this issue would be highly helpful.
ThanksHi Dhanasegaran,
As per your case, the corresponding details which may guide you to resolve this issue:
1. First of all, you can try to call the wcf service directly from the browser & check where it will point out the correct location.
2. In config file ,Set IncludeExceptionDetailInFaults to true to enable exception information to flow to clients for debugging purposes .
Set this to true only during development to troubleshoot a service like below :
<serviceBehaviors>
<behavior name="metadataAndDebugEnabled">
<serviceDebug
includeExceptionDetailInFaults="true"
/>
<serviceMetadata
httpGetEnabled="true"
httpGetUrl=""
/>
</behavior>
</serviceBehaviors>
3. I suggest you to change that <security mode ="TransportWithMessageCredential"> instead of <security mode ="Transport">
for more information, refer the following link :
https://msdn.microsoft.com/en-us/library/aa354508(v=vs.110).aspx -
How to change content-type in receiver mail adapter
Hi,
I have receiver mail adapter for sending XML file as attachment in the mail. My partner expects to receive mail with content-type: text/xml, but XI sends Content-Type: application/xml. Please advise how I can change content-type to text/xml.
Thank you
Levhi,
try MessageTransformBean
Transform.ContentType
http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/content.htm
also shown in my blog:
/people/michal.krawczyk2/blog/2005/11/23/xi-html-e-mails-from-the-receiver-mail-adapter
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Change MessageType name in xml file
Hi experts,
I have developed a receiver interface that creates an xml file and put it on an external server.
Now other side says that this tag:
<ns0:MT_MexElectronicInvoice_EDICOM xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
is not correct, they want another description:
<ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
My question is: is possible to change MessageType tag in xml file without changing the message type structure name in Integration Repository?
thanks
fabiouse another mapping which has the target MT as <ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice">
Add this mapping after the original mapping in your interface/operation mapping.
This will be the easiest way to handle this requirement as you will only need to do a one to one mapping.
Another option will be to write a java mapping to do a simple replace function for the string <ns0:MT_MexElectronicInvoice_EDICOM xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice"> to <ns0:MT_MexElectronicInvoice_myFirm xmlns:ns0="urn:Myfirm-EDICOM:MexElectronicInvoice"> -
OSB+how to change content type header in http transport header.
I have a requirement where I need to change the value of:
<http:Content-Type>text/xml; charset=utf-8</http:Content-Type>
to the end system specific like:
<http:Content-Type>application/abcd-cvs-v1+xml; </http:Content-Type>
and the http:accept value to:
<http:Accept>application/abcd-cvs-v1+xml</http:Accept>
Can some one please explain how to do this.http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/userguide/context.html
Use replace action/insert on the follwoing QPath in trhe request action of the ServiceCallout/Routing as
$outbound/ctx:transport/ctx:request/tp:headers/http:Content-Type
$outbound/ctx:transport/ctx:request/tp:headers/http:Accept
Manoj -
Content type of .key files
Dear team ,
please tell me the "contenttype" of the .pages file format....
example: .doc....is having the content type as "application/ms-word"
similarly can u tell me content type of .pages
Regards,
spradeepkumarhi balusC thanks, it works very well.
your site http://balusc.xs4all.nl/srv/dev-jep-pdf.html helped me a lot.
But one point. There is another method : URLConnection.guessContentTypeFromStream(InputStream)but it don't work and i receive as result a null.
Is there another classes/methods which helps getting the content type of a file? not necessarily from sun. thanks
bye -
Convert XML file into PDF file
<b>XML to PDF</b>i want to Convert XML file into PDF file pl. any one can suggests API's
Hi,
There are many ways to convert XML files to PDFs through java.
One of the easiest way is by using iText.jar which have classes for conversion.
The following are the required steps
1. Create a document object for the XML file ( Using DOM or SAX parser).
2. Parse the xml document and extract the content to write in PDF.
3.Create a itext Document object.
4.Get a PdfWriter instance for the PDF file.
5.Write in the pdf the extracted text using the document object.
Refer <a href="http://itextdocs.lowagie.com/examples/com/lowagie/examples/general/HelloWorld.java">here</a> for a simple pdf writer example.
Refer <a href="http://java.sun.com/developer/codesamples/xml.html">here</a> for examples of XML Parsers.
Regards,
Uma -
Help on how to read the content of an XML file from the payload
I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
Im trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
In the Bean I want to read the content of the attached XML file, it could be the order number.
The filename should then be Order number.XML.
<u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
<i><b>Frank</b></i>hi,
check this: http://jakarta.apache.org/poi/ -
Load data in xml file into Pdf form created by LiveCycle Designer
I want to load data in xml file into Pdf form when Pdf opened and Form field will be filled with data from xml file .I try to use $host.importdata("filename.xml"); But i could not find suitable place to run my code. Can anyone give me some advice? thank you.
Hi,
extract your xml and then you can use insert all clause.
here's very small example on 10.2.0.1.0
SQL> create table table1(id number,val varchar2(10));
Table created.
SQL> create table table2(id number,val varchar2(10));
Table created.
SQL> insert all
2 into table1 values(id,val)
3 into table2 values(id2,val2)
4 select extractValue(x.col,'/a/id1') id
5 ,extractValue(x.col,'/a/value') val
6 ,extractValue(x.col,'/a/value2') val2
7 ,extractValue(x.col,'/a/id2') id2
8 from (select xmltype('<a><id1>1</id1><value>a</value><id2>2</id2><value2>b</value2></a>') col from dual) x;
2 rows created.
SQL> select * from table1;
ID VAL
1 a
SQL> select * from table2;
ID VAL
2 b Ants -
How to convert XML file to PDF
Hi there,
Does anyone know by any chance, how to covert XML file to PDF? ThanksHello,
You can convert most of the files in PDF by using the Print menu.
Open the file you want to save in PDF and choose in the menu bar File > Print....
You will see a will the Print window and at the left, click on the PDF button.
Choose in the menu “Save as PDF...”
Insert the name and you can also set security settings (like a password) and click on the “Save” button.
Hope this will help.
EDIT : (oups, dsimagry posted as the same time of me) -
How to change content type from Document set to Item
While creating content type I've selected Item as a parent but after created I can see its showing Document Set as a parent content type. Now can anyone please suggest if possible I can change the parent content type from Document Set to Item.
Hi,
From your description, I know you want to change content type’s parent after creating it.
There is no OOB method to change content type’s parent after you create it. If current content type has not been used, you could delete it and recreate it with your desired base type. Here are similar cases:
http://sharepoint.stackexchange.com/questions/16131/change-base-content-type-of-content-type
https://social.technet.microsoft.com/Forums/sharepoint/en-US/b976f17e-99b5-42bb-bc82-8d4123a625cf/change-the-parent-of-a-content-type.
This article may help you understand the relationship of Content type inheritance:
https://support.office.com/en-au/article/Create-and-edit-content-types-3d5d45af-608d-4183-8d51-073095fe0312#__toc239159103.
Best Regards
Vincent Han
TechNet Community Support -
FTP to Read content of Text/xml file
Hi,
I need a help for reading content of text/xml file through FTP. Below I just am explaining the scenario.
Our application server is in UNIX. Now we have to run a report program to access in to a FTP server which is in windows platform. Using FTP_CONNECT, FTP_COMMAND, FTP_DISCONNECT we are able to connect to FTP server and also able to copy files from FTP server to SAP application server. After copied in application server, we are able to read the content of the txt file in to internal table in ABAP program using OPEN DATASET. But our requirement is that we want to read the text or xml file content into internal table while accessing into FTP server from SAP application instead of after copying the file into application server.
So please help me to solve my problem.
-PkThank you Bala,
But can you help me what should I pass against FNAME and CHARACTER_MODE Import parameter? Should I pass the full path of the file with name or only I have to pass file name ? For example if my text file name in FTP Server is test.txt and the IP of the ftp server is 10.10.2.3 then should I pass the value against FNAME as '
10.10.2.3\xyz\text.txt' ? Here xyz is the name of the directory in C drive where test.txt is exist.
Please help me.
-pk
Maybe you are looking for
-
Ive had an iPad for a year or so, it's got tons of music on it. I recently got myself an iPhone. I read on here about how to set up a completely separate library using my same account (as my iphone couldn't possibly hold the same amount as my pad I t
-
Calculation of Perk value for Housing Deposits
Our Company is offering Security Deposits for housing (mainly in case of Mumbai Employees) as Interest free loans and getting it recovered in 36 instalments. The perk value as per IT rules shall be added in the annual gross salary of the employee.St
-
Using Acrobat Pro, we need to use a small field to track student progress. With successive mouse clicks, the field would cycle through: -- a number (that identifies an element of study), -- same number surrounded by a circle (indicates element is a
-
Preventing automatic search results
I recently created a custom search form on a uix page that allows me to search for multiple conditions following a HOWTO from Oracle: http://www.oracle.com/technology/products/jdev/tips/shmeltzer/setwhereclause/uix.html It works great, but when I log
-
Does jsp in OAS 4.0.8.1 supports Multiple Language?
Hi, I've tried using encoding=Big5 for chinese rendering but it throws an UnsupportedEncodingException. Any idea if jsp in OAS supports this? Thanks. regards, Hong Seng