You need to sign in to do that
Don't have an account?
salesforcelearner1
how parser xml
Failure resonponse
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<h:ResponseReference>ff787f7e-351e-49fb-b029-6dc2d835dc5b</h:ResponseReference>
</h:ResponseContext>
</s:Header>
<s:Body>
<GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ResponseInformation>
<Errors>
<Error>
<Code>3001149</Code>
<Description>Invalid sender postal code specified. Postal Code does not match any of the registered Postal Codes associated with the supplied Key.</Description>
<AdditionalInformation i:nil="true"/>
</Error>
</Errors>
<InformationalMessages i:nil="true"/>
</ResponseInformation>
<ShipmentEstimates i:nil="true"/>
<ReturnShipmentEstimates i:nil="true"/>
</GetFullEstimateResponse>
</s:Body>
</s:Envelope>
Success Response:-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<h:ResponseReference>ae3ec807-6442-4581-848c-bbd6af200a48</h:ResponseReference>
</h:ResponseContext>
</s:Header>
<s:Body>
<GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ResponseInformation>
<Errors/>
<InformationalMessages i:nil="true"/>
</ResponseInformation>
<ShipmentEstimates>
<ShipmentEstimate>
<ServiceID>PurolatorExpress9AM</ServiceID>
<ShipmentDate>2018-07-17</ShipmentDate>
<ExpectedDeliveryDate>2018-07-18</ExpectedDeliveryDate>
<EstimatedTransitDays>1</EstimatedTransitDays>
<BasePrice>199.69</BasePrice>
<Surcharges>
<Surcharge>
<Amount>30.4</Amount>
<Type>Fuel</Type>
<Description>Fuel</Description>
</Surcharge>
<Surcharge>
<Amount>2.95</Amount>
<Type>ResidentialDelivery</Type>
<Description>Residential Area</Description>
</Surcharge>
</Surcharges>
<Taxes>
<Tax>
<Amount>0</Amount>
<Type>PSTQST</Type>
<Description>PST/QST</Description>
</Tax>
<Tax>
<Amount>0</Amount>
<Type>HST</Type>
<Description>HST</Description>
</Tax>
<Tax>
<Amount>11.65</Amount>
<Type>GST</Type>
<Description>GST</Description>
</Tax>
</Taxes>
<OptionPrices i:nil="true"/>
<TotalPrice>244.69</TotalPrice>
</ShipmentEstimate>
<ReturnShipmentEstimates i:nil="true"/>
</GetFullEstimateResponse>
</s:Body>
</s:Envelope>
How to parse this using dom. i'm pretty new to xml please help me
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<h:ResponseReference>ff787f7e-351e-49fb-b029-6dc2d835dc5b</h:ResponseReference>
</h:ResponseContext>
</s:Header>
<s:Body>
<GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ResponseInformation>
<Errors>
<Error>
<Code>3001149</Code>
<Description>Invalid sender postal code specified. Postal Code does not match any of the registered Postal Codes associated with the supplied Key.</Description>
<AdditionalInformation i:nil="true"/>
</Error>
</Errors>
<InformationalMessages i:nil="true"/>
</ResponseInformation>
<ShipmentEstimates i:nil="true"/>
<ReturnShipmentEstimates i:nil="true"/>
</GetFullEstimateResponse>
</s:Body>
</s:Envelope>
Success Response:-
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ResponseContext xmlns:h="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<h:ResponseReference>ae3ec807-6442-4581-848c-bbd6af200a48</h:ResponseReference>
</h:ResponseContext>
</s:Header>
<s:Body>
<GetFullEstimateResponse xmlns="http://purolator.com/pws/datatypes/v2" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ResponseInformation>
<Errors/>
<InformationalMessages i:nil="true"/>
</ResponseInformation>
<ShipmentEstimates>
<ShipmentEstimate>
<ServiceID>PurolatorExpress9AM</ServiceID>
<ShipmentDate>2018-07-17</ShipmentDate>
<ExpectedDeliveryDate>2018-07-18</ExpectedDeliveryDate>
<EstimatedTransitDays>1</EstimatedTransitDays>
<BasePrice>199.69</BasePrice>
<Surcharges>
<Surcharge>
<Amount>30.4</Amount>
<Type>Fuel</Type>
<Description>Fuel</Description>
</Surcharge>
<Surcharge>
<Amount>2.95</Amount>
<Type>ResidentialDelivery</Type>
<Description>Residential Area</Description>
</Surcharge>
</Surcharges>
<Taxes>
<Tax>
<Amount>0</Amount>
<Type>PSTQST</Type>
<Description>PST/QST</Description>
</Tax>
<Tax>
<Amount>0</Amount>
<Type>HST</Type>
<Description>HST</Description>
</Tax>
<Tax>
<Amount>11.65</Amount>
<Type>GST</Type>
<Description>GST</Description>
</Tax>
</Taxes>
<OptionPrices i:nil="true"/>
<TotalPrice>244.69</TotalPrice>
</ShipmentEstimate>
<ReturnShipmentEstimates i:nil="true"/>
</GetFullEstimateResponse>
</s:Body>
</s:Envelope>
How to parse this using dom. i'm pretty new to xml please help me
Check with this link and implement accordingly and if helping your mark it as your answer to help other.
https://developer.secure.force.com/cookbook/recipe/parsing-xml-using-the-apex-dom-parser
https://webkul.com/blog/parsing-xml-file-apex/
Thanks
Niraj