I'm calling MetadataAPI as the code below and it's returning getBody()
with a very long string as shown below, please scroll horizontal to see it and for brevity purpose I cut short.
HttpRequest req = new HttpRequest();
req.setMethod( 'POST' );
req.setHeader( 'Content-Type', 'text/xml; charset=utf-8' );
req.setHeader( 'SOAPAction', 'readMetadata' );
req.setEndpoint( URL.getOrgDomainUrl().toExternalForm() + '/services/Soap/m/48.0' );
req.setBody( soapMessage );
HttpResponse res = new Http().send( req );
res.getBody();
Here is the debug output
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="http://soap.sforce.com/2006/04/metadata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><readMetadataResponse><result><records xsi:type=\"Profile\"><fullName>Employee</fullName><applicationVisibilities><application>My_Awesome_App</application><default>false</default><visible>false</visible></applicationVisibilities><applicationVisibilities><application>standard__AppLauncher</application><default>......{removed}..... <objectPermissions><allowCreate>true</allowCreate><allowDelete>false</allowDelete><allowEdit>true</allowEdit><allowRead>true</allowRead><modifyAllRecords>false</modifyAllRecords><object>employee__c</object><viewAllRecords>false</viewAllRecords></objectPermissions>......</soapenv:Body></soapenv:Envelope>
My question is:
How to extract the values from <objectPermissions>
that getBody()
is rendering? or any other attributes.
for an example, if I want to read the value of objectPermissions
or object
how would I go after?