I'm sending an XML structure with a base64 encoded file to a web service. I think returning an image as part of the response XML could be done in a similar way but I have not tried it. Some of the code below may help.
xml.SaveCurrentFieldToXML PROCEDURE (Long p_x,Long p_DimCounter,String p_name)
! Start of "Class Method - Data Section"
! [Priority 5000]
! End of "Class Method - Data Section"
CODE
! Start of "Class Method - Executable Code Section"
! [Priority 2500]
If p_x = 9
xml2.Append = 0
xml2._Indent = self._Indent
xml2.OmitXMLHeader = 1
xml2.DontSaveBlanks = 1
xml2.Save(QInvoice.File,'Files','File')
self._NoEncodeDecode = 1
self._sFieldNameLen[p_x] = 0
self.CurrentField &= xml2.xmlData
END
! Parent Call
PARENT.SaveCurrentFieldToXML (p_x,p_DimCounter,p_name)
! [Priority 7500]
If p_x = 9
xml._NoEncodeDecode = 0
END
xml2.SaveCurrentFieldToXML PROCEDURE (Long p_x,Long p_DimCounter,String p_name)
! Start of "Class Method - Data Section"
! [Priority 5000]
! End of "Class Method - Data Section"
CODE
! Start of "Class Method - Executable Code Section"
! [Priority 2500]
If p_name = 'FileName'
L:FileName = self.CurrentField
END
If p_name = 'EncodedFile'
If L:FileName = ''
Message('No filename')
ELSE
st.LoadFile(clip(Glo:DataPath) & Clip(L:FileName))
st.base64NoWrap = 1
st.Base64Encode()
self.CurrentField &= st.GetValuePtr()
END
END