UPS_Support
13 years agoOccasional Contributor
Decode image returned in the response
I'm working with a response that returns two base64 encoded images. I would like to add a groovy script that will decode images and save them to my hard drive.
----------------------------------------------------------------------------------------------------------------------------------------
<ShipmentAcceptResponse>
<Response>
<TransactionReference>
<CustomerContext>Success; Includes new CompanyDisplayableName</CustomerContext>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
<ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<ShipmentResults>
<ShipmentCharges>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>12.63</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>12.63</MonetaryValue>
</TotalCharges>
</ShipmentCharges>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
<Description>Pounds</Description>
</UnitOfMeasurement>
<Weight>15.0</Weight>
</BillingWeight>
<ShipmentIdentificationNumber>1Z3906WW0394214460</ShipmentIdentificationNumber>
<PackageResults>
<TrackingNumber>1Z3906WW0394214460</TrackingNumber>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<LabelImage>
<LabelImageFormat>
<Code>GIF</Code>
</LabelImageFormat>
<GraphicImage>R0lGODdheAUgA+cAAAAAAAEBAQ…</GraphicImage>
<HTMLImage>PCFET0NUWVBFIEhUTUwg…</HTMLImage>
</LabelImage>
</PackageResults>
</ShipmentResults>
</ShipmentAcceptResponse>
----------------------------------------------------------------------------------------------------------------------------------------
<ShipmentAcceptResponse>
<Response>
<TransactionReference>
<CustomerContext>Success; Includes new CompanyDisplayableName</CustomerContext>
</TransactionReference>
<ResponseStatusCode>1</ResponseStatusCode>
<ResponseStatusDescription>Success</ResponseStatusDescription>
</Response>
<ShipmentResults>
<ShipmentCharges>
<TransportationCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>12.63</MonetaryValue>
</TransportationCharges>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<TotalCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>12.63</MonetaryValue>
</TotalCharges>
</ShipmentCharges>
<BillingWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
<Description>Pounds</Description>
</UnitOfMeasurement>
<Weight>15.0</Weight>
</BillingWeight>
<ShipmentIdentificationNumber>1Z3906WW0394214460</ShipmentIdentificationNumber>
<PackageResults>
<TrackingNumber>1Z3906WW0394214460</TrackingNumber>
<ServiceOptionsCharges>
<CurrencyCode>USD</CurrencyCode>
<MonetaryValue>0.00</MonetaryValue>
</ServiceOptionsCharges>
<LabelImage>
<LabelImageFormat>
<Code>GIF</Code>
</LabelImageFormat>
<GraphicImage>R0lGODdheAUgA+cAAAAAAAEBAQ…</GraphicImage>
<HTMLImage>PCFET0NUWVBFIEhUTUwg…</HTMLImage>
</LabelImage>
</PackageResults>
</ShipmentResults>
</ShipmentAcceptResponse>