Olá pessoal. Sou novo em Flex e SOAP, então desculpem se a pergunta parecer óbvia demais.
Estou com um problema estranho. Tenho uma aplicação em Flex que consome um webservice, e tudo funciona muito bem até eu tentar retornar uma string maior que 490 caracteres, o que acho bastante estranho. Em meus testes, se eu tentar retornar uma string de 491 caracteres, recebo a seguinte mensagem:
SOAP Response cannot be decoded. Raw response: faultCode=“DecodingError” faultDetail=“null”
Fiz um cliente PHP, só pra testar, que consome o mesmo webservice, e chama a mesma operação. Mas no caso desse outro cliente, não tenho nenhum erro e a string é retornada completa, sem problema algum.,
Aqui está meu script:
[code]?xml version=“1.0” encoding=“utf-8”?>
<s:Application xmlns:fx=“http://ns.adobe.com/mxml/2009”
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.rpc.events.ResultEvent;
[Bindable]private var testValue:String;
protected function floappService_variableTestResultHandler(event:ResultEvent):void
{
this.testValue = event.result as String;
}
]]>
</fx:Script>
<fx:Declarations>
<s:WebService id="ws"
wsdl="mywebservice?wsdl"
<s:operation name="variableTest"
result="floappService_variableTestResultHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString)"/>
</s:WebService>
</fx:Declarations>
<mx:VBox width="100%" height="100%">
<mx:Form width="100%" height="100%">
<mx:FormItem>
<mx:HBox>
<s:Button label="Variable Test" click="ws.variableTest()"/>
<mx:Text text="{testValue}"/>
</mx:HBox>
</mx:FormItem>
</mx:Form>
</mx:VBox>
</s:Application>[/code]
Aqui a resposta que recebo, sem faltas (string com 490 'A’s)
[code]HTTP/1.1 200 OK
Date: Tue, 21 Sep 2010 17:36:46 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.2
X-SOAP-Server: NuSOAP/0.7.3 (1.114)
Content-Length: 1027
Vary: Accept-Encoding
Connection: close
Content-Type: text/xml; charset=ISO-8859-1
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:tns=“http://fusionforge.inteligis.paqtc.org.br”>
SOAP-ENV:Body
<ns1:variableTestResponse xmlns:ns1=“http://fusionforge.inteligis.paqtc.org.br”>
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
</ns1:variableTestResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>[/code]
E aqui o caso quando acontece o problema (string com 491 'A’s):
[code]HTTP/1.1 200 OK
Date: Tue, 21 Sep 2010 17:40:40 GMT
Server: Apache/2.2.14 (Ubuntu)
X-Powered-By: PHP/5.3.2-1ubuntu4.2
X-SOAP-Server: NuSOAP/0.7.3 (1.114)
Content-Length: 1028
Vary: Accept-Encoding
Connection: close
Content-Type: text/xml; charset=ISO-8859-1
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=“http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsd=“http://www.w3.org/2001/XMLSchema” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=“http://schemas.xmlsoap.org/soap/encoding/” xmlns:tns=“http://fusionforge.inteligis.paqtc.org.br”>
SOAP-ENV:Body
<ns1:variableTestResponse xmlns:ns1=“http://fusionforge.inteligis.paqtc.org.br”>
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
</ns1:variableTestResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>[/code]
Chequei os dois XMLs no XML Validator da W3 (http://www.w3schools.com/XML/xml_validator.asp), e não tive erros
A única diferença entre as duas respostas é o Content-Length, então acho que o problema está por aí (mas não sei o quê/por que)
Obrigado por qualquer ajuda que seja possível!