Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello,
I am trying to fetch attached files from Integrity 10.6 server using soap requests.
I tested SoapUI 5.2.1 from SmartBear
Our Integrity web service location looks something like http://server:port/webservices/10/2/Integrity/
But whenever the filename contains a + character, the downloaded size is 0 (see also below in red colour what SoapUI responds)
Example of file names having this problem:
T+S.txt
Moto+S.docx
I tried both text files and binary files
For other attached file names, without a + character in their names, I can successfully download the files, without problems.
(e.g. ABC.pdf or SomeImage.png)
The request in SoapUI looks like this for T+S.txt
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://webservice.mks.com/10/2/Integrity" xmlns:sch="http://webservice.mks.com/10/2/Integrity/schema">
<soapenv:Header/>
<soapenv:Body>
<int:fetchAttachments>
<!--Optional:-->
<arg0 transactionId="?" AttachmentName="T+S.txt" FieldName="Attachments" sch:ItemId="122925">
<sch:Username>myusername</sch:Username>
<sch:Password>mypassword</sch:Password>
</arg0>
</int:fetchAttachments>
</soapenv:Body>
</soapenv:Envelope>
The response in SoapUI looks like this for T+S.txt
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns3:fetchAttachmentsResponse xmlns:ns1="http://webservice.mks.com/10/2/Integrity/schema" xmlns:ns3="http://webservice.mks.com/10/2/Integrity">
<return>
<ns1:Attachment>
<xop:Include href="cid:Attachment-d4cd8052-95e6-44e2-86dc-4528fbba28f1@ws.jboss.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
</ns1:Attachment>
</return>
</ns3:fetchAttachmentsResponse>
</env:Body>
</env:Envelope>
Transfer-Encoding | chunked |
Date | Wed, 24 Aug 2016 11:51:52 GMT |
#status# | HTTP/1.1 200 OK |
Content-Type | multipart/related; type="application/xop+xml"; start=""; start-info="text/xml"; boundary="----=_Part_3130_1893697822. 1472039512407" |
Server | PTC Integrity Server |
Name Content-Type Size Part
Attachment-d4cd8052-95e6-44e2-86dc-4528fbba28f1@ws.jboss.org | text/plain | 0 | Attachment-d4cd8052-95e6-44e2-86dc-4528fbba28f1@ws.jboss.org | XOP |
2. Something similar happens if I try to download such files having a + character inside their file name, using a Java SOAP web service client.
I get the following runtime error :
24-Aug-2016 14:40:48, Internal_Error, com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException: Reached EOF, but there is no closing MIME boundary.
at com.sun.xml.internal.org.jvnet.mimepull.MIMEParser.readBody(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.MIMEParser.access$600(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.MIMEParser$MIMEEventIterator.next(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.MIMEMessage.makeProgress(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.DataHead.read(Unknown Source)
at com.sun.xml.internal.org.jvnet.mimepull.MIMEPart.read(Unknown Source)
at com.sun.xml.internal.ws.encoding.MIMEPartStreamingDataHandler$StreamingDataSource.getInputStream(Unknown Source)
import javax.activation.DataHandler;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
AttachmentRequest arg = new AttachmentRequest();
arg.setUsername(userName);
arg.setPassword(password);
arg.setAttachmentName(attachmentName);
arg.setFieldName(fieldName);
arg.setItemId(BigInteger.valueOf(itemID));
AttachmentContents atc = ws.getEndPoint().fetchAttachments(arg);
DataHandler dh = atc.getAttachment();
DataSource ds = dh.getDataSource();
ds.getName() -> I see the name
ds.getContentType() -> I see the content type
ds.getInputStream() -> when I try to read the input stream, I get the exception above
Any hint ? Thanks !
Solved! Go to Solution.
Hi Alexandru,
Unfortunately, this is an identified defect, SPR # 5345732.
Here is the knowledge article related to it:
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS209386
If you want to be attached to the SPR, open a case with Support, and they can do this for you.
Hi Alexandru Matei,
have you tried replacing the "+" with the HTML Code?
"T� 43;S.txt"
(Without the blank)
Regards,
Dominik
Hello
I tried and rewrote the request like this in SoapUI
<arg0 transactionId="?" AttachmentName="T+S.txt" FieldName="Attachments" sch:ItemId="122925">
The result is the same, the download size still appears to be zero. I will try another web service SOAP Client too, a C# based one
Hi Alexandru,
Unfortunately, this is an identified defect, SPR # 5345732.
Here is the knowledge article related to it:
https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS209386
If you want to be attached to the SPR, open a case with Support, and they can do this for you.