Hi,
I have to send 2 xml files to a server with post.
Actualy is a Wap Push message (PAP & SI)
I must use multipart/related (to send both xml files with one post)
I have read about boundary. I try that
VB Code:
Set oHttp = New XMLHTTP boundary = "asdlfkjiurwghasf" oHttp.open "POST", "http://someserver.com/", False ', "login", "passwd" oHttp.setRequestHeader "Content-Type", "multipart/related; type=application/xml; boundary=" & boundary strBody = "" 'PAP strBody = "--" & boundary & vbCrLf strBody = strBody & "Content-Type: application/xml" & vbCrLf & vbCrLf strBody = strBody & "<?xml version=##1.0##?>" & vbCrLf strBody = strBody & "<!DOCTYPE pap PUBLIC ##-//WAPFORUM//DTD PAP 1.0//EN## ##http://www.wapforum.org/DTD/pap_1.0.dtd##>" & vbCrLf strBody = strBody & "<pap>" & vbCrLf strBody = strBody & "<push-message push-id=##[email protected]## deliver-before-timestamp=##2020-12-20T16:54:45Z## deliver-after-timestamp=##2001-01-22T16:57:32Z##>" & vbCrLf strBody = strBody & "<address address-value=##w*****h=3069955441122/[email protected]## />" & vbCrLf strBody = strBody & "<quality-of-service priority=##medium## delivery-method=##unconfirmed## bearer=##SMS##/>" strBody = strBody & "</push-message>" & vbCrLf strBody = strBody & "</pap>" & vbCrLf & vbCrLf strBody = strBody & "--" & boundary & vbCrLf 'SI 'strBody = strBody & "Content-Type: application/xml" & vbCrLf & vbCrLf strBody = strBody & "Content-Type: text/vnd.wap.si; charset=ISO-8859-7" & vbCrLf & vbCrLf strBody = strBody & "<?xml version=##1.0##?>" & vbCrLf strBody = strBody & "<!DOCTYPE si PUBLIC ##-//WAPFORUM//DTD SI 1.0//EN## ##http://www.wapforum.org/DTD/si.dtd##>" & vbCrLf strBody = strBody & "<si>" & vbCrLf strBody = strBody & "<indication href=##[url]http://someserver.com/videos/sample.3gp##[/url] si-id=##[email protected]## created=##2002-10-30T20:18:43Z## si-expires=##2020-12-20T16:54:45Z## action=##signal-high##>" & vbCrLf strBody = strBody & "New video" & vbCrLf strBody = strBody & "</indication>" & vbCrLf strBody = strBody & "</si>" & vbCrLf & vbCrLf strBody = strBody & "--" & boundary & "--" & vbCrLf strBody = Replace$(strBody, "##", Chr$(34)) aPostData = StrConv(strBody, vbFromUnicode) oHttp.send aPostData MsgBox oHttp.responseText
Is that the correct way to built a multipart post?
thanks in advance



Reply With Quote