login about faq

I am constantly getting an error when using this. I have no idea why. I really want your software to work for me as it seems like a GREAT package. If I can learn to use it properly I will use it all the time.

I have my response from the API call directly. I am trying to extract a gzip file from the second part of the MIME response. The zip file is in binary. What am I doing wrong????? Thank you. As soon as i can get this code to work properly you have won a customer for sure! Thanks.

    path: --MIMEBoundaryurn_uuid_7E229B3F5C86A212B51492052835776140997
Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:7E229B3F5C86A212B51492052835776140998>

<downloadfileresponse xmlns="http://www.ebay.com/marketplace/services"><ack>Success</ack><version>1.1.0</version><timestamp>2017-04-13T03:07:15.776Z</timestamp><fileattachment><size>1653</size><data><xop:include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:urn:uuid:C0CA465CC98C26B35D1492052946315"/></data></fileattachment></downloadfileresponse>
Content-Type: application/x-gzip
Content-Transfer-Encoding: binary
Content-ID: <urn:uuid:c0ca465cc98c26b35d1492052946315>

???AFPIBulkTest1.xml?Y_o?G?}@ A?m?u?n ??R??,|z??qZH??>?}N???4?????H2.f???uZ/»w?^PC??93????    ???(?}J?\????j?R
F????ek?_???^Q?Í???^Q*1??e>???)y?E?/Ig???*???O?4?????*?R4?3?,Dh?Vm\qC?H_|#?}???b?IO#??Cz1??L?jq:R|i???k???????y?m/SH???(*???D ??')??????A?3??%???4|?,?Z???"?c?V3??????0??'c?tt??:^??Qb????  ?b?uA??:??l?????>???;?? Cj@q74?xt?????a?G~?>?Pe}?6?#? c???8n?i???B????bw?n?????x?(?????]?[???tN?l????*?E???}?e[?v?????W,4*???+??x?F??Ly??R0n'?H6?????X^v ?Rx?AE??C???Cz^???q???h??/GH?"?g???j)s\????_|?qv*?????(1s ??    L?? ??? ?C??M?"%213i? ?]???h??)??8???YL??&???=??R?????B??#???<?????f?\?h?0?I????????????I?@???I.O??T????ZK????f???}??@5^??Zp???-??"??[_?y??i???s??m???:eS??|???fT?W????G7{?b??-????V??G*?!r?N?????*En?Y?}9?%b????o.?Dt?~?3????7?nk?b"??-??x???
      Failed to open file (3)
      utf8Filename: \\?\C:\Users\Station\Documents\--MIMEBoundaryurn_uuid_7E229B3F5C86A212B51492052835776140997Content-Type_ application\xop+xml; charset=utf-8; type=_text\xml_Content-Transfer-Encoding_ binaryContent-ID_ _0.urn_uuid_7E229B3F5C86A212B51492052835776140998___xml version='1.0' encoding='UTF-8'___downloadFileResponse xmlns=_http_\www.ebay.com\marketplace\services___ack_Success_\ack__version_1.1.0_\version__timestamp_2017-04-13T03_07_15.776Z_\timestamp__fileAttachment__Size_1653_\Size__Data__xop_Include xmlns_xop=_http_\www.w3.org\2004\08\xop\include_ href=_cid_urn_uuid_C0CA465CC98C26B35D1492052946315_\__\Data__\fileAttachment__\downloadFileResponse_--MIMEBoundaryurn_uuid_7E229B3F5C86A212B51492052835776140997Content-Type_ application\x-gzipContent-Transfer-Encoding_ binaryContent-ID_ _urn_uuid_C0CA465CC98C26B35D1492052946315_???AFPIBulkTest1.xml?Y_o?G?}@ A?m?u?n ??R??,_z??qZH??_?}N???4?????H2.f???uZ\»w?^PC??93????    ???(?}J?\_???j?RF????ek?_???^Q?Í???^Q_1??e_???)y?E?\Ig
???_???O?4?????_?R4?3?,Dh?Vm\qC?H__#?}???b?IO#??Cz1??L?jq_R_i???k???????y?m\SH???(_???D ??')??????A?3??%???4_?,?Z???_?c?V3??????0??'c?t_?v_t??_^??Qb???? ?b?uA??_??l?????_???;?? Cj@q74?xt?????a?G~?_?Pe}?6?#? c?_?8n?i???B????bw?n?????x?(?????]?[???tN?l????_?E???}?e[?v?????W,4_???+??x?F??Ly??R0n'?H6?????X^v ?Rx?AE??C???Cz^???q???h??\GH?_?g???j)s\??_??X???J9?!?Z???;??pM????5???9?_??`pn?????????????R???n?b?5??c?If??$2??zx?r??3a??4?A????C5??_XV??D??!_?,?S?bgP{I??yd?~???q??K???????K?n?;?o??ab??_?N????????LA?0???,_??_W7????&????]??N????I???!b$c^   ?\???-??4+??e??_?E+??pW?7???L??^Z`{I_?_??__?qv_?????(1s ?? L?? ??? ?C??M?_%213i? ?]???h??)??8???YL??&???=??R?????B??#???_?????f?\?h?0?I????????????I?@???I.O??T????ZK????f???}??@5^??Zp???-??_??[_?y??i???s??m???_eS??_???fT?W????G7{?b??-????V??G_?!r?N?????_En?Y?}9?%b????o.?Dt?~?3????7?nk?b_??-??x???a??ye????7--MIMEBoundaryurn_uuid_7E229B3F5C86A212B5149205283

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here is my VBA code in Access:

    reader.send Doc 'This sends the XML document from above.

Do Until reader.ReadyState = 4

      Call UnlockChilkat 'Unlock ChilKat!

    Dim obj As New ChilkatBinData
    obj.LoadBinary (reader.responseText) ' Load obj Bin with the Servers MIME response

Dim mime As New ChilkatMime
Dim success As Long

success = mime.LoadMimeBytes(reader.responseText) 'Load MIME from obj BinData

Dim part2 As ChilkatMime
Set part2 = mime.GetPart(1) 'Get Zip File in 2nd Part

Dim binaryData() As Byte
binaryData = part2.GetBodyBinary()

'  We now have the binary bytes of the Zip File in binaryData.
'  Save it to a file.

Dim fac As New CkFileAccess
success = fac.WriteEntireFile("C:\Users\Shipper Station\Documents\Access XML Save Files\New Testing\idk.txt", binaryData)

    Exit Function

asked Apr 13 '17 at 19:38

Dustin%20Stanley's gravatar image

Dustin Stanley

edited Apr 14 '17 at 23:17

For any method that returns an object, always make sure to check for NULL (or check the chilkatObject.LastMethodSuccess property ) to see if it succeeded or not. Null/nothing/nada is returned on failure, and if your program tries to dereference Null/nothing/nada (in any programming language), then it'll crash or raise an exception. Check the contents of the LastErrorText for any method call that returns a failure indication.

Also, it's never possible to treat binary data as a string. This is the offending statement:

    obj.LoadBinary (reader.responseText) ' Load obj Bin with the Servers MIME response
If the response is binary, then the act of trying to get it as "reader.responseText" is an implicit conversion of binary bytes to a string. If one wants to load binary bytes into a string, one must tell it the character encoding (such as utf-8, utf-16, iso-8859-1, etc.) because how is one to know that byte sequence represents any particular char?? The act of getting a binary response as "reader.responseText" is an implicit conversion from bytes to a string (probably assuming ANSI). If your bytes don't actually represent text (perhaps it is bytes comprising a JPG, or PDF, or MS-Word document..), then the data's already been mangled.

So.. what needs to be done is to pass the unmolested response bytes to LoadMimeBytes.. :)


answered Apr 15 '17 at 11:38

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Apr 13 '17 at 19:38

Seen: 2,059 times

Last updated: Apr 15 '17 at 11:38

powered by OSQA