Parameter sequence disturbed : Web Service in Flex
January 31, 2009 at 12:05 AM | In Flex / AS, Programming | 1 CommentTags: actionscript, flex, flex builder, NuSOAP, parameter sequence, php, Programming, web service, wizard, WS
I implemented an application in Flex that used web service, written in PHP with NuSOAP library. The WSDL file that was available for Web Service is as under:
<?xml version="1.0" encoding="ISO-8859-1"?> <definitions 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://server" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server"> <types> <xsd:schema targetNamespace="http://server" > <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" /> <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" /> </xsd:schema> </types> <message name="saveImgRequest"> <part name="id" type="xsd:string" /> <part name="data" type="xsd:string" /> <part name="emailId" type="xsd:string" /> <part name="notes" type="xsd:string" /></message> <message name="saveImgResponse"> <part name="return" type="xsd:boolean" /></message> <message name="purchaseRequest"> <part name="id" type="xsd:string" /> <part name="data" type="xsd:string" /></message> <message name="purchaseResponse"> <part name="return" type="xsd:boolean" /></message> <portType name="purchasePortType"> <operation name="saveImg"> <input message="tns:saveImgRequest"/> <output message="tns:saveImgResponse"/> </operation> <operation name="purchase"> <input message="tns:purchaseRequest"/> <output message="tns:purchaseResponse"/> </operation> </portType> <binding name="purchaseBinding" type="tns:purchasePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="saveImg"> <soap:operation soapAction="http://server/webservice.php/saveImg" style="rpc"/> <input><soap:body use="encoded" namespace="http://server" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input> <output><soap:body use="encoded" namespace="http://server" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output> </operation> <operation name="purchase"> <soap:operation soapAction="http://server/webservice.php/purchase" style="rpc"/> <input><soap:body use="encoded" namespace="http://server" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input> <output><soap:body use="encoded" namespace="http://server" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output> </operation> </binding> <service name="purchase"> <port name="purchasePort" binding="tns:purchaseBinding"> <soap:address location="http://server/webservice.php"/> </port> </service> </definitions>
After carefully considering the sequence of parameters in web service method call, I tried to import Web Service through Flex Builder’s Import web service wizard.
Surprisingly, methods that are served by the Web Service have been detected with all parameters. But, with a surprise:
Why is the sequence of parameters been changed? Neither parameters are in ascending/descending order of alphabets nor are in original sequence as are declared!
Can anyone give reason?
Ignoring unwanted sequence through import wizard, I finally implemented Web Service with parameters as are there in WSDL, and it worked fine for me!
private function initAndCallWS():void
{
saveImageWebService = new WebService();
saveImageWebService.wsdl = "http://server/webservice.php?wsdl";
saveImageWebService.saveImg.addEventListener("result", resultHandler);
saveImageWebService.saveImg.addEventListener("fault", faultHandler);
saveImageWebService.addEventListener(LoadEvent.LOAD,loadHandler);
saveImageWebService.loadWSDL();
}
private function loadHandler(event:LoadEvent):void
{
saveImageWebService.saveImg("userID","image_content", "email@server.com", "notes");
}
A statement can change the life
January 20, 2009 at 11:48 PM | In Flex / AS, Programming, Software | Leave a CommentTags: bug, component, css, enable, flex 3, font-color, Programming, sdk, stylesheet
This makes very generic sense – this is about my experience in terms of software programming.
My team was facing big pain to solve a very small – simple looking issue. Everything was logically simple and correct.
In flex 3, I disabled TextInput something like under:
objTextInput.enabled = false;
After that I tried to change color through stylesheet (CSS) and it did not work. Contradictory I was able to change font-family and font size of the same component in same fashion, and was working fine.
Changing to objTextInput.enabled = true; worked perfectly fine as expected!
What can I consider this as? A bug in Flex 3 SDK or bug in my understanding?
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.

