First and foremost, we must know: what is the name of the operation/method
of the web service, and what are the parameters names and datatypes. I am
not good enough at reading wsdls to offer to analyze yours, but you can
probably figure it out, or find some documentation.
For instance, where did you come up with the string,
'Find__CompIntfc__DL_TREE_IB_CI?
Next, decide whether you want to do the whole thing in AS or not. I often
declare the web service in mxml, then manipulate it in AS.
No, new GetInfo() would not be correct. Declaring the WebService in
mxml, or calling loadWSDL automatically makes the operations/methods
available to the web service instance, no need to new.
Here is a simple example that might help:
http://www.cflex.net/showfiledetails.cfm?ObjectID=223
Tracy
_
From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Jim
Sent: Thursday, March 05, 2009 11:39 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Web service, parameters, errors... Help please
Tracy,
The value you want to pass needs to be in the text node, not in an
attribute. Something like:
Find__CompIntfc__DL_TREE_IB_CIX/Find__CompIntfc__DL_TREE_IB_CI
The above line won't work; it gets the error message about
Initializer for 'Find__CompIntfc__DL_TREE_IB_CI'; values of type
com.draper.Find__CompIntfc__DL_TREE_IB_CITypeShape cannot be represented as
text. with or without quotes.
I wonder if you would be willing to help me flesh out the function path (As
I said, I'm pretty new to this, both Flex and ActionScript).
private function betterway (): void
{
var myService:GetInfo = new GetInfo();(is that right for myService?)
var sValue:String = something;
var oRequest:Object ={ Find__CompIntfc__DL_TREE_IB_CI : sValue };
myService.send();
If I try this, I get an error that there is no send() method for GetInfo. If
I switch it to
myService.findID(oRequest)
I get an error that type Object is being coerced to possibly unrelated type
com.draper:Find__CompIntfc__DL_TREE_IB_CITypeShape.
Thanks for any light you can shed.
Also, this declarative syntax is hard to debug. I suggest invoking your
call in an as function:
var sValue:String = X:
var oRequest:Object ={ Find__CompIntfc__DL_TREE_IB_CI : sValue };
myService.send(oRequest);
Tracy
_
From: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com
[mailto:flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com]
On
Behalf Of Jim
Sent: Thursday, March 05, 2009 8:57 AM
To: flexcod...@yahoogro mailto:flexcoders%40yahoogroups.com ups.com
Subject: [flexcoders] Web service, parameters, errors... Help please
I'm new to Flex and web services. I've created a web service in PeopleSoft
and successfully imported the WSDL into Flex so that it has contacted the
PS
server and returned data (using mx:WebService and mx:Operation code I
found
examples of). However, I have been unable to pass a parameter to the
service
from Flex using that code. I then discovered and followed the sample code
in
the Flex-generated package, but no matter what I do I cannot successfully
supply the myValue in the sample shown below. Here is Flex's own text in
my GetInfo.as file built by Flex:
* MXML sample code:
* First you need to map the package where the files were generated to a
namespace, usually on the mx:Application tag, like this:
xmlns:ws=com.draper.*
* Define the service and within its tags set the request wrapper for the
desired operation
* ws:GetInfo id=myService
* ws:FindID_request_varws:FindID_request
Find__CompIntfc__DL_TREE_IB_CI=myValue/
* /ws:FindID_request_var
* /ws:GetInfo
* Then call the operation for which you have set the request wrapper value
above, like this:
* mx:Button id=myButton label=Call operation
click=myService.FindID_send() /
My code is:
ws:GetInfo id=userRequest
ws:findID_request_varws:FindID_request
Find__CompIntfc__DL_TREE_IB_CI=X/
/ws:findID_request_var
/ws:GetInfo
When I try to run it, Flex is unhappy with the value I am assigning (X
above) no matter what I put there. If I omit the double quotes and try to
assign a text input field value (which is my goal here), it complains that
it expects a double quote. If I put almost anything else there, it
complains
either:
Initializer for 'Find__CompIntfc__DL_TREE_IB_CI'; values of type
com.draper.Find__CompIntfc__DL_TREE_IB_CITypeShape cannot be represented
as
text.
or, if I try this line, where I attempt to pass a text input field:
ws:FindID_request Find__CompIntfc__DL_TREE_IB_CI={compID.text}/
then I get:
1067: Implicit coercion of a value of type String to an unrelated type
com.draper:Find__CompIntfc__DL_TREE_IB_CITypeShape
Can anyone help with this please?
Thanks
Jim