[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: User Profile Items - Samples
On Friday's call I was asked to come up with samples showing custom user profile items using extensions and using a schema specified field. Attached files: * customUserProps.xsd - schema used for the samples * customItems.xml - sample registration and getMarkup using a specified location * extensions.xml - sample registration and getMarkup using extensions Thanks for reviewing them, Nathan Lipke
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <urn:register xmlns:urn="urn:oasis:names:tc:wsrp:v1:types"> <!-- ... --> <!-- Here location is not an xpath, but rather a profile section name from Chapter 11 of spec The section is the item's parent. If location missing the default is a direct descendant of the profile --> <urn:customUserProfileData name="spouseName" type="xs:string"> <urn:description xml:lang="en">The user's spouse's name</urn:description> <urn:location>name</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="hireDate" type="xs:dateTime"> <urn:description xml:lang="en">The user's date of hire</urn:description> <urn:location>employerInfo</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="IM" type="custom:im" isArray="true"> <urn:description xml:lang="en">The user's IM handles</urn:description> <urn:location>homeInfo/online</urn:location> <urn:location>businessInfo/online</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="importantNumbers" type="xs:int" isArray="true"> <urn:description xml:lang="en">Numbers to remember</urn:description> </urn:customUserProfileData> <urn:customUserProfileData name="luckyNumbers" type="xs:int" isArray="true"> <urn:description xml:lang="en">Play lotto with these</urn:description> </urn:customUserProfileData> </urn:register> </soapenv:Body> </soapenv:Envelope> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <urn:getMarkup xmlns:urn="urn:oasis:names:tc:wsrp:v1:types"> <!-- ... --> <urn:profile xmlns:xs="http://www.w3.org/2001/XMLSchema">> <urn:name> <urn:customItems> <urn:customItem name="spouseName"><xs:string>Susan</xs:string></urn:customItem> </urn:customItems> </urn:name> <urn:employerInfo> <urn:customItems> <urn:customItem name="hireDate"><xs:dateTime>2005-03-24T09:38:11-07:00</xs:dateTime></urn:customItem> </urn:customItems> </urn:employerInfo> <urn:homeInfo> <urn:online> <urn:customItems> <urn:customItem name="IM"> <custom:im xmlns:custom="..." service="Yahoo">yahoo_home_user</custom:im> <custom:im xmlns:custom="..." service="AIM">aim_home_user</custom:im> </urn:customItem> </urn:customItems> </urn:online> </urn:homeInfo> <urn:businessInfo> <urn:online> <urn:customItems> <urn:customItem name="IM"> <custom:im xmlns:custom="..." service="Yahoo">yahoo_business_user</custom:im> <custom:im xmlns:custom="..." service="AIM">aim_business_user</custom:im> </urn:customItem> </urn:customItems> </urn:online> </urn:businessInfo> <urn:customItems> <urn:customItem name="luckyNumbers"> <xs:int>7</xs:int> <xs:int>11</xs:int> <xs:int>13</xs:int> </urn:customItem> <urn:customItem name="importantNumbers"> <xs:int>0</xs:int> <xs:int>10</xs:int> <xs:int>100</xs:int> <xs:int>1000</xs:int> </urn:customItem> </urn:customItems> </urn:profile> <!-- ... --> </urn:getMarkup> </soapenv:Body> </soapenv:Envelope>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <urn:register xmlns:urn="urn:oasis:names:tc:wsrp:v1:types"> <!-- ... --> <!-- Here the location is an XPath to the item's node (not parent) This requires both the producer and consumer to understand the full xpath spec. --> <!-- Could query on attr/child value if the schema provides a name. What if the schema does not have such an attr? --> <urn:customUserProfileData name="spouseName" type="custom:nameHolder"> <urn:description xml:lang="en">The user's spouse's name</urn:description> <urn:location>name/extensions/stringHolder[@name='spouseName']</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="hireDate" type="custom:dateHolder"> <urn:description xml:lang="en">The user's date of hire</urn:description> <urn:location>employerInfo/extensions/dateHolder[0]</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="IM" type="custom:im" isArray="true"> <urn:description xml:lang="en">The user's IM handles</urn:description> <urn:location>homeInfo/online/extensions/im[0]</urn:location> <urn:location>businessInfo/online/extensions/im[0]</urn:location> </urn:customUserProfileData> <!-- The consumer must ensure order. What to do if an item is not present? This will mess up the order. --> <urn:customUserProfileData name="importantNumbers" type="custom:intArray" isArray="true"> <urn:description xml:lang="en">Numbers to remember</urn:description> <urn:location>extensions/intArray[1]</urn:location> </urn:customUserProfileData> <urn:customUserProfileData name="luckyNumbers" type="cutom:intArray" isArray="true"> <urn:description xml:lang="en">Play lotto with these</urn:description> <urn:location>extensions/intArray[0]</urn:location> </urn:customUserProfileData> <!-- What if xpath matches multiple elements? --> <urn:customUserProfileData name="trouble" type="cutom:intArray" isArray="true"> <urn:description xml:lang="en">Xpath matches too much</urn:description> <urn:location>extensions/*</urn:location> </urn:customUserProfileData> </urn:register> </soapenv:Body> </soapenv:Envelope> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body> <urn:getMarkup xmlns:urn="urn:oasis:names:tc:wsrp:v1:types"> <!-- ... --> <urn:profile xmlns:xs="http://www.w3.org/2001/XMLSchema">> <urn:name> <urn:extensions> <custom:stringHolder name="spouseName"><xs:string>Susan</xs:string></custom:stringHolder> </urn:extensions> </urn:name> <urn:employerInfo> <urn:extensions> <custom:dateHolder name="hireDate"><xs:dateTime>2005-03-24T09:38:11-07:00</xs:dateTime></custom:dateHolder> </urn:extensions> </urn:employerInfo> <urn:homeInfo> <urn:online> <urn:extensions> <custom:im name="IM"> <custom:im xmlns:custom="..." service="Yahoo">yahoo_home_user</custom:im> <custom:im xmlns:custom="..." service="AIM">aim_home_user</custom:im> </custom:im> </urn:extensions> </urn:online> </urn:homeInfo> <urn:businessInfo> <urn:online> <urn:extensions> <custom:im name="IM"> <custom:im xmlns:custom="..." service="Yahoo">yahoo_business_user</custom:im> <custom:im xmlns:custom="..." service="AIM">aim_business_user</custom:im> </custom:im> </urn:extensions> </urn:online> </urn:businessInfo> <urn:extensions> <custom:intArray> <xs:int>7</xs:int> <xs:int>11</xs:int> <xs:int>13</xs:int> </custom:intArray> <custom:intArray> <xs:int>0</xs:int> <xs:int>10</xs:int> <xs:int>100</xs:int> <xs:int>1000</xs:int> </custom:intArray> </urn:extensions> </urn:profile> <!-- ... --> </urn:getMarkup> </soapenv:Body> </soapenv:Envelope>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]