I think I am following what you are saying about setting the result
type, but I am unsure of how to set it. I see from the Flex 3 API
documentation that on the WebService you can set the Operation type, but
it is done through the mx:operation tag and not through the WebService
class itself (although their is a protected method initializeOpertion on
the WebService).

Is Flex like Java, where if I want to have access to that protected
method, then I need to create a class that extends the WebService and is
located in the same package structure?

Is this what you were thinking by the setting the result type? If so,
which type? Object?

<mx:operation
Properties
concurrency="multiple|single|last"
name=No default, required.
resultFormat="object|xml|e4x"
makeObjectsBindable="false|true"

Events
fault=No default.
result=No default.
/>
If I do return it as an object, then do I need to write my own
attachments class that will "know" how to handle attachments?

Oh, I do not think I mentioned this yet, but I am using Flex 3 beta 2.

Thank you,

Jeremy



--- In [email protected], "jeremyfstewart" <[EMAIL PROTECTED]>
wrote:
>
> Hello All,
>
> Thank you very much for your help! As far as an HTTP sniffer, I have
> used Firebug for Firefox and HTTPWatch for IE, but to no avail. I
cannot
> seem to find where the response is in the watch output. I prefer
Firebug
> for this type of debugging, so if somebody knows where I should be
able
> to find the XML response from the service, that would be great!
>
> As far as the code, here it is (in fragments). Oh, you can tell that I
> am just trying to modify the restaurant web service example from
Adobe,
> and I still have not changed some of the method nor function names
> (http://www.adobe.com/devnet/flex/samples/restaurant/
> <http://www.adobe.com/devnet/flex/samples/restaurant/>  ). If you pull
> up that example, then the below code snippets are from
> ServiceLocator.as, ReviewsList.mxml, and TokenResponder.as. I have
> renamed some of the classes, but other than that, most of the code is
> the same.:
>
> Thank you!
>
> Jeremy
>
> // gets the instance of the service (ServiceLocator.as).
>
>      public static function getBnxService():AbstractService
>      {
>         if (bnxService == null) {
>              var ws:WebService = new WebService();
> //            ws.wsdl =
> "http://flexapps.macromedia.com/ws/services/RestaurantWS?wsdl";;
>              ws.wsdl =
> "http://bnx-int-next.temp.com/tempservice/services/TempService?wsdl";;
>              /* if you want to use  your own WebService adjust the
> following url
>                 to match your setup and comment out the one above */
>              //ws.wsdl =
>
"http://{server.name}:{server.port}/{context.root}/services/RestaurantWS\
\
> ?wsdl";
>              ws.useProxy = false;
>              ws.showBusyCursor = true;
>              ws.loadWSDL();
>              bnxService = ws;
>
>          }
>          return bnxService;
>      }
> //
>
------------------------------------------------------------------------\
\
> -------------------------------
>
> // Calling the service... this is from the mxml file that will render
> the results (ReviewsList.mxml):
>          private function initComp():void
>          {
>              service = BnxServiceLocator.getBnxService();
>              addEventListener("focus", focusEventHandler);
>          }
>
>
>          public function set restaurant(restaurant:Object):void
>          {
>                // When the restaurant changes: retrieve the list of
> reviews
>                assets = null;
>              _restaurant = restaurant;
>              if (restaurant != null)
>              {
> //
> Alert.show(service.getMyFolderContents("0b7dea6680024809"), "does this
> show");
>                  var token: AsyncToken =
> AsyncToken(service.getFolderContents("0b7dea6680024809"));
>                  // Specify that we want the 'getReviewsResult'
function
> to be called when the call completes.
>                  // See control.RestaurantService.as for details on
how
> the resultHandler token is used to invoke getReviewsResult.
>                  token.addResponder(new
TokenResponder(getAssetsResult,
> "Error Retrieving Asset"));
>              }
>          }
>
> //
>
------------------------------------------------------------------------\
\
> ------------------------------
>
>
> // The TokenResponder.as class:
>
> package samples.restaurant
> {
>
> import mx.controls.Alert;
> import mx.rpc.IResponder;
> import mx.rpc.events.FaultEvent;
>
> /**
>   * A simple responder that will call the result function specified
but
>   * handles any fault by simply raising an Alert with the specified
> title.
>   */
> public class TokenResponder implements IResponder
> {
>      private var resultHandler:Function;
>      private var faultTitle:String;
>
>      public function TokenResponder(result:Function,
> faultTitle:String=null)
>      {
>          super();
>          resultHandler = result;
>          this.faultTitle = faultTitle;
>      }
>      public function result(data:Object):void
>      {
>          resultHandler(data);
>
>      }
>
>      public function fault(info:Object):void
>      {
>          //the info object from an AsyncToken is always a FaultEvent
>          Alert.show(FaultEvent(info).fault.toString(), faultTitle);
>      }
>
> }
>
> }
>
>
> // finally back to the mxml for displaying the results
>          private function getAssetsResult(event:ResultEvent):void
>          {
>              Alert.show(event.message.toString(),"testing");
>              //deserialize the anonymous review objects into
>              //a strongly typed instance
>              var temp:ArrayCollection = new ArrayCollection();
>              var source:Array =
ArrayUtil.toArray(event.result.source);
>              Alert.show("source length: " + source.length,"number of
> assets");
>              for (var i:int=0; i < source.length; i++)
>              {
>                  //Review knows how to take an anonymous object
>                  //and copy the properties over
>                  temp.addItem(new Asset(source[i]));
>              }
>              assets = temp;
>          }
>
>
> //
>
------------------------------------------------------------------------\
\
> -------------------------------------
>
> // here is the xml for displaying the results --- ReviewsList.mxml
>
>      <!--
>      The ReviewThumbnailRepeater creates ReviewThumbnails for each
>      review.  We could have used a regular repeater here, but by
writing
> our
>      own we have much better control over when and how children get
>      created.  In this instance we only create children when the
>      binding sets the dataProvider, and then add a child when the
>      user wants to add a new review.  The standard repeater would
>      have recreated all of the children when the user added a new
>      review or canceled a new review.
>      -->
>      <AssetThumbnailRepeater id="rtr" minHeight="5"
>          dataProvider="{assets}"
>          restaurant="{restaurant}"
>          width="100%" height="100%" beginTabIndex="{beginTabIndex +
1}"
>          tabEnabled="true" />
>
>
>
>
>
>
> --- In [email protected], Jehanzeb Musani jehanzeb_bs@
> wrote:
> >
> > Hello Jeremy,
> >
> > I am also a fledgling to Flex Application development.
> > I believe the problem you are facing (invalid xml) is
> > because of the redult type you have specified for the
> > flex webservice component. If you didn't specify the
> > result then by default flex assumes it's xml. Search
> > for WebService and resultFormat in Flex help to see
> > the possible values of resultFormat attribute.
> >
> > It would be handy if you can provide the same code of
> > flex that you have using to call the webservice.
> >
> > Hope this helps.
> >
> > Regards,
> > Jehanzeb
> >
> > --- Peter Farland pfarland@ wrote:
> >
> > > a) I'd use an HTTP sniffer to watch the HTTP traffic
> > > and look for the
> > > response. A free tool is Paros Proxy which can be
> > > easily configured to
> > > be used by IE as a proxy to show all HTTP traffic
> > > going through the
> > > browser.
> > >
> > > ________________________________
> > >
> > > From: [email protected]
> > > [mailto:[EMAIL PROTECTED] On
> > > Behalf Of jeremyfstewart
> > > Sent: Wednesday, November 07, 2007 2:49 PM
> > > To: [email protected]
> > > Subject: [flexcoders] Re: Streaming bytes through a
> > > web service
> > >
> > >
> > > Actually I did a little more research into my issue,
> > > and so I wanted to
> > > add a further description:
> > >
> > > The web service is returning the image as an
> > > attachment, but when the
> > > flex application receives the response it says that
> > > it is invalid XML.
> > > The error reads:
> > >
> > > RPC Fault faultString="Error #1085: The element type
> > > "053118D593A126E55F0D77CE1332B758" must be
> > > terminated by the matching
> > > end-tag "</053118D593A126E55F0D77CE1332B758>"."
> > > faultCode="DecodingError" faultDetail="null"
> > >
> > > I have not been able to yet get the response to
> > > display so that I can
> > > actually see what is being returned by the web
> > > service, but I do know
> > > that we have a JSP application that is able to
> > > handle this web service
> > > and the attachment that is sent. I have seen that
> > > there are some bugs in
> > > the Flex Bug and Issue Management System around
> > > these areas, so I am not
> > > sure if I have hit a bug or something else has
> > > occurred.
> > >
> > > If anybody has any thoughts on:
> > > a) How I can d! ebug this issue? (For example,
> > > getting the response to
> > > show. I have tried using a ResultEvent and then the
> > > following
> > > expression: event.message.toString(), which will
> > > only show me a result
> > > once a web service without an attachment is called.)
> > > b) Is there a work around that I can do for this
> > > error?
> > >
> > >
> > > Thank you in advance,
> > >
> > > Jeremy
> > >
> > >
> > > --- In [email protected], "jeremyfstewart"
> > > jeremyfstewart@
> > > wrote:
> > > >
> > > > Hello,
> > > >
> > > > I am very new to Flex and Flash for that matter
> > > (only a day or two
> > > > working with it), so I do not even know if what I
> > > am asking is
> > > > possible. But I am hitting a web service that is
> > > returning byte array
> > > > of an image that I want my flex application to
> > > stream and then
> > > > display. Is this possible, and if so how?
> > > >
> > > > Just for clarification, we are trying to do a
> > > proof of concept and the
> > > > reason that the content needs to stream for this
> > > test is that we! are
> > > > trying to show how we can send content via the we!
> > > b servic e to
> > > multiple
> > > > applications without each of the applications
> > > having to log into the
> > > > "host" application (the web service does this for
> > > us). So in short,
> > > > we do not have access to an URL for the content
> > > only the bytes that
> > > > stream to us.
> > > >
> > > > I hope that was clear.
> > > >
> > > > Thank you for your help,
> > > >
> > > > Jeremy
> > > >
> > >
> > >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
>

Reply via email to