I have the same problem described here on the e-office blog , but in my case it also happens in IE9. When I manually do a refresh of the page, everything is working again. It looks like the JS aggregator tries to do something with the javascript files.
Does anyone found a solution for this?
This is the way I load my client javascript files. The 'xast.locationJS' variable is the location on the server where I the javascript files can be found.
<xp:this.resources>
<xp:script clientSide="true">
<xp:this.src><![CDATA[${javascript:return applicationScope.get("xast.serverUrl") +"/" +applicationScope.get("xast.locationJS") + "/jquery-1.5.1.min.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[${javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/jquery.hoverIntent.minified.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[${javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/jquery.tools.min.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[${javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/jquery-ui-1.8.14.custom.min.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[#{javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/C2C_dojo.tools.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[#{javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/CommonXmlFunctions.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[#{javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/C2C_WebCaseSuggest.js"}]]></xp:this.src>
</xp:script>
<xp:script clientSide="true">
<xp:this.src><![CDATA[${javascript:return applicationScope.get("xast.serverUrl") + "/" + applicationScope.get("xast.locationJS") + "/uncompressed/xpUtils.js"}]]></xp:this.src>
</xp:script>
</xp:this.resources>
It looks like the 'compute on page load' property was the problem. I think libraries that are computed on page load wil be automatically picked up by the JS aggregator, or something like that.
Related
I've read the documentation about sending RAW xml request here: https://www.npmjs.com/package/soap#example-with-xml-string-for-the-args
And there is a example at the mentioned documentation:
var args = { _xml: "<ns1:MyRootElement xmlns:ns1="http://www.example.com/v1/ns1">
<ChildElement>elementvalue</ChildElement>
</ns1:MyRootElement>"
};
I've did the same, and defined my args but I could not get org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 390; The content of elements must consist of well-formed character data or markup. error message from SOAP server
Here is my args definition:
let args = {
_xml: '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
+ '<SOAP-ENV:Body>'
+ '<ns1:enqueue>'
+ '<domain xsi:type="xsd:string">XXXXDOMAINXXXX</domain>'
+'<messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">Hello</item>'
+ '</messageBodies>'
+ '<recipientNumbers SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">0936XXXX</item>'
+ '<item xsi:type="xsd:string">0918XXXX</item>'
+ '</recipientNumbers>'
+ '<senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">3000XXX</item>'
+ '</senderNumbers>'
+ '<encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<priorities xsi:type="SOAP-ENC:Array" />'
+ '<checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:long">102</item>'
+ '<item xsi:type="xsd:long">103</item>'
+ '</checkingMessageIds>'
+ '</ns1:enqueue>'
+ '</SOAP-ENV:Body>'
+ '</SOAP-ENV:Envelope>'
}
When I try to console.log(client.lastRequest) it will return this:
last request: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:impl="http://magfa.com/soap/SOAPSmsQueue" xmlns:intf="http://magfa.com/soap/SOAPSmsQueue" xmlns:tns1="urn:SOAPSmsQueue" xmlns:ns1="http://magfa.com/soap/SOAPSmsQueue"><soap:Header></soap:Header><soap:Body><impl:enqueue>**<$value>**<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:enqueue><domain xsi:type="xsd:string">XXXXXDOMAINXXXX</domain><messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">Hello</item></messageBodies><recipientNumbers SOAP-ENC:arrayType="xsd:string[2]"
xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">09367xxxx</item><item xsi:type="xsd:string">09189xxxx</item></recipientNumbers><senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:string">3000xxxx</item></senderNumbers><encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" /><udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" /><messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" /><priorities xsi:type="SOAP-ENC:Array" /><checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array"><item xsi:type="xsd:long">102</item><item xsi:type="xsd:long">103</item></checkingMessageIds></ns1:enqueue></SOAP-ENV:Body></SOAP-ENV:Envelope>**</$value>**</impl:enqueue></soap:Body></soap:Envelope>
Is there any way to send this
You can send raw XML using the $xml key:
let args = {
$xml: '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://WSDLPROVIDER" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'
+ '<SOAP-ENV:Body>'
+ '<ns1:enqueue>'
+ '<domain xsi:type="xsd:string">XXXXDOMAINXXXX</domain>'
+'<messageBodies SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">Hello</item>'
+ '</messageBodies>'
+ '<recipientNumbers SOAP-ENC:arrayType="xsd:string[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">0936XXXX</item>'
+ '<item xsi:type="xsd:string">0918XXXX</item>'
+ '</recipientNumbers>'
+ '<senderNumbers SOAP-ENC:arrayType="xsd:string[1]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:string">3000XXX</item>'
+ '</senderNumbers>'
+ '<encodings xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<udhs xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<messageClasses xsi:nil="true" xsi:type="SOAP-ENC:Array" />'
+ '<priorities xsi:type="SOAP-ENC:Array" />'
+ '<checkingMessageIds SOAP-ENC:arrayType="xsd:long[2]" xsi:type="SOAP-ENC:Array">'
+ '<item xsi:type="xsd:long">102</item>'
+ '<item xsi:type="xsd:long">103</item>'
+ '</checkingMessageIds>'
+ '</ns1:enqueue>'
+ '</SOAP-ENV:Body>'
+ '</SOAP-ENV:Envelope>'
}
I've referenced this post
https://stackoverflow.com/a/42143198
as well as the node-soap code where it declares an XML key:
public xmlKey = '$xml';
I am just unable to figure out how shaka player is able to decrypt my CENC protected content even though I am providing invalid decryption keys in player config.
player.configure({
drm: {
clearKeys: {
'6FepeJBbmaiozSMs18vPfA==': '6FepeJBbmaiozSMs18vPfA==', // ==> invalid key
'6FepeJBbmaiozSMs18vPfA==': '6FepeJBbmaiozSMs18vPfA==', // ==> invalid key
}
}
})
and here is the arguments given to packager
packager in=video-SD.webm,stream=audio,output=protected_audio.webm,drm_label=AUDIO in=video-HD.
webm,stream=video,output=protected_video_HD.webm,drm_label=HD in=video-SD.webm,stream=video,output=prote
cted_video_SD.webm,drm_label=SD --enable_raw_key_encryption --enable_raw_key_decryption \
--keys label=AUDIO:key_id=f3c5e0361e6654b28f8049c778b23946:key=a4631a153a443df9eed0593043db7519, label=SD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392,label=HD:key_id=abba271e8bcf552bbd2e86a434a9a5d9:key=69eaa802a6763af979e8d1940fb88392 \
--base_urls https://s3-eu-west-1.amazonaws.com/dash/ \
--mpd_output h264.mpd
mpd file looks like
<?xml version="1.0" encoding="UTF-8"?>
<!--Generated with https://github.com/google/shaka-packager version 72c4797-release-->
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd" xmlns:cenc="urn:mpeg:cenc:2013" profiles="urn:mpeg:dash:profile:isoff-on-demand:2011" minBufferTime="PT2S" type="static" mediaPresentationDuration="PT5.539000034332275S">
<BaseURL>https://s3-eu-west-1.amazonaws.com/dash/</BaseURL>
<Period id="0">
<AdaptationSet id="0" contentType="audio" lang="en" subsegmentAlignment="true">
<ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" cenc:default_KID="f3c5e036-1e66-54b2-8f80-49c778b23946">
<cenc:pssh>AAAAVHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAPzxeA2HmZUso+AScd4sjlGq7onHovPVSu9LoakNKml2au6Jx6Lz1UrvS6GpDSppdkAAAAA</cenc:pssh>
</ContentProtection>
<Representation id="0" bandwidth="96897" codecs="vorbis" mimeType="audio/webm" audioSamplingRate="44100">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
<BaseURL>protected_audio.webm</BaseURL>
<SegmentBase indexRange="4601-4619" timescale="1000000" presentationTimeOffset="3000">
<Initialization range="0-4600"/>
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="1" contentType="video" width="560" height="320" frameRate="1000000/33000" subsegmentAlignment="true" par="7:4">
<ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" cenc:default_KID="abba271e-8bcf-552b-bd2e-86a434a9a5d9">
<cenc:pssh>AAAAVHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAPzxeA2HmZUso+AScd4sjlGq7onHovPVSu9LoakNKml2au6Jx6Lz1UrvS6GpDSppdkAAAAA</cenc:pssh>
</ContentProtection>
<Representation id="1" bandwidth="553816" codecs="vp8" mimeType="video/webm" sar="1:1">
<BaseURL>protected_video_HD.webm</BaseURL>
<SegmentBase indexRange="336-354" timescale="1000000" presentationTimeOffset="3000">
<Initialization range="0-335"/>
</SegmentBase>
</Representation>
</AdaptationSet>
<AdaptationSet id="2" contentType="video" width="560" height="320" frameRate="1000000/33000" subsegmentAlignment="true" par="7:4">
<ContentProtection schemeIdUri="urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b" cenc:default_KID="abba271e-8bcf-552b-bd2e-86a434a9a5d9">
<cenc:pssh>AAAAVHBzc2gBAAAAEHfv7MCyTQKs4zweUuL7SwAAAAPzxeA2HmZUso+AScd4sjlGq7onHovPVSu9LoakNKml2au6Jx6Lz1UrvS6GpDSppdkAAAAA</cenc:pssh>
</ContentProtection>
<Representation id="2" bandwidth="561429" codecs="vp09.00.21.08.01.01.01.01.00" mimeType="video/webm" sar="1:1">
<BaseURL>protected_video_SD.webm</BaseURL>
<SegmentBase indexRange="366-384" timescale="1000000" presentationTimeOffset="3000">
<Initialization range="0-365"/>
</SegmentBase>
</Representation>
</AdaptationSet>
</Period>
</MPD>
Either you or someone else asked a similar question on our GitHub page here. It is preferable to ask questions on our GitHub page.
The problem is that asset isn't actually encrypted. It has a clear lead, so the first few seconds aren't actually encrypted. On the GitHub question they explicitly passed --clear-lead 6; but this doesn't pass anything, so Shaka Packager defaults to 10 seconds. This asset is only 6 seconds long, so nothing is encrypted.
I have a VB script that is supposed to grab a specific list item from SharePoint 2013 via web services.
Relevant code:
Dim response, request, colItem, objItem
Dim fileSystem: Set fileSystem = CreateObject("Scripting.FileSystemObject")
request = "<?xml version='1.0' encoding='utf-8'?>" & _
"<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _
" <soap:Body>" & _
" <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>" & _
" <listName>{FC3E18D6-33E5-4032-BE4B-F0F92F6F18BA}</listName>" + _
" <viewName>{2861DF9F-11F8-4E4B-A318-D4D37C1C5169}</viewName>" + _
" <query></query>" & _
" </GetListItems>" & _
" </soap:Body>" & _
"</soap:Envelope>"
http.open "POST", "http://<redacted>/_vti_bin/Lists.asmx", False
http.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
http.setRequestHeader "Content-Length", Len(request)
http.setRequestHeader "SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/GetListItems"
http.send request
However, it is just returning the same page that I see if I navigate directly to .../_vti_bin/Lists.asmx, which is the list of supported operations. If I click on "GetListItems", the example XML it provides looks like what I have in the VB script, except for a few parameters which I believe are optional:
POST /_vti_bin/Lists.asmx HTTP/1.1
Host: <redacted>
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://schemas.microsoft.com/sharepoint/soap/GetListItems"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>string</listName>
<viewName>string</viewName>
<query>string</query>
<viewFields>string</viewFields>
<rowLimit>string</rowLimit>
<queryOptions>string</queryOptions>
<webID>string</webID>
</GetListItems>
</soap:Body>
</soap:Envelope>
I have Googled around and been unable to find what I am doing wrong.
Thanks
Instead of GUID try using the regular names of the list and views for the listName and viewName XML elements.
<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>My List</listName>
<viewName>All Items</viewName>
</GetListItems>
Here's a sample code I used on my SP 2013 site with jQuery.
$.ajax({
type: "POST",
contentType: "text/xml; charset=utf-8",
url: "https://site/_vti_bin/Lists.asmx",
data: '<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <listName>My Test Cases</listName> </GetListItems> </soap:Body> </soap:Envelope>',
dataType: "xml",
success: function (msg) {
console.log(msg);
},
error: function (data, status, error) {
console.log('error');
}
});
See Updated XML. It has changed the output but still not quite right. Now it uploads doc1 and applies template correctly and inserts templates 2 & 3 in the correct location, however doc2 & doc3 are not there. Just the document that was used to create the template.
<compositeTemplates>
<compositeTemplate>
<compositeTemplateId>1</compositeTemplateId>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>6A68F081-643D-4DAC-8660-3CC0D59166D5</templateId>
</serverTemplate>
</serverTemplates>
<document>
<documentId>1</documentId>
<name>doc1</name>
</document>
</compositeTemplate>
<compositeTemplate>
<compositeTemplateId>2</compositeTemplateId>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>F2807DA5-89E0-445A-BE32-98951C7AD9F0</templateId>
<compositeTemplateId>2</compositeTemplateId>
</serverTemplate>
</serverTemplates>
<document>
<documentId>2</documentId>
<name>doc2</name>
</document>
</compositeTemplate>
<compositeTemplate>
<compositeTemplateId>3</compositeTemplateId>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>B9377A6C-BC24-4175-B749-81629E977C26</templateId>
<compositeTemplateId>3</compositeTemplateId>
</serverTemplate>
</serverTemplates>
<document>
<documentId>3</documentId>
<name>doc3</name>
</document>
</compositeTemplate>
</compositeTemplates>
also changed Content-Dispositon
"Content-Disposition: file; filename=\"" + fileName + "\";documentId=1; compositeTemplateId=1\r\n\r\n";
"Content-Disposition: file; filename=\"" + fileName + "\";documentId=2; compositeTemplateId=2\r\n\r\n";
"Content-Disposition: file; filename=\"" + fileName + "\";documentId=3; compositeTemplateId=3\r\n\r\n";
This is REST using XML for payload rather than JSON. In the DocuSign REST API, using compositeTemplates with multi-part form contribution of documents gets a little tricky when applying server templates to those documents. The server template's tabs are assigned to documentId=1. Therefore, you must do the same. To properly map the document contributed by each composite to the correct document contributed per multi-part form, you must use compositeTemplateId.
For each element, add . Make the first one "1", second "2", third "3". Then, for each form where you attach the documents, add the "compositeTemplateId=n" (where n= 1, 2, or 3) to that form's Content-Disposition.
e.g.:
--BOUNDARY
Content-Disposition: file; documentid=1; name="Option2"; filename="Option2.pdf"; compositeTemplateId=2
Content-Type: application/pdf
I am getting the error:
An error was found while parsing the multipart request. Boundary terminator '--BOUNDARY--' was not found in the request.
I have tried debugging with Firefox and chrome with same results.
Any help would be greatly appreciated.
Here is the code I am using:
Public Sub configureMultiPartFormDataRequest(ByVal request As HttpWebRequest, _
ByVal xmlBody As String, _
ByVal docName As String)
'Overwrite the default content-type header and set a boundary marker
request.ContentType = "multipart/form-data; boundary=BOUNDARY"
'Start building the multipart request body
Dim requestBodyStart As String = "\r\n\r\n--BOUNDARY\r\n" + _
"Content-Type: application/xml\r\n" + _
"Content-Disposition: form-data\r\n" + _
"\r\n" + _
xmlBody + "\r\n\r\n--BOUNDARY\r\n" + _
"Content-Type: application/pdf\r\n" + _
"Content-Disposition: file; filename=\" + docName + " \ documentId=1\r\n" + _
"\r\n"
Dim requestBodyEnd As String = "\r\n--BOUNDARY--\r\n\r\n"
'Read the contents of provided document into the request stream
Dim fileStream As FileStream = File.OpenRead(docName)
'Write the body of the request
Dim bodyStart() As Byte = System.Text.Encoding.UTF8.GetBytes(requestBodyStart.ToString())
Dim bodyEnd() As Byte = System.Text.Encoding.UTF8.GetBytes(requestBodyEnd.ToString())
Dim dataStream As Stream = request.GetRequestStream()
dataStream.Write(bodyStart, 0, requestBodyStart.ToString().Length)
'Read the file contents and write them to the request stream. (4096 Byte Blocks)
Dim buf(4096) As Byte
'Dim len As Integer
'While ((len = fileStream.Read(buf, 0, 4096)) > 0)
' dataStream.Write(buf, 0, len)
'End While
Dim bytesRead As Integer
Do
bytesRead = fileStream.Read(buf, 0, buf.Length)
If bytesRead > 0 Then
dataStream.Write(buf, 0, bytesRead)
End If
Loop While bytesRead > 0
dataStream.Write(bodyEnd, 0, requestBodyEnd.ToString().Length)
dataStream.Close()
End Sub
Added 05/09/2014
Here is the actual request text from Fiddler2. It appears that the bodyEnd is being set to "PDF-1.7". I have searched the code for this string without success. Thanks for your help: \r\n\r\n--BOUNDARY\r\nContent-Type: application/xml\r\nContent-Disposition: form-data\r\n\r\nsentDocuSign API - Embedded Signing example1\10.1.11.100\SecureDocs\EnrollmentForms\CrystalReport1.pdf1hmitchell#ata.eduA Adams10010011\r\n\r\n--BOUNDARY\r\nContent-Type: application/pdf\r\nContent-Disposition: file; filename=\XXX\; documentId=1\r\n\r\n%PDF-1.7
David
Thanks for your fix for the BOUNDARY error. I implemented your xml example and now get an error: "The document element did not contain the encoded document, or there is a problem with the encoding."
Here is the request:
--BOUNDARY
Content-Type: application/xml
Content-Disposition: form-data
sentDocuSign API - Embedded Signing example1C:\Hold\myXML.xml1hmitchell#ata.eduA Adams10010011
--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename=\C:\Hold\myXML.xml \ documentId=1
<nameValue>
<name>canManageAccount</name>
<value>false</value>
</nameValue>
--BOUNDARY--
Thanks for your help!!!
Your code snippet above is missing the calling method so I made my own as shown below to demonstrate how to leverage WebHookapp endpoint to capture what is being sent. So I think you will see that the body is not formatted correctly due to the fact you tried to "escape" the line breaks and carriage return values vs using the chr with the correct value.
Code I added to call you above method
Imports System.IO
Imports System.Net
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim myHTTPRequest As System.Net.HttpWebRequest = WebRequest.Create("http://webhookapp.com/1037371688646089664")
Dim myXML As String = "{SomeXMLorJason: sampleNotFormatedcorrectly}"
Dim myDocName As String = "c:\myXML.xml"
myHTTPRequest.Method = "POST"
configureMultiPartFormDataRequest(myHTTPRequest, myXML, myDocName)
myHTTPRequest.GetResponse()
End Sub
'Your Code goes here ---> from above:
End Class
What is in the file c:\myXML.xml
<nameValue>
<name>canManageAccount</name>
<value>false</value>
</nameValue>
What was sent:
POST /1037371688646089664
content-type multipart/form-data; boundary=BOUNDARY
host webhookapp.com
content-length 439
expect 100-continue
connection Keep-Alive
\r\n\r\n--BOUNDARY\r\nContent-Type: application/xml\r\nContent-Disposition: form-data\r\n\r\n{SomeXMLorJason: sampleNotFormatedcorrectly}\r\n\r\n--BOUNDARY\r\nContent-Type: application/pdf\r\nContent-Disposition: file; filename=\c:\myXML.xml \ documentId=1\r\n\r\n <nameValue>
<name>canManageAccount</name>
<value>false</value>
</nameValue>\r\n--BOUNDARY--\r\n\r\n
What to do to fix your code:
'Start building the multipart request body
' http://www.asciitable.com/
Dim asciLN As String = Chr(10)
Dim asciCR As String = Chr(13)
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=\" + docName + " \ documentId=1" + asciCR + asciLN + _
asciCR + asciLN
Dim requestBodyEnd As String = asciCR + asciLN + "--BOUNDARY--" + asciCR + asciLN + asciCR + asciLN
Which will yield:
POST /1037371688646089664
content-type multipart/form-data; boundary=BOUNDARY
host webhookapp.com
content-length 409
expect 100-continue
connection Keep-Alive
--BOUNDARY
Content-Type: application/xml
Content-Disposition: form-data
{SomeXMLorJason: sampleNotFormatedcorrectly}
--BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename=\c:\myXML.xml \ documentId=1
<nameValue>
<name>canManageAccount</name>
<value>false</value>
</nameValue>
--BOUNDARY--
And a general envelope in JSON as Multipart should look like below:
POST http://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: multipart/form-data; boundary=AAA
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"status":"sent",
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject - EnvelopeDefFull",
"documents": [{
"name": "test1.pdf",
"documentId":"1"
"order":"1"
}],
"recipients": {
"signers" : [{
"email": "test#email.com",
"name": "Sally Doe",
"recipientId":"1",
}]
}
}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="test1.pdf";documentid=1
<document bytes removed>
--AAA--
Generally speaking your request should look like the following. The only difference is that this example used JSON format instead of XML. Only change you need to make is changing application/json to application/xml for the Content-Type, then change the JSON data to XML format instead.
POST http://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: multipart/form-data; boundary=AAA
--AAA
Content-Type: application/json
Content-Disposition: form-data
{
"status":"sent",
"emailBlurb":"Test Email Body",
"emailSubject": "Test Email Subject - EnvelopeDefFull",
"documents": [{
"name": "test1.pdf",
"documentId":"1"
"order":"1"
}],
"recipients": {
"signers" : [{
"email": "test#email.com",
"name": "Sally Doe",
"recipientId":"1",
}]
}
}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="test1.pdf";documentid=1
<document bytes removed>
--AAA--
Without seeing the actual request that your code is constructing and sending I can only assume something is wrong with the formatting. Ensure that you have extra newlines (CRLF) where needed and that the document bytes are correctly being written to the request. If you're still stuck you might want to run through a tool such as Fiddler to check the request data...