Forum Discussion

alberttwong's avatar
14 years ago

How to save binary data from a XML response

I'm using SoapUI and making a web services (ws) call to Fedex to generate a label. The response back from Fedex is a PNG or PDF file embedded in a web services response. How can I save that the PNG/PDF element?

SOAP endpoint - https://gatewaybeta.fedex.com:443/web-services/ship
Here's the request XML (BTW, you have to sign up as a Fedex Developer to get credentials) -

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v8="http://fedex.com/ws/ship/v8">
<soapenv:Header/>
<soapenv:Body>
<v8:ProcessShipmentRequest>
<v8:WebAuthenticationDetail>
<v8:UserCredential>
<v8:Key>??</v8:Key>
<v8:Password>??</v8:Password>
</v8:UserCredential>
</v8:WebAuthenticationDetail>
<v8:ClientDetail>
<v8:AccountNumber>??</v8:AccountNumber>
<v8:MeterNumber>??</v8:MeterNumber>
</v8:ClientDetail>
<v8:Version>
<v8:ServiceId>ship</v8:ServiceId>
<v8:Major>8</v8:Major>
<v8:Intermediate>0</v8:Intermediate>
<v8:Minor>0</v8:Minor>
</v8:Version>
<v8:RequestedShipment>
<v8:ShipTimestamp>2010-06-24T19:15:06Z</v8:ShipTimestamp>
<v8:DropoffType>REGULAR_PICKUP</v8:DropoffType>
<v8:ServiceType>FEDEX_2_DAY</v8:ServiceType>
<v8:PackagingType>YOUR_PACKAGING</v8:PackagingType>
<v8:TotalWeight>
<v8:Units>LB</v8:Units>
<v8:Value>20.00</v8:Value>
</v8:TotalWeight>
<v8:Shipper>
<v8:Contact>
<v8:PersonName>John Doe</v8:PersonName>
<v8:CompanyName>Long Beach Shipping Point</v8:CompanyName>
<v8:PhoneNumber>2129995555</v8:PhoneNumber>
<v8:FaxNumber>2129995556</v8:FaxNumber>
</v8:Contact>
<v8:Address>
<v8:StreetLines>3423 Karen Ave</v8:StreetLines>
<v8:City>Long Beach</v8:City>
<v8:StateOrProvinceCode>CA</v8:StateOrProvinceCode>
<v8:PostalCode>90808</v8:PostalCode>
<v8:CountryCode>US</v8:CountryCode>
</v8:Address>
</v8:Shipper>
<v8:Recipient>
<v8:Contact>
<v8:PersonName>ATTN: ME</v8:PersonName>
<v8:CompanyName>TONY RAIMO</v8:CompanyName>
<v8:PhoneNumber>9999999999</v8:PhoneNumber>
</v8:Contact>
<v8:Address>
<v8:StreetLines>11 Alison Way</v8:StreetLines>
<v8:City>Lynn</v8:City>
<v8:StateOrProvinceCode>MA</v8:StateOrProvinceCode>
<v8:PostalCode>01904-1442</v8:PostalCode>
<v8:CountryCode>US</v8:CountryCode>
</v8:Address>
</v8:Recipient>
<v8:ShippingChargesPayment>
<v8:PaymentType>SENDER</v8:PaymentType>
<v8:Payor>
<v8:AccountNumber>??</v8:AccountNumber>
<v8:CountryCode>US</v8:CountryCode>
</v8:Payor>
</v8:ShippingChargesPayment>
<v8:LabelSpecification>
<v8:LabelFormatType>COMMON2D</v8:LabelFormatType>
<v8:ImageType>PNG</v8:ImageType>
<v8:LabelStockType>PAPER_4X6</v8:LabelStockType>
</v8:LabelSpecification>
<v8:RateRequestTypes>LIST</v8:RateRequestTypes>
<v8:PackageCount>1</v8:PackageCount>
<v8:PackageDetail>INDIVIDUAL_PACKAGES</v8:PackageDetail>
<v8:RequestedPackageLineItems>
<v8:SequenceNumber>1</v8:SequenceNumber>
<v8:Weight>
<v8:Units>LB</v8:Units>
<v8:Value>10.00</v8:Value>
</v8:Weight>
</v8:RequestedPackageLineItems>
</v8:RequestedShipment>
</v8:ProcessShipmentRequest>
</soapenv:Body>
</soapenv:Envelope>
No RepliesBe the first to reply