Thursday, August 11, 2016

Read Image from AX to web service AIF .Net

//Read Image from AX to web service AIF .Net

public str  GetEmplImage(Description employeeId)
{
    str             content;
   
   XmlDocument  getImageXml(Description _employeeId)
   {
        XmlDocument xmlEnvelope;
        XmlElement childNode;
        str contentloc;
        HcmWorker       worker;
        HcmPersonImage  PersonImage;
  
        CompanyImage ci;
  
         BinData bin = new BinData();       
        worker = HcmWorker::findByPersonnelNumber(_employeeId);
   
        select firstOnly PersonImage
                where PersonImage.Person == worker.Person;
      
        bin.setData(PersonImage.Image);
        contentloc = bin.base64Encode();
        xmlEnvelope = new XmlDocument();
        childNode =  xmlEnvelope.CreateElement("image");
        childNode.innerXml(contentloc);
        xmlEnvelope.AppendChild(childNode);
        return xmlEnvelope;
    }
    ;   
    content = getImageXml(employeeId).xml();
    return content;
}

No comments:

Post a Comment

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...