如何处理以下Web服务响应?

时间:2011-05-04 16:46:41

标签: iphone web-services ios soap

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<DownloadFaxDocResponse xmlns="http://tempuri.org/">
<DownloadFaxDocResult>
<FileDownload xmlns="" />
</DownloadFaxDocResult>
</DownloadFaxDocResponse>
</soap:Body>
</soap:Envelope>

文档说我要获得base64编码的TIF / PNG文件。我什么都没看到。这是否意味着我的网络服务电话有问题?

文档位于:

http://glostream.faxregistration.com/sfaxapi.asmx?op=DownloadFaxDoc

这是我的标题代码:

//---set the headers---
    NSString *msgLength = [NSString stringWithFormat:@"%d", [xmlString length]];
    [request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [request addValue:@"http://tempuri.org/DownloadFaxDoc" forHTTPHeaderField:@"SOAPAction"];
    [request addValue:msgLength forHTTPHeaderField:@"Content-Length"];

    //---set the HTTP method and body---
    [request setHTTPMethod:@"POST"];
    [request setHTTPBody: data];

2 个答案:

答案 0 :(得分:1)

是的,我会说查询有问题。如果您获得base64编码数据,它将如下所示:

<DownloadFaxDocResult>iVBORw0KGgoAAAANSUhEUgA25CSFPinfIIQQvaGIMQyjrYj98hohhOgNRYxhGH1F7AghhOg
 NOviD1GCCF6QxFjGER ... LOTS MORE ... <DownloadFaxDocResult>

答案 1 :(得分:0)

从您附上的链接显示:

<soap:Body>
   <DownloadFaxDocResponse xmlns="http://tempuri.org/">
   <DownloadFaxDocResult>xml</DownloadFaxDocResult>
   </DownloadFaxDocResponse>    
</soap:Body>  

返回结果应该是XMLNode对象,而不是二进制文件。