[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Ftpapi] How to read "attributes"



EXAMPLE11 illustrates how to process these with the HTTP_nextXmlAttr() routine.


On 1/23/2017 3:30 PM, Jason Pennybacker wrote:

Code snippets attached in case they don’t render properly.

Using http_url_post_xml and the web team’s service to pull user information from active directory.

   rc = http_url_post_xml(

              'http://my.company.com/' +

              'Company_DirectoryServices/search/' +

              'assoc?user_id=' + %Trim(UserId) +

              '&ldap=true'

                  : %addr(SOAP) + 2

                  : 0

                  : *NULL

                  : %paddr(Incoming)

                  : %addr(rate)

                  : HTTP_TIMEOUT

                  : HTTP_USERAGENT

                  : 'text/xml'

                  : ' ');

The response I receive gives me “property” for the name, regardless of the actual property (ht_title, job_cd, etc.) which I have been told is actually an attribute. What are my options for getting what I need?

   <?xml version="1.0" encoding="UTF-8"?>

   <sdo name="Associate Search Results">

       <list name="assoc_list">

           <sdo name="associate">

<property name="hr_title" type="String">Associate</property>

               <property name="job_cd" type="String">1234</property>

               <property name="hr_first_nm" type="String">John</property>

               <property name="last_nm" type="String">Doe</property>

               <property name="assoc_cd" type="String">012345</property>

               <property name="ou_type_cd" type="String">XYZ</property>

               <property name="first_nm" type="String">John</property>

<property name="full_nm" type="String">Doe, John J</property>

               <property name="title" type="String">Associate</property>

               <property name="midl_nm" type="String">J</property>

               <property name="ou_cd" type="String">123</property>

               <property name="file_nbr" type="Integer">116853</property>

<property name="email" type="String">John.Doe@xxxxxxxxxxx <mailto:John.Doe@xxxxxxxxxxx>

               <property name="assoc_type_cd" type="String">S</property>

               <property name="org_cd" type="String">XYZ</property>

           </sdo>

       </list>

</sdo>

     p Incoming        B

     d Incoming        PI

     d rate                         8F

     d depth                       10I 0 value

     d   name 1024A   varying const

     d   path 24576A   varying const

     d   value 65535A   varying const

     d attrs                         *   dim(32767)

     d             const options(*varsize)

     d atof PR             8F   extproc('atof')

     d string                        *   value options(*string)

      /free

         // name is always "property"

// I need "hr_title", "job_cd", etc so that I can place it properly

         select;

           when name = 'hr_title';

             contactinfo.title = value;

           when name = 'hr_first_nm';

             contactinfo.firstname = value;

           when name = 'email';

             contactinfo.email = value;

         endsl;

      /end-free

     P                 E

Thanks,

Jason

Software Engineer



_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi

_______________________________________________
Ftpapi mailing list
Ftpapi@xxxxxxxxxxxxxxxxxxxxxx
http://scottklement.com/mailman/listinfo/ftpapi