Solved

Calling Livecycle ES with mx.rpc.soap.WebService using ActionScript

Posted on 2008-06-13
5
2,048 Views
Last Modified: 2013-11-11
I have Livecycle ES installed on an application server (not the machine I'm calling from).  I have Flex 3 installed on my machine.  I'm coding up a custom-built Form Guide.  I'm trying to call a process on the Livecycle ES machine with mx.rpc.soap.WebService using ActionScript.  I was able to get it working with just one parameter, but now that I have many parameters it's puking on me.  I have tested the process by invoking from Workspace and it behaves as expected.  When I try it from the formguide/Flex AS I get an IO error.  Here's the pertinent code snippet:

      import mx.controls.Alert;
      import mx.events.FlexEvent;
    import mx.rpc.events.FaultEvent;
      import mx.rpc.soap.LoadEvent;
      import mx.rpc.soap.Operation;
      import mx.rpc.soap.WebService;
      import xfamx.scripting.Xfa;
      import xfamx.utils.XMLUtils;
          
      private var stateService:WebService;
      private var _webServiceLoaded:Boolean = false; // flag noting when wsdl has been loaded
      
      private function initWebService():void {
            if (!stateService) {
                  stateService = new WebService();
                  stateService.wsdl = "http://xxx.xxx.xxx:8080/soap/services/SaveState?wsdl"; // replace this url
                  stateService.addEventListener(LoadEvent.LOAD, load_listener);
                  stateService.addEventListener(FaultEvent.FAULT, fault_listener);
                  stateService.loadWSDL();
                  mx.controls.Alert.show('Initializing WSDL', 'Message');
            }
      }
      private function saveState():void {
            initWebService(); // init webservice
            if (_webServiceLoaded) { // is wsdl is loaded
                  //stateService.setRemoteCredentials("user", "password"); -- This doesn't seem to work anyway.
                  var xmlModel:XML = new XML(Xfa.instance.datasets.saveXML());
                  stateService.invoke.send('00000000-0000-0000-0000-000000000000',false,'',xmlModel..data,'asdf',false,'asdf');
                  mx.controls.Alert.show('State Sent!', 'Message');  // Comment this out later.
            } else { // else
                  callLater(saveState); // wait a frame and try again
            }
      }
      
      public function fault_listener(event:FaultEvent):void {
          mx.controls.Alert.show(event.fault.message, 'Message');
          mx.controls.Alert.show(event.fault.rootCause.toString(), 'Root Cause toString');
          mx.controls.Alert.show(event.fault.toString(), 'fault toString');
      }
      
      public function load_listener(event:LoadEvent):void {
            _webServiceLoaded = true; // mark wsdl as loaded so we know we can use the web service
            mx.controls.Alert.show('Initialized', 'Message');
      }


Generates the following error:

Fault toString:
[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: http://xxx.xxx.xxx:8080/soap/services/SaveState"]. URL: http://xxx.xxx.xxx:8080/soap/services/SaveState"]

Root Cause toString:
[IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: http://xxx.xxx.xxx:8080/soap/services/SaveState"]

When I watch the transaction with Wireshark (PKA ethereal) I see the data send up base64 encoded, and then a 500 error coming back from the server.  So, I assume that I'm not sending the parameters correctly.  But I can't find anything about the correct formatting for sending multiple parameters to a LC ES Process using Flex 2 and ActionScript.  I don't want the mxml equivalent, I want the actionscript method.

I've already read the Adobe docs: http://livedocs.adobe.com/flex/201/langref/mx/rpc/soap/WebService.html  to no avail.

If there is a Flex expert out there, please help.  TYIA
0
Comment
Question by:MoreHeroic
  • 3
  • 2
5 Comments
 
LVL 19

Expert Comment

by:Gary Benade
ID: 21791619
Does it work if you if you test by sending a blank string in place of xmlModel..data?

Also, have a quick read through the comments here:
http://www.judahfrangipane.com/blog/?p=87
0
 
LVL 10

Author Comment

by:MoreHeroic
ID: 21796350
It is expecting an xml object so sending a string actually doesn't work.  I have read and re-read that post and the comments on it prior to posting this question.  Any other ideas?
0
 
LVL 19

Expert Comment

by:Gary Benade
ID: 21800316
Sending a string is just a way to narrow down the problem to the xml. SOAP sends data as XML so I'm wondering if the problem is caused by having another xml structure embedded. If it is the xml breaking things you could try JSON encoding it first and then decoding serverside, or perhaps simply urlEncoding it would work.
JSON is native in php and an actionscript lib can be found here http://www.darronschall.com/weblog/archives/000215.cfm
0
 
LVL 10

Author Comment

by:MoreHeroic
ID: 21803573
"When I watch the transaction with Wireshark (PKA ethereal) I see the data send up base64 encoded, and then a 500 error coming back from the server."

When flex makes the call it's taking the entire contents of the SOAP envelope and Base-64 encoding them for transmission to avoid any issues.  I know for sure that xml is not the issue as my original service, which worked great receives one input parameter - XML.  Now that I've added parameters beyond XML that's where I run into issues.

Thanks for taking the time to help me try and figure this one out.  Any other thoughts?
0
 
LVL 10

Accepted Solution

by:
MoreHeroic earned 0 total points
ID: 21816414
I was getting this error because the webserver was returning a 500 error code.  I did some poking around looking at settings and it just started mysteriously working.  No idea why, but I'm not going to complain too much right now.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AWAY 3d Using BitMapCubeTexture 1 406
Begin mp4 video on first frame 6 173
Removing Flash from Website 6 65
Actionscript in Flash 3 60
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question