<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Flex and PHP web-service</title>
	<atom:link href="http://www.flexer.info/2008/02/17/flex-and-php-web-service/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.flexer.info/2008/02/17/flex-and-php-web-service/</link>
	<description>flex developers web corner</description>
	<lastBuildDate>Wed, 18 Jan 2012 13:28:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: gan</title>
		<link>http://www.flexer.info/2008/02/17/flex-and-php-web-service/comment-page-1/#comment-944</link>
		<dc:creator>gan</dc:creator>
		<pubDate>Sat, 22 Nov 2008 18:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/2008/02/17/flex-and-php-web-service/#comment-944</guid>
		<description>Hi Virgil Cristea 

Nice to talk to you. As I told that I&#039;m passing simple add array value to .net web service. I&#039;m receiving this error:
--------------
fault: [FaultEvent fault=[RPC Fault faultString=&quot;HTTP request error&quot; faultCode=&quot;Server.Error.Request&quot; faultDetail=&quot;Error: [IOErrorEvent type=&quot;ioError&quot; bubbles=false cancelable=false eventPhase=2 text=&quot;Error #2032: Stream Error. URL: http://localhost:1474/IPosRepositoryWebservice1/Service.asmx&quot;]. URL: http://localhost:1474/IPosRepositoryWebservice1/Service.asmx&quot;] messageId=&quot;D32F9543-F17A-4296-DE42-C4BBC73144BF&quot; type=&quot;fault&quot; bubbles=false cancelable=true eventPhase=2]
-----------------
net code. 
------------------ 
Service.vb 
------------------ 
&lt;code&gt; 
&lt;WebMethod()&gt; _ 
       Public Function Addsample(ByVal ParamArray x() As Object) As 
Integer 
        &#039;ByVal ParamArray x() As Object 
        Dim intRowCount As Object 
        Dim strSQLselect As String = &quot;Select id from mk where id=&quot; &amp; x 
(0) 
        Try 
            Addsample = DAL1.Check_Availability(strSQLselect) 
            If x(0) = Addsample Then 
                intRowCount = DAL1.UpdatePersonalDetails(x) 
            Else 
                intRowCount = DAL1.insert(x) 
            End If 
        Catch ex As System.Exception 
            Throw ex 
        End Try 
        Return intRowCount 
    End Function 
End Class 
Dal1.vb 
Public Shared Function insert(ByVal ParamArray I() As Object) As 
Integer 
        Dim cmdObj As New SqlCommand 
        Dim intRowCount As Integer 
        Try 
            &#039; Dim strSQLinsert As String = &quot;insert into mk 
(id,name,date1) values (&#039;&quot; &amp; I(0) &amp; &quot;&#039;,&#039;&quot; &amp; I(1) &amp; &quot;&#039;,&#039;&quot; &amp; I(2) &amp; &quot;&#039;)&quot; 
            Dim strSQLinsert As String = &quot;insert into mk  (id) values 
(&#039;&quot; &amp; I(0) &amp; &quot;&#039;)&quot; 
            cmdObj.CommandText = strSQLinsert 
            cmdObj.CommandType = CommandType.Text 
            cmdObj.Connection = DAL.GetDBConnection(&quot;07&quot;) 
            intRowCount = cmdObj.ExecuteNonQuery() 
            Return intRowCount 
        Catch ex As System.Exception 
            Throw ex 
        Finally 
            cmdObj.Connection.Close() 
            cmdObj.Dispose() 
        End Try 
    End Function 
End Class
&lt;/code&gt;
-----------------
flex code : 
-----------------
&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
layout=&quot;absolute&quot;&gt;
&lt;!--WEBSERVICE--&gt;
&lt;!--WEBSERVICE - SUBMIT --&gt;
&lt;mx:Script&gt;
&lt;![CDATA[
import mx.controls.Alert;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.soap.LoadEvent;
import mx.collections.ArrayCollection;
import mx.managers.CursorManager;
import mx.utils.ArrayUtil;
import mx.rpc.soap.WebService;
private var p1:Array;
public function SubmitUseWebService():void {
CursorManager.setBusyCursor();
WS.addEventListener(&quot;load&quot;, SubmitLoadHandler);
WS.loadWSDL();
}
public function SubmitLoadHandler(event:LoadEvent):void {
p1.push(int(userid.text));
p1.push(Name.text);
p1.push(mDOB.text);
Alert.show(p1[0]);
WS.Addsample(p1);
}
public function SubmitResultHandler(event:ResultEvent):void {
 var resultObj:Object = event.result as Object ;
            var updated:Boolean = resultObj.SUCCESS ;
            if (updated == true) {
                Alert.show(&quot;Records Updated Successfully&quot;);
                CursorManager.removeBusyCursor();
            } else {
                Alert.show(&quot;Records NOT Updated&quot;);
                CursorManager.removeBusyCursor();
            }
CursorManager.removeBusyCursor();
}
public function SubmitFaultHandler(event:FaultEvent):void {
Alert.show( &quot;fault: &quot;+ event.toString());
CursorManager.removeBusyCursor();
}
]]&gt;
&lt;/mx:Script&gt;
&lt;!-- create Webservice --&gt;
&lt;mx:WebService id=&quot;WS&quot; wsdl=&quot;http://localhost:1474/test/Service.asmx?
WSDL&quot; useProxy=&quot;false&quot;
        fault=&quot;Alert.show(event.fault.faultString), &#039;Error&#039;&quot;&gt;
&lt;mx:operation name=&quot;Addsample&quot; result=&quot;SubmitResultHandler(event)&quot;
fault=&quot;SubmitFaultHandler(event)&quot;/&gt;
&lt;/mx:WebService&gt;
        &lt;mx:TextInput x=&quot;191&quot; y=&quot;56&quot; id=&quot;userid&quot;/&gt;
        &lt;mx:TextInput x=&quot;191&quot; y=&quot;86&quot; id=&quot;Name&quot;/&gt;
        &lt;mx:Button x=&quot;257&quot; y=&quot;168&quot; label=&quot;Submit&quot; click=&quot;SubmitUseWebService()&quot;/&gt;
        &lt;mx:Label x=&quot;75&quot; y=&quot;58&quot; text=&quot;ID&quot;/&gt;
        &lt;mx:Label x=&quot;75&quot; y=&quot;88&quot; text=&quot;Name&quot;/&gt;
        &lt;mx:Label x=&quot;75&quot; y=&quot;118&quot; text=&quot;DOB&quot;/&gt;
&lt;mx:DateField x=&quot;191&quot; y=&quot;116&quot; id=&quot;mDOB&quot;/&gt;
&lt;/mx:Application&gt;
&lt;/code&gt;         

thanks 

regards
gan</description>
		<content:encoded><![CDATA[<p>Hi Virgil Cristea </p>
<p>Nice to talk to you. As I told that I&#8217;m passing simple add array value to .net web service. I&#8217;m receiving this error:<br />
&#8212;&#8212;&#8212;&#8212;&#8211;<br />
fault: [FaultEvent fault=[RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: <a href="http://localhost:1474/IPosRepositoryWebservice1/Service.asmx" rel="nofollow">http://localhost:1474/IPosRepositoryWebservice1/Service.asmx</a>"]. URL: <a href="http://localhost:1474/IPosRepositoryWebservice1/Service.asmx" rel="nofollow">http://localhost:1474/IPosRepositoryWebservice1/Service.asmx</a>&#8220;] messageId=&#8221;D32F9543-F17A-4296-DE42-C4BBC73144BF&#8221; type=&#8221;fault&#8221; bubbles=false cancelable=true eventPhase=2]<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
net code.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Service.vb<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<code><br />
&lt;WebMethod()&gt; _<br />
       Public Function Addsample(ByVal ParamArray x() As Object) As<br />
Integer<br />
        'ByVal ParamArray x() As Object<br />
        Dim intRowCount As Object<br />
        Dim strSQLselect As String = "Select id from mk where id=" &amp; x<br />
(0)<br />
        Try<br />
            Addsample = DAL1.Check_Availability(strSQLselect)<br />
            If x(0) = Addsample Then<br />
                intRowCount = DAL1.UpdatePersonalDetails(x)<br />
            Else<br />
                intRowCount = DAL1.insert(x)<br />
            End If<br />
        Catch ex As System.Exception<br />
            Throw ex<br />
        End Try<br />
        Return intRowCount<br />
    End Function<br />
End Class<br />
Dal1.vb<br />
Public Shared Function insert(ByVal ParamArray I() As Object) As<br />
Integer<br />
        Dim cmdObj As New SqlCommand<br />
        Dim intRowCount As Integer<br />
        Try<br />
            ' Dim strSQLinsert As String = "insert into mk<br />
(id,name,date1) values ('" &amp; I(0) &amp; "','" &amp; I(1) &amp; "','" &amp; I(2) &amp; "')"<br />
            Dim strSQLinsert As String = "insert into mk  (id) values<br />
('" &amp; I(0) &amp; "')"<br />
            cmdObj.CommandText = strSQLinsert<br />
            cmdObj.CommandType = CommandType.Text<br />
            cmdObj.Connection = DAL.GetDBConnection("07")<br />
            intRowCount = cmdObj.ExecuteNonQuery()<br />
            Return intRowCount<br />
        Catch ex As System.Exception<br />
            Throw ex<br />
        Finally<br />
            cmdObj.Connection.Close()<br />
            cmdObj.Dispose()<br />
        End Try<br />
    End Function<br />
End Class<br />
</code><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
flex code :<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
<code><br />
&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"<br />
layout="absolute"&gt;<br />
&lt;!--WEBSERVICE--&gt;<br />
&lt;!--WEBSERVICE - SUBMIT --&gt;<br />
&lt;mx:Script&gt;<br />
&lt;![CDATA[<br />
import mx.controls.Alert;<br />
import mx.rpc.events.ResultEvent;<br />
import mx.rpc.events.FaultEvent;<br />
import mx.rpc.soap.LoadEvent;<br />
import mx.collections.ArrayCollection;<br />
import mx.managers.CursorManager;<br />
import mx.utils.ArrayUtil;<br />
import mx.rpc.soap.WebService;<br />
private var p1:Array;<br />
public function SubmitUseWebService():void {<br />
CursorManager.setBusyCursor();<br />
WS.addEventListener("load", SubmitLoadHandler);<br />
WS.loadWSDL();<br />
}<br />
public function SubmitLoadHandler(event:LoadEvent):void {<br />
p1.push(int(userid.text));<br />
p1.push(Name.text);<br />
p1.push(mDOB.text);<br />
Alert.show(p1[0]);<br />
WS.Addsample(p1);<br />
}<br />
public function SubmitResultHandler(event:ResultEvent):void {<br />
 var resultObj:Object = event.result as Object ;<br />
            var updated:Boolean = resultObj.SUCCESS ;<br />
            if (updated == true) {<br />
                Alert.show("Records Updated Successfully");<br />
                CursorManager.removeBusyCursor();<br />
            } else {<br />
                Alert.show("Records NOT Updated");<br />
                CursorManager.removeBusyCursor();<br />
            }<br />
CursorManager.removeBusyCursor();<br />
}<br />
public function SubmitFaultHandler(event:FaultEvent):void {<br />
Alert.show( "fault: "+ event.toString());<br />
CursorManager.removeBusyCursor();<br />
}<br />
]]&gt;<br />
&lt;/mx:Script&gt;<br />
&lt;!-- create Webservice --&gt;<br />
&lt;mx:WebService id="WS" wsdl="http://localhost:1474/test/Service.asmx?<br />
WSDL" useProxy="false"<br />
        fault="Alert.show(event.fault.faultString), 'Error'"&gt;<br />
&lt;mx:operation name="Addsample" result="SubmitResultHandler(event)"<br />
fault="SubmitFaultHandler(event)"/&gt;<br />
&lt;/mx:WebService&gt;<br />
        &lt;mx:TextInput x="191" y="56" id="userid"/&gt;<br />
        &lt;mx:TextInput x="191" y="86" id="Name"/&gt;<br />
        &lt;mx:Button x="257" y="168" label="Submit" click="SubmitUseWebService()"/&gt;<br />
        &lt;mx:Label x="75" y="58" text="ID"/&gt;<br />
        &lt;mx:Label x="75" y="88" text="Name"/&gt;<br />
        &lt;mx:Label x="75" y="118" text="DOB"/&gt;<br />
&lt;mx:DateField x="191" y="116" id="mDOB"/&gt;<br />
&lt;/mx:Application&gt;<br />
</code>         </p>
<p>thanks </p>
<p>regards<br />
gan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virgil Cristea</title>
		<link>http://www.flexer.info/2008/02/17/flex-and-php-web-service/comment-page-1/#comment-53</link>
		<dc:creator>Virgil Cristea</dc:creator>
		<pubDate>Tue, 19 Feb 2008 08:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/2008/02/17/flex-and-php-web-service/#comment-53</guid>
		<description>Yes I did try some AMF some time ago. The reason why I chose xml over amf was the market penetration of XML. In cases I return the data directly from MSSQL as an XML and I not want to add another layer to convert it to AMF on the webservices (they are also used by non-Flex Apps).

About security yes you can use setCredential, tokens or even WS-Security methods (I know that Adobe did not implement them in flex but there is a way to make it work.. in the next article).</description>
		<content:encoded><![CDATA[<p>Yes I did try some AMF some time ago. The reason why I chose xml over amf was the market penetration of XML. In cases I return the data directly from MSSQL as an XML and I not want to add another layer to convert it to AMF on the webservices (they are also used by non-Flex Apps).</p>
<p>About security yes you can use setCredential, tokens or even WS-Security methods (I know that Adobe did not implement them in flex but there is a way to make it work.. in the next article).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Badu</title>
		<link>http://www.flexer.info/2008/02/17/flex-and-php-web-service/comment-page-1/#comment-52</link>
		<dc:creator>Badu</dc:creator>
		<pubDate>Tue, 19 Feb 2008 06:35:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.flexer.info/2008/02/17/flex-and-php-web-service/#comment-52</guid>
		<description>I&#039;m using AMF.PHP - which in fact, introduced me to Flex - which seems much simpler/faster, in a sense of developing. Have you tried it?
Regarding security issues (from previous post in series), besides setCredential, you can use a internal appID which is sent with every message to the service (build your Flex class this way) - so you make sure that your application is the only one that uses your service.</description>
		<content:encoded><![CDATA[<p>I&#8217;m using AMF.PHP &#8211; which in fact, introduced me to Flex &#8211; which seems much simpler/faster, in a sense of developing. Have you tried it?<br />
Regarding security issues (from previous post in series), besides setCredential, you can use a internal appID which is sent with every message to the service (build your Flex class this way) &#8211; so you make sure that your application is the only one that uses your service.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

