NetTalk Central

Author Topic: SOAP SERVER UPLOAD FILE  (Read 2823 times)

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
SOAP SERVER UPLOAD FILE
« on: November 28, 2013, 08:43:29 AM »
HI,

   In the client application, I use the following code to upload the file to NetTalk SOAP server.

   UPXM:Role = 'upload'
   UPXM:FileName = Loc:UploadFile
   UPXM:Number = 1
   st.loadfile(Loc:UploadFile)
   st.base64NoWrap = true
   st.Base64Encode()
   st.ToBlob(UPXM:SaveFile)
   ADD(UploadXML)
   xml.save(UpLoadXml)
   PostString = xml.xmldata
   do SendPost

   * The "UploadXML" file is a inmemory file driver

   If the file is not attach, the xml tree will show correctly and can pass to the SOAP server. But if attach with the file, the xml tree will broken after the blob file. Which missing the following data,
   
</SAVEFILE>
  </group>
</data>
</soap:Body>
</soap:Envelope>

   Did I missing something? or this is not the right method to upload file to SOAP server.

   Regards

Terry Ho

   The following is my working environment :


   clarion 9 (9.0.10376) with NetTalk 7.31 and xfile 1.93

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: SOAP SERVER UPLOAD FILE
« Reply #1 on: November 28, 2013, 09:09:04 PM »
Hi Terry,

I think make a small example for me and I'll can take a closer look.

Cheers
Bruce

terryho

  • Newbie
  • *
  • Posts: 20
    • View Profile
    • Email
Re: SOAP SERVER UPLOAD FILE
« Reply #2 on: November 29, 2013, 07:41:57 AM »
Hi Bruce,

    Attach is the my SOAP server, which include upload and download of image file

    In the Download tab it will download a file from the SOAP server. Which work in C6, but don't why not work in C9
 
    In the Upload tab which can upload a file to the SOAP server, but only the file name can add in the tps file. The image file can not add in the the tps file.

     I think it is because missing of the last part of the xml file.

     May be I use wrong method to do it.

     Regards

Terry Ho

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: SOAP SERVER UPLOAD FILE
« Reply #3 on: December 02, 2013, 10:48:47 PM »
The data file is empty, so let's start with the upload.
This is going to fail for a number of reasons (actually on my machine I get a GPF).

The problems are as follows;
xmlString        String(1024) - since this is the string you are passing to xFiles in the line xmlString = p_web.GetValue('xml'), you are limiting the upload to 1K.
You would be better off refactoring this using StringTheory. For example;

xmlString        StringTheory

then
  xmlString.SetValue(p_web.GetValue('xml')) 
  Xml.Load(Request,xmlString.value,xmlString.Length())   


Then I'm not sure you can have an ANY inside a Group.
I would probably remove this field from the group completely - and use a second StringTheory object to parse it out the packet separately. You can use StringTheory.BETWEEN etc to get the text between the <savefile> and </savefile> tags.

On the sending side I'd remove the CDATA wrapper around the incoming file because it's being Base64 encoded, so CData is unnecessary.

that should at least get you started...

cheers
Bruce