Implementing Salesforce Login Solutuion With Flex 3

July 3rd, 2009 by chirag.babaria § 0

In this post, we will see how we can implement salesforce login with flex.

All you need is:

For the beginner steps for integration of flex toolkit for salesforce you can follow the steps given in below site

http://wiki.developerforce.com/index.php/Tutorial:_Creating_Flex_Salesforce_Mashups

While regarding the login method I will be describing as follows:

The namespaces to be included in flex builder for login are as follows:

connectivity

namespace for flex to salesforce

The Login function will be as follows:

Login

Login method for flex to salesforce

There is a common error while implementing login with salesforce, it will generate following error:

(com.salesforce.events::ApexFaultEvent)#0

bubbles = false

cancelable = true

context = (null)

currentTarget = (null)

eventPhase = 2

fault = (mx.rpc::Fault)#1

errorID = 0

faultCode = “Server.Error.Request”

faultDetail = “Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0″

faultString = “HTTP request error”

message = “faultCode:Server.Error.Request faultString:’HTTP request error’ faultDetail:’Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0′”

name = “Error”

rootCause = (flash.events::IOErrorEvent)#2

bubbles = false

cancelable = false

currentTarget = (flash.net::URLLoader)#3

bytesLoaded = 0

bytesTotal = 0

data = (null)

dataFormat = “text”

eventPhase = 2

target = (flash.net::URLLoader)#3

text = “Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0″

type = “ioError”

message = (mx.messaging.messages::ErrorMessage)#4

body = (Object)#5

clientId = “DirectHTTPChannel0″

correlationId = “026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8″

destination = “”

extendedData = (null)

faultCode = “Server.Error.Request”

faultDetail = “Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://www.salesforce.com/services/Soap/u/11.0"]. URL: http://www.salesforce.com/services/Soap/u/11.0″

faultString = “HTTP request error”

headers = (Object)#6

messageId = “154CD995-435D-2011-47FB-CDE8A2A25895″

rootCause = (flash.events::IOErrorEvent)#2

timestamp = 0

timeToLive = 0

messageId = “154CD995-435D-2011-47FB-CDE8A2A25895″

target = (null)

token = (mx.rpc::AsyncToken)#7

message = (mx.messaging.messages::HTTPRequestMessage)#8

body = “<se:Envelope xmlns:se=”http://schemas.xmlsoap.org/soap/envelope/”><se:Header xmlns:sfns=”urnartner.soap.sforce.com”/><se:Body><login xmlns=”urnartner.soap.sforce.com” xmlns:ns1=”sobject.partner.soap.sforce.com”><username>[email protected]</username>

<password>xxxxxxxxxxxxx9KYz1Hmt965XXXXQcNVpjaq61</password></login></se:Body></se:Envelope>”

clientId = (null)

contentType = “text/xml; charset=UTF-8″

destination = “DefaultHTTP”

headers = (Object)#9

DSEndpoint = “direct_http_channel”

httpHeaders = (Object)#10

Accept = “text/xml”

SOAPAction = “”"”

X-Salesforce-No-500-SC = “true”

messageId = “026E48D3-1BFD-8AA6-A5D6-CDE8A1C8B7D8″

method = “POST”

recordHeaders = false

timestamp = 0

timeToLive = 0

url = “http://www.salesforce.com/services/Soap/u/11.0″

responders = (Array)#11

[0] (::SalesForceResponder)#12

result = (null)

type = “fault”

Solution

The Flex security model will require that you are running this on https server, unless you specify “http” using connection.protocol();
If your server is not HTTPS, but is HTTP, you can set that on the connection.

In addition, you will need to pass a security token appended to your password unless you have enabled the IP range in your network configuration.

Both will generate the io error you see.

If you are using “HTTPS” then you have to specify

connectionprotocol = “https”

And make sure that in salesforce.com by default “Require secure connections (https)” is checked

HTTPS

Sales force security setting

But if you are using “http”, then you have to specify

connectionprotocol = “http”;

And make sure that in salesforce.com by default “Require secure connections (https)” is checked to false.

HTTP

salesforce https setting

Where Am I?

You are currently browsing entries tagged with Http protocol error at Digicorp.