Question:
I am able to successfully send my request with Fiddler. I have made to my eye a exact situation in VBA with your References. But I keep getting a return response of an error.
Fiddler is good:
POST https://storage.sandbox.ebay.com/FileTransferService HTTP/1.1
Content-type: multipart/related;type="application/xop+xml"; start="<0.urn:uuid:3c50a4c8237211e793ae92361f002671>";start-info="text/xml"; boundary=MIMEBoundaryurn_uuid_3c50a23e237211e793ae92361f002671
X-EBAY-SOA-SERVICE-NAME: FileTransferService
X-EBAY-SOA-OPERATION-NAME: uploadFile
X-EBAY-SOA-SECURITY-TOKEN: TOKEN HERE
X-EBAY-SOA-REQUEST-DATA-FORMAT: XML
X-EBAY-SOA-RESPONSE-DATA-FORMAT: XML
User-Agent: Fiddler
Host: storage.sandbox.ebay.com
Content-Length: 2706
--MIMEBoundaryurn_uuid_3c50a23e237211e793ae92361f002671
Content-Disposition: form-data; name="fieldNameHere"; filename="uploadFile.xml"
Content-Type: text/xml
Content-Transfer_Encoding: binary
Content-ID: <0.urn:uuid:3c50a4c8237211e793ae92361f002671>
<?xml version="1.0" encoding="UTF-8"?>
<uploadFileRequest xmlns="http://www.ebay.com/marketplace/services">
<taskReferenceId>50012962</taskReferenceId>
<fileReferenceId>50015519</fileReferenceId>
<fileFormat>gzip</fileFormat>
<fileAttachment>
<Data>
<xop:Include href="cid:urn:uuid:3c50a5ea237211e793ae92361f002671"
xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
</Data>
<Size>15</Size>
</fileAttachment>
</uploadFileRequest>
--MIMEBoundaryurn_uuid_3c50a23e237211e793ae92361f002671
Content-Disposition: form-data; name="fieldNameHere"; filename="AFPIBulkTest1.gz"
Content-Type: application/x-gzip
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:3c50a5ea237211e793ae92361f002671>
X AFPIBulkTest1.xml Y_o 0G ;X}@ A m u 3`b n R ,|z IڴqZH Ce ~w > }N f 4 y H2.f [ W uZ/»w ^PC n 93 h
( &4}J \? E j R
F _ (ek _ 1' ^Q Í A ^Q*1 e> 2 ) E /Ig ^ * O 4 s * R4 3?3 ,Dh Vm\qCاH_|# } y ; I_ b IO# N Cz1 L jq :R|i x \ k ,N " ܋ͳɽ y O Zm/SH (* pA c D ^') /` A 3ʚ % Ξ 4| , " Z @" c V3 K Z $ 0 ە'c ŧ< v>t W:^ Qb X J b uA :ʦ ĺ Bɟ > M ; ` Cj@q74ݽxt h $ % a G~ o> Pe} *]6 [# 3 c ? 8n i B bw n 5 x
(
> CM] [ 0 tN l Ɔ* E } e[ v 8W,4* + e x 5F Ib@ Ly R0n' H6 p=FX^v Rx Z AE͉ C W|Cz^ q A h /GH "ءg F } j)s\
< SJ X 8J9 l ! lZ % z; ءpM $
ٹ < 5 H3 E9 6 : ˋpn -Ҷ { 塏Ϡ u9
vR % )^ n b 5 c If C $2 ʪzx y? rɸ 3a
4 A ^ C5麛ٍ"XV .D !| , *S bgP{I 4 ydף~ y O| q aK K p 7 y [K n ; o nab .< (N H D{LA
0 / ,* *W7 + & z m ]] N <M # Pa I C U
!b$c^ \ ; ^- 4+ ӡ e
{x| f E+ pW 7 Qޗ L ^Z`{I
* \ >> . _| qv* A ݬ(1s Ѧ-T? L ` C M "%213i 1)] Xl h ) 8 } YL Ԛ& ^ = >RR ߕ B 2# "
< ] ! -_ٓf㮈\ h 0 I . 6GI @ I.O T c
.
ZK ۻf咎 } @5^ } Zp - " ][_ y O e i s m ' :eS | fT W i - G7{ r b - e V w V G* !r N h E *En Y x҄ }9 %b . o. Dt m ~ 3 - 7 nk b"ф *- WV W x g
a
ye ' #
Uz(X7
--MIMEBoundaryurn_uuid_3c50a23e237211e793ae92361f002671--
But in VBA I get Error:
POST /FileTransferService HTTP/1.1
Content-Type: multipart/related;type="application/xop+xml";start="<0.urn:uuid:bb47b766237311e793ae92361f002671>";start-info="text/xml"; boundary=------------070800040307060505030901
X-EBAY-SOA-SERVICE-NAME: FileTransferService
X-EBAY-SOA-OPERATION-NAME: uploadFile
X-EBAY-SOA-SECURITY-TOKEN: Token Here
X-EBAY-SOA-REQUEST-DATA-FORMAT: XML
X-EBAY-SOA-RESPONSE-DATA-FORMAT: XML
User-Agent: Surpius
Host: storage.sandbox.ebay.com
Content-Length: 2657
--------------070800040307060505030901
Content-Disposition: form-data; name="uploadFile.xml"; filename="uploadFile.xml"
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:bb47b766237311e793ae92361f002671>
<?xml version="1.0" encoding="UTF-8"?>
<uploadFileRequest xmlns="http://www.ebay.com/marketplace/services">
<taskReferenceId>50012994</taskReferenceId>
<fileReferenceId>50015563</fileReferenceId>
<fileFormat>gzip</fileFormat>
<fileAttachment>
<Data>
<xop:Include href="cid:urn:uuid:bb47b86a237311e793ae92361f002671"
xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
</Data>
<Size>15</Size>
</fileAttachment>
</uploadFileRequest>
--------------070800040307060505030901
Content-Disposition: form-data; name="AFPIBulkTest1.gz"; filename="AFPIBulkTest1.gz"
Content-Type: application/x-gzip
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:bb47b86a237311e793ae92361f002671>
‹ÌÝìX AFPIBulkTest1.xml ½Y_oÓ0Gâ;X}@ A“m°uý3`b…²n ñ‚ÜøÚR»Ø,|zÎIÚ´qZHëCeû~wþÙ>Ÿ}Nðâf“ 4—âyë í·ˆH2.fÏ[×W¯uZ/»w‚^PCÏn¢93¸„ï h£ êý¼•(ñ&4}J—\?…ÞEjèËÅR
F·ÐÁ_ð(ek•_ð1'žŸ^Q©Ã¹óAè^Q*1·e>è2öŠß )Á¹EÁú/Ig¶¬ú^Úþ“*í’òÛëðÍÀ÷O4–«âsñ»“*½R4ú†3?3—,DhàíVm\qCاH_|#}òyüäØ;òI_Šb…IO#ÄN“Cz1Ú¼L¹jq :R|iìx®æ\“˜kƒý,N¥"”܋ͳɽ™yöOÝZm/SH´Œ™(*ð“pAÊc²D Ù^')¡‚Яø/`„Aµ3Êš±%ÆΞ·4|Ÿ,õ"ÝZ‰Ä@"ˆcV3ÿöK¡Z—æ$’‚Ûá0“Û•'c´Å§<¢v>tÆÝÌW:^©¾QbÙÔÈXªÃJ ‰bªuA“á¶Ê:ʦ¥Äº¦·Ô ýBÉŸíþ>ŸÍMÃ;Ø` Cj@q74ݽxtìüçhúØ$È% a·G~Ûo>¦Pe}ë*]6í [#òþ†3 cëì?‡8n¿iŸ·ÇäBþ„¦ŽbwØîn½ÌÓ×5ܶxë
í(ªÒ>®ñCM]œ[É0àœœtN¯lªÚóöƆ*“Eåðè¤Ýñ}Œe[Žv»Òå—«Ç8W,4*œ„+ÜeÂxÖ5FñIb@Ly¦öƒ“R0n'ÓÎH6‚œƒóp=FX^v ‰RxôZÌ AE͉ÊC“‰æW|Cz^¥©ªq‘‡íA¢h¶ôšê/GH·"Ø¡g÷F¸}Š¢j)s\‰¦<°òSJ‡XÑ8𶛫J9êl!ÏlZ‡‹ô%Øz;’Ø¡pMðÈ$
Ù¹¡ë<ø5ñÀH3ÒE9ð6×:®ÕëË‹pnÌò©ç-Ò¶Æ{‡¥å¡Ï ýu9¼èì‡ÙvR÷%ƒðñ)^¿n©b¯5Þ»°cœIf×C²$2…óÖʪzxùy?‚rɸ˜3aã§4ÖØAµÝç^ã¥C5麛Ù"XVƒÄ.Dµ!|‘,Ö*SµbgP{IÅ4ÿyd×£~Øyìû§O|ÿqàaKíØKÐpô®ÕË7îy—µì‚[K½n×÷;§o¯Þnab‡ð¬û.<ü¯ž‹(NŒŒ¾æÒHôÿÂëD{LA˜
0ç/˜‹,*Öþ€*W7Ë+®´ÙÞ&•ÖzÅmÖ]]‰ÂÄN¹ã<MÜ#øPa¸IÃCôŠU¥
º!b$c^ ®\ç;Øûü”¯´^-¬ÞÞ4+ùÓ¡´—e
›í{x|âfÎE+œªpW‚7çÙQÞ—¸L”³^Z`{I
*ð\ù>>Ú.¢_|¤qv*ÂóèËAÆ˹ݬ(1s ýѦ-T?² L´º ŸÙ` ¦C§¡Mº"%213iïº â1)]âXlš“h² )™ ¦8Ö}€¡YL·Ôš&™´÷^è¼= ÷â>RR¬Üß•®®BïèÂ2#¶É"‰<èØêÈ]ãý!ó-_Ù“f㮈\àÄðh0¥IŒÑ.ç“‘…ת—×ÆÒ´ñ6GIŒ@¶šÔÚI.Oé†ô«TöÕc£ú
.
²ZK¹ÀÛ»få’Ž²”}ßð‡@5^ˆì}ðZpž‰¾-̯"¨Ó][_šyè·OðÑe³iʈs²m¯Ò'ÎÖ:eS¦òëÔ|¯ÑÌfT«WŠÚiÇ-šG7{írbÃÇ-ïÂe†ÂâýÈVêwÃVŸÿG*Ÿ!rö ³Nç–hÞEš*En‰YùxÒ„›}9¹%bÏ.¨¹o.·Dtóm¦Ñ~°3·Ä-»³7á´Înk£b"Ñ„×*-ùWVWxÎg‚ì¹Å
a©†
ye×'ûÍÃÛõÑ#ü
Uz(X7
--------------070800040307060505030901--
HTTP response status: 500
Received:
<html><head><title>Apache Tomcat/5.5.15-150 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>javax.servlet.ServletException: Mandatory Root MIME part containi
ng the SOAP Envelope is missing
com.ebay.soaframework.spf.pipeline.SPFServlet.doPost(SPFServlet.java:179)
javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
</pre></p><p><b>root cause</b> <pre>org.apache.axiom.om.OMException: Mandatory Root MIME part containing the SOAP Envelope is missing
org.apache.axiom.attachments.Attachments.getSOAPPartInputStream(Attachments.java:392)
com.ebay.soaframework.common.impl.attachment.BaseMessageAttachments.getInputStreamForMasterMessage(BaseMessageAttachments.java:44)
com.ebay.soaframework.common.impl.internal.pipeline.InboundMessageImpl.setInputStream(InboundMessageImpl.java:482)
com.ebay.soaframework.common.impl.internal.pipeline.InboundMessageImpl.setInputStream(InboundMessageImpl.java:421)
com.ebay.soaframework.spf.pipeline.ServerMessageContextBuilder.createMessageContext(ServerMessageContextBuilder.java:719)
com.ebay.soaframework.spf.pipeline.ServerMessageContextBuilder.setInputStream(ServerMessageContextBuilder.java:738)
com.ebay.soaframework.spf.impl.transport.http.HTTPServerUtils.createMessageContext(HTTPServerUtils.java:232)
com.ebay.soaframework.spf.pipeline.SPFServlet.doPost(SPFServlet.java:166)
javax.servlet.http.HttpServlet.service(HttpServlet.java:615)
javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the Apache Tomcat/5.5.15-150 logs.</u></p><HR size="1" noshade="noshade"><h3>Apache Tomcat/5.5.15-150</h3></body></html>
This is not Soap and it is XML over HTTP. Please help me and thank you.
Here is my code in VBA Access Option Compare Database Option Explicit
Public Function ChilkatSender2()
Dim http As New ChilkatHttp
Dim req As ChilkatHttpRequest
Set req = New ChilkatHttpRequest
http.UnlockComponent "sdgsedgseg"
Dim TokenValue As String
Dim FileAttachmentUUID As String
Dim XMLUUID As String
Dim APICALL As String
Dim success As Long
' First, let's build the HTTP request object
TokenValue = Forms!frmEbayAuthentication!txtTokenCode ' This is used for the Token Code insert manually on the Form Ebay Add Fixed Price Item.
APICALL = "uploadFile"
FileAttachmentUUID = Forms!frmuploadFile!txtFileAttachmentUUID
XMLUUID = Forms!frmuploadFile!txtXMLUUID
req.httpVerb = "POST"
req.path = "/FileTransferService"
' The boundary string is automatically generated and added by Chilkat.
' The value for the boundary string doesn't matter. (As long as it's a unique string that doesn't occur elsewhere in the request.)
req.ContentType = "multipart/related;type=""application/xop+xml"";start=""<0.urn:uuid:" & XMLUUID & ">"";start-info=""text/xml"""
' Adding the Connection: Keep-Alive is optional. It only makes sense if the intent is to send
' additional requests to the same domain (your-namespace-sb.accesscontrol.windows.net) within a reasonable time period.
req.AddHeader "X-EBAY-SOA-SERVICE-NAME", "FileTransferService"
req.AddHeader "X-EBAY-SOA-OPERATION-NAME", APICALL
req.AddHeader "X-EBAY-SOA-SECURITY-TOKEN", TokenValue
req.AddHeader "X-EBAY-SOA-REQUEST-DATA-FORMAT", "XML"
req.AddHeader "X-EBAY-SOA-RESPONSE-DATA-FORMAT", "XML"
req.AddHeader "User-Agent", "VBA Sender"
req.AddHeader "Host", "storage.sandbox.ebay.com"
' --------------------------------------------------
' IMPORTANT: Never set the Content-Length header.
' Chilkat will automatically compute the correct Content-Length and will add it.
' --------------------------------------------------
' Add the params to the request. Given that the Content-Type is set to "multipart/form-data", when
' Chilkat composes the request, it will put each param in it's own MIME sub-part (i.e. in it's own
' part delimited by the boundary string).
'req.AddParam "UploadAgent", "InterfaceVersion1.5"
'req.AddParam "user", "XXX"
'req.AddParam "password", "XXX"
'req.AddParam "file", "XXX"
'req.AddParam "data_version", "XXX"
Dim pathToFileOnDisk1 As String
pathToFileOnDisk1 = "C:\Users\Station\Documents\Access XML Save Files\New Testing\uploadFile.xml"
success = req.AddFileForUpload("uploadFile.xml", pathToFileOnDisk1)
If (success <> 1) Then
Debug.Print req.LastErrorText
Exit Function
End If
' The last param is the contents of a file.
' If it's a file on disk, we can add it like this:
Dim pathToFileOnDisk2 As String
pathToFileOnDisk2 = "C:\Users\Station\Documents\Access XML Save Files\New Testing\AFPIBulkTest1.gz"
success = req.AddFileForUpload("AFPIBulkTest1.gz", pathToFileOnDisk2)
If (success <> 1) Then
Debug.Print req.LastErrorText
Exit Function
End If
' -----------------------------------------------------------
'Add Sub Headers Below!
' -----------------------------------------------------------
req.AddSubHeader "0", "Content-Transfer-Encoding", "binary"
req.AddSubHeader "0", "Content-ID", "<urn:uuid:" & XMLUUID & ">"
req.AddSubHeader "1", "Content-Transfer-Encoding", "binary"
req.AddSubHeader "1", "Content-ID", "<urn:uuid:" & FileAttachmentUUID & ">"
' -----------------------------------------------------------
' IMPORTANT: To duplicate the HTTP request shown above, you'll want to choose
' either AddStringForUpload or AddFileForUpload, but not both. It's possible to upload
' any number of files by calling AddStringForUpload and/or AddFileForUpload any number
' of times, once per file to be uploaded. This of course assumes that the receiving
' end is programmed to receive multiple files..
' ------------------------------------------------------------
' The request is ready... now send it using HTTPS (which is port 443 by default).
Dim resp As ChilkatHttpResponse
Set resp = http.SynchronousRequest("storage.sandbox.ebay.com", 443, 1, req)
If (http.LastMethodSuccess <> 1) Then
Debug.Print http.LastErrorText
Exit Function
End If
' View the request that would be sent if SynchronousRequest was called:
Dim requestMime As String
requestMime = req.GenerateRequestText()
Debug.Print requestMime
Debug.Print "HTTP response status: " & resp.StatusCode
' In this case, the response would be HTML because our Accept header
' told the server to only return HTML. The HTML is available on the BodyStr
' property of the response object:
Dim htmlStr As String
htmlStr = resp.BodyStr
Debug.Print "Received:"
Debug.Print htmlStr
End Function
For debugging, try using "base64" for the transfer encoding.
Change this:
req.AddSubHeader "0", "Content-Transfer-Encoding", "binary" req.AddSubHeader "0", "Content-ID", "<urn:uuid:" &="" xmluuid="" &="" "="">" req.AddSubHeader "1", "Content-Transfer-Encoding", "binary" req.AddSubHeader "1", "Content-ID", "<urn:uuid:" &="" fileattachmentuuid="" &="" "="">"
to this:
req.AddSubHeader "0", "Content-Transfer-Encoding", "binary" req.AddSubHeader "0", "Content-ID", "<urn:uuid:" &="" xmluuid="" &="" "="">" req.AddSubHeader "1", "Content-Transfer-Encoding", "base64" req.AddSubHeader "1", "Content-ID", "<urn:uuid:" &="" fileattachmentuuid="" &="" "="">"
Then get the session log as before, but this time you'll get base64 for the .gz part. I would then be able to decode the base64 to a .gz, and then see if (1) it's a valid .gz, and (2) what XMl content it contains.
(The error message was complaining about "Mandatory Root MIME part containing the SOAP Envelope is missing", so my guess is that the XML passed in via the .gz was invalid or incomplete, or maybe somehow the .gz was doubly gzipped, or did not ungzip to valid XML (perhaps ungzipped to garbage).
Here's the completed example:
Android: eBay -- Upload Bulk Data using FileTransferService
Classic ASP: eBay -- Upload Bulk Data using FileTransferService
C: eBay -- Upload Bulk Data using FileTransferService
Chilkat2-Python: eBay -- Upload Bulk Data using FileTransferService
C++: eBay -- Upload Bulk Data using FileTransferService
C#: eBay -- Upload Bulk Data using FileTransferService
C# UWP/WinRT: eBay -- Upload Bulk Data using FileTransferService
DataFlex: eBay -- Upload Bulk Data using FileTransferService
Delphi ActiveX: eBay -- Upload Bulk Data using FileTransferService
Delphi DLL: eBay -- Upload Bulk Data using FileTransferService
.NET Core C#: eBay -- Upload Bulk Data using FileTransferService
Excel: eBay -- Upload Bulk Data using FileTransferService
Visual FoxPro: eBay -- Upload Bulk Data using FileTransferService
Java: eBay -- Upload Bulk Data using FileTransferService
Lianja: eBay -- Upload Bulk Data using FileTransferService
MFC: eBay -- Upload Bulk Data using FileTransferService
Mono C#: eBay -- Upload Bulk Data using FileTransferService
Node.js: eBay -- Upload Bulk Data using FileTransferService
Objective-C: eBay -- Upload Bulk Data using FileTransferService
Perl: eBay -- Upload Bulk Data using FileTransferService
PHP ActiveX: eBay -- Upload Bulk Data using FileTransferService
PHP Extension: eBay -- Upload Bulk Data using FileTransferService
PowerBuilder: eBay -- Upload Bulk Data using FileTransferService
PowerShell: eBay -- Upload Bulk Data using FileTransferService
PureBasic: eBay -- Upload Bulk Data using FileTransferService
Python: eBay -- Upload Bulk Data using FileTransferService
Ruby: eBay -- Upload Bulk Data using FileTransferService
SQL Server: eBay -- Upload Bulk Data using FileTransferService
Swift: eBay -- Upload Bulk Data using FileTransferService
Tcl: eBay -- Upload Bulk Data using FileTransferService
Unicode C: eBay -- Upload Bulk Data using FileTransferService
Unicode C++: eBay -- Upload Bulk Data using FileTransferService
Visual Basic 6.0: eBay -- Upload Bulk Data using FileTransferService
VB.NET: eBay -- Upload Bulk Data using FileTransferService
VB.NET UWP/WinRT: eBay -- Upload Bulk Data using FileTransferService
VBScript: eBay -- Upload Bulk Data using FileTransferService
Xojo Plugin: eBay -- Upload Bulk Data using FileTransferService