Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

New Contributor
Posts: 6
Registered: ‎02-13-2011
My Device: Not Specified

Calling web services problems

Hello All.


I am having problems when calling even simple web services.


I created a service that just takes a string and returns it as uppercase.


When I run from the desktop in Flash Builder Burrito, it work almost exactly half the time.


For example, the first time I call it it works fine, generates a standard HTTP/WEBSERVICE request.


POST /sqlconn/sqlconnserve.asmx HTTP/1.1
Referer: app:/Main.swf
Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, text/css, image/png, image/jpeg, image/gif;q=0.8, application/x-shockwave-flash, video/mp4;q=0.9, flv-application/octet-stream;q=0.8, video/x-flv;q=0.7, audio/mp4, application/futuresplash, */*;q=0.5
x-flash-version: 10,1,85,3
Content-Type: text/xml; charset=utf-8
SOAPAction: ""
Content-Length: 289
Accept-Encoding: gzip,deflate
User-Agent: Mozilla/5.0 (Windows; U; en-US) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  <SOAP-ENV:Body>    <tns:ListServers xmlns:tns=""/>  </SOAP-ENV:Body></SOAP-ENV:Envelope>




The second time I try to call it, it generates a  SERVICE REQUEST which never gets to the server.



 ServiceRequest: POST; WebService; POST
  body = "<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <tns:test xmlns:tns="">
  clientId = "DirectHTTPChannel0"
  contentType = "text/xml; charset=utf-8"
  destination = "DefaultHTTP"
  headers = (Object)#1
    DSEndpoint = "direct_http_channel"
  httpHeaders = (Object)#2
    SOAPAction = """"
  messageId = "6D966667-0811-849E-D0C5-87DD7D26C9B9"
  method = "POST"
  recordHeaders = true
  timestamp = 0
  timeToLive = 0
  url = ""

However, if I call the service a third time, it will work. It seems to work every other time.


One small wrinkle in all this is that if I wait a while after a call that worked (maybe 5 min), it will work.



One other thing is that if I set it to get the WSDL document from the web service, it will always fail to get the document. If I save it, and load it as a file, it loads correctly.


Here is the complete code of the MXML component that I am using.



<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
		xmlns:s="library://ns.adobe.com/flex/spark" title="WSTest">
			import mx.rpc.events.FaultEvent;

			protected function btnCall_clickHandler(event:MouseEvent):void

	<fx:Script source="SQLAppSettings.as"/>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
		<s:WebService wsdl="assets/sqlconnserve.wsdl" concurrency="single" fault="webservice1_faultHandler(event)" id="TestWS">
		<!--<s:WebService id="TestWS" wsdl="" fault="webservice1_faultHandler(event)" showBusyCursor="true" concurrency="single">-->
			<s:operation name="test" result="wstest(event)" resultFormat="object">

					import mx.rpc.events.ResultEvent;
					protected function webservice1_faultHandler(event:FaultEvent):void
						lblResult.text = event.fault.faultCode + " - " + event.fault.faultString + " - " + event.fault.faultDetail;
						trace(event.fault.faultCode + " - " + event.fault.faultString + " - " + event.fault.faultDetail);
					protected function wstest(r:ResultEvent):void
						lblResult.text = r.result.toString();
	<s:Button id="btnCall" x="80" y="192" label="Button" click="btnCall_clickHandler(event)"/>
	<s:TextInput id="txtStr" x="80" y="66"/>
	<s:Label id="lblResult" x="80" y="307"/>


What have I missed? Any suggestions? Please?




New Contributor
Posts: 6
Registered: ‎02-13-2011
My Device: Not Specified

Re: Calling web services problems - Added info

One thing that I forgot to add.


When I try it on the Playbook Sim (0.9.3 using the 0.9.3 SDK) it never works, even if I load the WSDL as a file.



New Member
Posts: 1
Registered: ‎06-15-2011
My Device: Developer
My Carrier: Developer

Re: Calling web services problems - Added info

I got the same problem. Did u find solution to this issue?