views:

38

answers:

1

My iPhone app will be receiving an xml feed from a Java web service. The xml is in a SOAP message. I can easily parse data from within the xml however there is a jpeg attachment to the SOAP message that I need to display within the iPhone app. Does anyone have example code or a link to some documentation on how to work with SOAP attachments on the iPhone?

Thanks

+1  A: 

I'm not 100% certain, but I'm reasonably sure that wsdl2objc supports binary attachments. Documentation is sparse, however.

That said, if you are parsing the message by hand, take a look at the Message format from w3c; it's just MIME attachments, which means it's going to base64 encoded. Unfortunately, the iPhone SDK doesn't have a base64 encoder/decoder, so you'll have to roll your own or use a third party library. This article should help you roll your own.

Randolpho
Thanks, that got me going down the right path, however, that has lead me to another issue. I'm using the base64 decoder (by Cyrus from the article link) and for some reason the string that I extract from the MIME attachment (the encoded data) fails the decode process due to the length not being divisible by 4 with no remainder. Do I need to remove leading/trailing whitespace? newLines?
Jon
@Jon: I don't know what string you're decoding, but it's possible you've missed some characters. Perhaps one of the lines is truncated or missing?
Randolpho