Ok, so xml is valid, now you have to figure out why the decoding fails.  That 
is not my area of expertise, but I thought if you used RegisterClass properly, 
the decoding would get done for you

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of 
Sebastien ARBOGAST
Sent: Saturday, November 03, 2007 4:51 AM
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Issue with SOAPDecoder

 

When I set resultFormat to e4x instead of object, I get the following
value in event.result:

<res:getAllUsersResponse xmlns:res="http://soapenc/";
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ 
<http://schemas.xmlsoap.org/soap/envelope/> "
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
<http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
<arg0>
<fullName>
SÌ(c)bastien Arbogast
</fullName>
<id>
1
</id>
<username>
sarbogast
</username>
</arg0>
</res:getAllUsersResponse>

And then of course the conversion fails:
private function _getAllUsers_populate_results(event:ResultEvent):void
{
var e:GetAllUsersResultEvent = new GetAllUsersResultEvent();
e.result = event.result as ArrayOfUserListItem;
getAllUsers_lastResult = e.result;
dispatchEvent(e);
}

What do you think?

2007/11/3, Alex Harui <[EMAIL PROTECTED] <mailto:aharui%40adobe.com> >:
>
>
>
>
>
>
>
>
>
> Try different resultFormat. "e4x" first to see if the raw XML is coming back 
> is valid from the player's perspective.
>
>
>
> ________________________________

>
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>  
> [mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> ] On 
> Behalf Of Sebastien ARBOGAST
> Sent: Friday, November 02, 2007 8:45 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Issue with SOAPDecoder
>
>
>
>
>
>
>
> I'm having a hard time with a SOAP webservice client.
> I've deployed my webservice locally with a crossdomain.xml file
> allowing connections from everywhere.
> I've tested my webservice with a SOAP tester (SOAP Client on the Mac),
> and it works great: it actually returns something.
> Then I've imported the WSDL file into Flex Builder 3 in order to
> generate stubs and everything.
> The code compiles, the webservice is called, the response comes back
> but the lastResult is always null.
> I've debugged the whole thing until the point where the result is processed:
>
> private function processResult(result:Object,wrappedData:Object):void
> {
> var token:AsyncToken = wrappedData.returnToken;
> var currentOperation:WSDLOperation = wrappedData.operation;
> var decoder:SOAPDecoder = new SOAPDecoder();
> decoder.resultFormat="object";
> decoder.ignoreWhitespace = true;
> decoder.makeObjectsBindable=true;
> decoder.wsdlOperation = currentOperation;
> decoder.schemaManager = currentOperation.schemaManager;
> var body:Object = result.message.body;
> var stringResult:String = String(body);
> if(stringResult == null || stringResult == "")
> return;
> var soapResult:SOAPResult =
> decoder.decodeResponse(result.message.body);
> if(soapResult.isFault)
> {
> var faults:Array = soapResult.result as Array;
> for each (var soapFault:Fault in faults)
> {
> var soapFaultEvent:FaultEvent =
> FaultEvent.createEvent(soapFault,token,null);
> token.dispatchEvent(soapFaultEvent);
> }
> } else {
> result = decoder.decodeResponse(result.message.body).result;
> if(result is ArrayCollection)
> {
> //shoud upcast to specific type here
> var arrayTypedClass:Class =
> SchemaTypeRegistry.getClass(currentOperation.outputMessage.parts[0].type);
> result = new arrayTypedClass(result.source);
> }
> var event:ResultEvent =
> ResultEvent.createEvent(result,token,null)
> token.dispatchEvent(event);
> }
> }
>
> And even though stringResult contains a response with data, that
> corresponds to what I get in SOAP client, the result of the call to
> decoder.decodeResponse(result.message.body) is always null.
>
> So obviously something is wrong with SOAPDecoder, but I can't find any
> source for it.
>
> By the way, here is the content of stringResult that is decoded:
> <?xml version='1.0' encoding='utf-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ 
> <http://schemas.xmlsoap.org/soap/envelope/> "
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
> <soapenv:Header>
> <wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
> getAllUsers
> </wsa:Action>
> <wsa:ReplyTo xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
> <wsa:Address>
> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous> 
> </wsa:Address>
> </wsa:ReplyTo>
> <wsa:From xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
> <wsa:Address>
> http://localhost:8080/basement-ws/services/UserManagementService 
> <http://localhost:8080/basement-ws/services/UserManagementService> 
> </wsa:Address>
> </wsa:From>
> <wsa:MessageID xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing 
> <http://schemas.xmlsoap.org/ws/2004/08/addressing> ">
> 5F233385193DA1559D11940612843298
> </wsa:MessageID>
> </soapenv:Header>
> <soapenv:Body>
> <res:getAllUsersResponse xmlns:res="http://soapenc/";>
> <arg0 xmlns="">
> <fullName xmlns="">SÃ(c)bastien Arbogast</fullName>
> <id xmlns="">1</id>
> <username xmlns="">sarbogast</username>
> </arg0>
> </res:getAllUsersResponse>
> </soapenv:Body>
> </soapenv:Envelope>
>
> --
> Sébastien Arbogast
>
> http://www.sebastien-arbogast.com <http://www.sebastien-arbogast.com> 
>
>
>
> 

-- 
Sébastien Arbogast

http://www.sebastien-arbogast.com <http://www.sebastien-arbogast.com> 

 

Reply via email to