我有一个的Flex应用程序需要抓住从JasperReports的服务器报告数据,通过的JasperReports Server Web服务API。 Flex Builder 3在生成Web服务消耗代码方面做得不错,只有一个例外。如果你问一个目录列表或报表参数的会计,JR服务器在SOAP包装和的Flex解析它就好了返回纯XML 。但是,如果你问一个报告本身,无论是在XML或PDF格式,它回来作为多MIME消息,一些描述XML作为第一部分和报告 - 即使报告本身是XML - 作为第二部分。 Flex不知道如何处理多部分消息,只是抱怨无效XML。解析Flex中的多部分SOAP响应?
下面是响应的示例。我目前的策略是做一些字符串解析并单独管理位。但Flex有任何内置的方法来处理这个? (我一直无法找到任何。)
------=_Part_2_27050467.1235668849951
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: binary
Content-Id: <0F082AF1DAF83B3077B1867B4FC8AAA6>
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ns1:runReportResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://axis2.ws.jasperserver.jaspersoft.com">
<runReportReturn xsi:type="xsd:string"><?xml version="1.0" encoding="UTF-8"?>\n<operationResult version="2.0.1">\n\t<returnCode><![CDATA[0]]></returnCode>\n</operationResult>\n
</runReportReturn>
</ns1:runReportResponse>
</soapenv:Body>
</soapenv:Envelope>
------=_Part_2_27050467.1235668849951
Content-Type: application/pdf
Content-Transfer-Encoding: binary
Content-Id: <report>
%PDF-1.4\n%âãÏÓ\n1 0 obj <</Filter/FlateDecode/Length 29>>stream\nx+är\ná26S°00S\bIár\rá\näâ