Ben, thanks for your comments.

I added that to my list of variations and it results in the same 
traceback as does my variation six -- that is, it generates an error 
saying that sendStrings (or arg0) was an unexpected parameter found 
in the input :(.

However... without seeing the relevant portion of your WSDL and XSD 
I can't be positive that I did the mapping in the exact same 
fashion, so if you could post the relevant portions that would be 
great.

Thanks for the help.

--Kaleb

--- In [email protected], "ben.clinkinbeard" 
<[EMAIL PROTECTED]> wrote:
>
> I didn't read through all of your code but here is the method I 
have
> been using with success.
> 
> var op:Operation = service.getOperation("GetDataByGrouping") as 
Operation;
> op.resultFormat = "e4x";
> // temp object to store arguments
> var args:Object = new Object();
> args.groupingRequests = new Object();
> args.groupingRequests.GroupName = "RPRToolStaticData";
> 
> op.arguments = args;
> service.GetDataByGrouping();
> 
> HTH,
> Ben
> 
> --- In [email protected], "kaleb_pederson" <kibab@> 
wrote:
> >
> > Hello,
> > 
> > I'm trying to send some arguments to a webservice, but every 
> > variation I have tried other than generating the XML from 
scratch 
> > keeps failing (eg. sends an empty message body).  Relevant parts 
of 
> > the WSDL are as follows:
> > 
> >   <message name="sendStrings">
> >     <part element="tns:sendStrings" name="parameters"></part>
> >   </message>
> >   <message name="sendStringsResponse">
> >     <part element="tns:sendStringsResponse" 
> > name="parameters"></part>
> >   </message>
> > ...
> >    <operation name="sendStrings">
> >       <input message="tns:sendStrings"></input>
> >       <output message="tns:sendStringsResponse"></output>
> >     </operation>
> > 
> > And from the XSD:
> > 
> >   <xs:element 
> > xmlns:ns3="http://server.webservices.tutorials.wakaleo.com/"; 
> > type="ns3:sendStrings" name="sendStrings"></xs:element>
> > 
> >   <xs:complexType name="sendStrings">
> >     <xs:sequence>
> >       <xs:element type="xs:string" minOccurs="0" name="arg0" 
> > maxOccurs="unbounded"></xs:element>
> >     </xs:sequence>
> >   </xs:complexType>
> > 
> >   <xs:element 
> > xmlns:ns4="http://server.webservices.tutorials.wakaleo.com/"; 
> > type="ns4:sendStringsResponse" 
> > name="sendStringsResponse"></xs:element>
> > 
> >   <xs:complexType name="sendStringsResponse">
> >     <xs:sequence>
> >       <xs:element type="xs:string" minOccurs="0" name="return" 
> > maxOccurs="unbounded"></xs:element>
> >     </xs:sequence>
> >   </xs:complexType>
> > 
> > Based on everything that I have been able to find in the 
> > documentation and on flexcoders, there are a number of different 
> > ways to send requests to the web service, so I tried each of the 
> > ones that I could find.
> > 
> > However, only one of them succeeds -- specifically, the case 
where I 
> > build an XMLDocument from scratch and send it.  All the other 
cases 
> > fail -- that is, they do not pass *any* arguments to the web 
> > service.
> > 
> > The following TestCase (which is kind of long) shows the 
different 
> > variations that have been tried.  The main things of interest 
are 
> > the variationN functions in the beginning of the class as these 
test 
> > the different ways to call the web service.  If TestCase had an 
> > asyncSetup function the sample case could be quite a bit 
shorter... 
> > (but perhaps I'll work on that next):
> > 
> > package code
> > {
> >   import flash.events.Event;
> >   import flexunit.framework.TestCase;
> >   import mx.rpc.events.FaultEvent;
> >   import mx.rpc.events.ResultEvent;
> >   import mx.rpc.soap.LoadEvent;
> >   import mx.rpc.soap.mxml.WebService;
> >   import flash.utils.describeType;
> >   import mx.rpc.events.AbstractEvent;
> >   import mx.rpc.AbstractOperation;
> >   import flash.xml.XMLDocument;
> >   import flash.xml.XMLNode;
> >   
> >   
> >   public class TestSendStrings extends TestCase
> >   {
> >     private var ws:WebService;
> >     private static const SERVICE_TIMEOUT:Number = 2000;
> >     private var wsdlUrl:String 
> > = "http://192.168.1.108:8080/stockquotes/stock_quote?wsdl";;
> >     private var responseHandler:String;
> >     private var sendStringsFunc:String;
> >     
> >     // these are the different variations that I have tried. Of 
> > these
> >     // different variations, variation9 succeeds because I have 
hand
> >     // crafted a valid message body (NOTE that variation 8 fails 
and
> >     // that the only difference is XML vs. XMLDocument).  
variation6
> >     // generates a fault, so it fails for a different reason 
than
> >     // some of the others
> >     private function variation1():void {
> >       trace('variation1');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.arguments = new Array('variation','one');
> >       op.send();
> >     }
> >     
> >     private function variation2():void {
> >       trace('variation2');
> >       ws.sendStrings.arguments = new Array('variation','two');
> >       ws.sendStrings.send();
> >     }
> >     
> >     private function variation3():void {
> >       trace('variation3');
> >       ws.sendStrings.send(new Array('variation','three'));
> >     }
> >     
> >     private function variation4():void {
> >       trace('variation4');
> >       ws.sendStrings.send('variation','four');
> >     }
> >     
> >     private function variation5():void {
> >       trace('variation5');
> >       ws.sendStrings('variation','five');
> >     }
> >     
> >     private function variation6():void {
> >       // this function results in a fault event:
> >       // Unexpected parameter 'sendStrings' found in input 
> > arguments.
> >       trace('variation6');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.arguments = {sendStrings:{arg0:new 
> > Array('variation','six')}};
> >       op.send();
> >     }
> >     
> >     private function variation7():void {
> >       trace('variation7');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send({sendStrings:{arg0:new 
Array('variation','six')}});
> >     }
> >     
> >     private function variation8():void {
> >       trace('variation8');
> >       var xml:XML = new XML('<ns1:sendStrings 
> > xmlns:ns1="http://server.webservices.tutorials.wakaleo.com/";>' +
> >         '<arg0>variation</arg0><arg0>eight</arg0>' +
> >         '</ns1:sendStrings>');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send(xml);
> >     }
> >     
> >       private function variation9():void {
> >       trace('variation9');
> >       var xml:XMLDocument = new XMLDocument('<ns1:sendStrings 
> > xmlns:ns1="http://server.webservices.tutorials.wakaleo.com/";>' +
> >         '<arg0>variation</arg0><arg0>nine</arg0>' +
> >         '</ns1:sendStrings>');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send(xml);
> >     }
> >     
> >     protected function handleResult(event:ResultEvent, 
> > expectedResult:Object):void {
> >       trace('---------------------------');
> >       trace('message body: ' + event.message.body);
> >       var actualResult:String = "null";
> >       var xml:XML = new XML(event.message.body);
> >       var a:Array = resultToStringArray(xml);
> >       if (a != null)
> >         actualResult = a.toString();
> >       assertEquals(expectedResult.toString(), actualResult);
> >     }
> >     
> >     private function resultToStringArray(xml:XML):Array {
> >       if (xml != null) {
> >         // I would be better off to iterate over the namespace 
> > declarations
> >         // to find out what the prefix is for the soap 
namespace, 
> > but since
> >         // I know what it is for the particular service that I'm 
> > currently
> >         // working with, I'm just going to hard code the fetch.
> >         var soapNS:Namespace = xml.namespace("soapenv")
> >         var tutNS:Namespace = xml.namespace("ns1");
> >         var res:Array = new Array();
> >         for each (var node:XML in 
> > xml.soapNS::Body.tutNS::sendStringsResponse.children()) {
> >           res.push(node.text());
> >         }
> >         return res;
> >       }
> >       return null;
> >     }
> >     
> >     private function privateSetup(func:Function):void{
> >       trace('privateSetup');
> >       ws = new WebService();
> >       ws.addEventListener(LoadEvent.LOAD,func);
> >       ws.addEventListener(FaultEvent.FAULT,handleFault);
> >       ws.loadWSDL(wsdlUrl);
> >     }
> >     
> >     private function onLoadCompleted(e:LoadEvent,o:Object):void 
{
> >       trace('onLoadCompleted');
> >       ws.addEventListener(ResultEvent.RESULT, 
> > addAsync(handleResult,SERVICE_TIMEOUT, o.expectedResult));
> >       this[o.test]();
> >     }
> >     
> >     private function handleFault(e:FaultEvent):void {
> >       trace('handleFault');
> >       trace('FAULT: ' + e.fault.getStackTrace());
> >     }
> >     
> >     private function variation1():void {
> >       trace('variation1');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.arguments = new Array('variation','one');
> >       op.send();
> >     }
> >     
> >     private function variation2():void {
> >       trace('variation2');
> >       ws.sendStrings.arguments = new Array('variation','two');
> >       ws.sendStrings.send();
> >     }
> >     
> >     private function variation3():void {
> >       trace('variation3');
> >       ws.sendStrings.send(new Array('variation','three'));
> >     }
> >     
> >     private function variation4():void {
> >       trace('variation4');
> >       ws.sendStrings.send('variation','four');
> >     }
> >     
> >     private function variation5():void {
> >       trace('variation5');
> >       ws.sendStrings('variation','five');
> >     }
> >     
> >     private function variation6():void {
> >       // this function results in a fault event:
> >       // Unexpected parameter 'sendStrings' found in input 
> > arguments.
> >       trace('variation6');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.arguments = {sendStrings:{arg0:new 
> > Array('variation','six')}};
> >       op.send();
> >     }
> >     
> >     private function variation7():void {
> >       trace('variation7');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send({sendStrings:{arg0:new 
Array('variation','six')}});
> >     }
> >     
> >     private function variation8():void {
> >       trace('variation8');
> >       var xml:XML = new XML('<ns1:sendStrings 
> > xmlns:ns1="http://server.webservices.tutorials.wakaleo.com/";>' +
> >         '<arg0>variation</arg0><arg0>eight</arg0>' +
> >         '</ns1:sendStrings>');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send(xml);
> >     }
> >     
> >       private function variation9():void {
> >       trace('variation9');
> >       var xml:XMLDocument = new XMLDocument('<ns1:sendStrings 
> > xmlns:ns1="http://server.webservices.tutorials.wakaleo.com/";>' +
> >         '<arg0>variation</arg0><arg0>nine</arg0>' +
> >         '</ns1:sendStrings>');
> >       var op:AbstractOperation = ws.getOperation('sendStrings');
> >       op.send(xml);
> >     }
> >     
> >     public function testSendStrings1():void{
> >       trace('testSendStrings1');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation1',expectedResult:new 
> > Array('variation0','one1')}
> >           )
> >         );
> >     }
> >     
> >     public function testSendStrings2():void{
> >       trace('testSendStrings2');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation2',expectedResult:new 
> > Array('variation0','two1')}
> >           )
> >         );
> >     }
> >     
> >     public function testSendStrings3():void{
> >       trace('testSendStrings3');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation3',expectedResult:new 
> > Array('variation0','three1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings4():void{
> >       trace('testSendStrings4');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation4',expectedResult:new 
> > Array('variation0','four1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings5():void{
> >       trace('testSendStrings5');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation5',expectedResult:new 
> > Array('variation0','five1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings6():void{
> >       trace('testSendStrings6');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation6',expectedResult:new 
> > Array('variation0','six1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings7():void{
> >       trace('testSendStrings7');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation7',expectedResult:new 
> > Array('variation0','seven1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings8():void{
> >       trace('testSendStrings8');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation8',expectedResult:new 
> > Array('variation0','eight1')}
> >           )
> >         );
> >       
> >     }
> >     
> >     public function testSendStrings9():void{
> >       trace('testSendStrings9');
> >       privateSetup(
> >         addAsync(
> >           onLoadCompleted,
> >           SERVICE_TIMEOUT,
> >           {test:'variation9',expectedResult:new 
> > Array('variation0','nine1')}
> >           )
> >         );
> >       
> >     }
> >   }
> > }
> > 
> > Are there other variations that I missed?  Is there anything 
> > else that I can do to make this work?  Generating XML is not a 
very 
> > good solution and requires me to know the required namespaces.
> > 
> > Thanks for the help and suggestions.
> > 
> > --Kaleb
> >
>







--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to