我收到错误:收到的文件没有收到 docFile = CrystalReport1.pdf 代码是vb.net
本准则:
Dim requestBodyStart As String = asciCR + asciLN + asciCR + asciLN + "--BOUNDARY" + asciCR + asciLN + _ "Content-Type: application/xml" + asciCR + asciLN + _ "Content-Disposition: form-data" + asciCR + asciLN + _ asciCR + asciLN + _ xmlBody + asciCR + asciLN + asciCR + asciLN + "--BOUNDARY" + asciCR + asciLN + _ "Content-Type: application/pdf" + asciCR + asciLN + _ "Content-Disposition: file; filename=" + docFile + " \ documentId=1" + asciCR + asciLN + _ asciCR + asciLN Dim requestBodyEnd As String = asciCR + asciLN + "--BOUNDARY--" + asciCR + asciLN + asciCR + asciLN
制作此请求:
--BOUNDARY
Content-Type: application/xml
Content-Disposition: form-data
<envelopeDefinition xmlns="http://www.docusign.com/restapi"><status>sent</status><emailSubject>DocuSign API - Embedded Signing example</emailSubject><documents><document><documentId>1</documentId><name>\\10.1.11.100\SecureDocs\EnrollmentForms\CrystalReport1.pdf</name></document></documents><recipients><signers><signer><recipientId>1</recipientId><email>hmitchell@ata.edu</email><name>Alexandra Adams</name><tabs><signHereTabs><signHere><xPosition>100</xPosition><yPosition>100</yPosition><documentId>1</documentId><pageNumber>1</pageNumber></signHere></signHereTabs></tabs></signer></signers></recipients></envelopeDefinition>
--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename=\CrystalReport1.pdf \ documentId=1
%PDF-1.7
%����
1 0 obj
<<
/Type /Catalog
/Pages 2 0 R
/PageMode /UseNone
/ViewerPreferences <<
/FitWindow true
/PageLayout /SinglePage
/NonFullScreenPageMode /UseNone
>>
(Continued Code Until:)
--BOUNDARY--
感谢您的帮助!
答案 0 :(得分:1)
我不确定这只是你的帖子的间距问题,但你的开放边界之前有额外的前导空格不应该存在:
--BOUNDARY
Content-Type: application/xml
Content-Disposition: form-data
我看到的下一个更有可能导致错误的问题是你在Content-Disposition标题中指定filename
- 你有转义字符(\)但是缺少实际的转义序列,这意味着你正在转义文件名的第一个字符。
Content-Disposition: file; filename=\CrystalReport1.pdf \ documentId=1
相反,你需要这样的东西:
Content-Disposition: file; filename=\"CrystalReport1.pdf\"; documentid=1