Re: [flexcoders] Re: How to parse web services response doc containing namespace

2006-09-02 Thread James Ward
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I just ran into this problem too.  And unfortunately this post was quite
a while ago and I can't seem to find an answer...  But I did find a
workaround.  It's not pretty and it seems there should be a better way.
 But until the better way is found, try something like this:

mx:DataGridColumn dataField=age
  mx:itemRenderer
   mx:Component
 mx:Label text={(data as XML).samples::age}
   mx:Script
 ![CDATA[
   private namespace samples = http://census.samples;;
   use namespace samples;
 ]]
   /mx:Script
 /mx:Label
   /mx:Component
  /mx:itemRenderer
/mx:DataGridColumn

- -James


kevntrace wrote:
 Thanks Derek.  I did read in the docs about declaring a namespace 
 variable - indeed if you look at the code I posted, you will see I 
 did exactly that with a variable named csw.  I also tried 
 referencing the namespace in different ways - using the variable, 
 using wildcards etc.  I still got nothing to work.
 
 Could you take another look at my code and try to put in context how 
 I would declare and use that namespace variable?  Like I said, I am 
 a complete newbie to Flex, and this really is my first ever project 
 and I've had no training.  So I'm not sure the namespace variable 
 I've used is in scope when I'm trying to parse the result document, 
 I'm not sure on how to mix MXML and ActionScript (so just giving me 
 an extract of ActionScript code without showing me how to include it 
 in my MXML doesn't really help too much).  I do appreciate all the 
 responses from everyone though.
 
 
 Excerpt where I declare the namespace var;
 mx:Script
 ![CDATA[
 import mx.controls.Alert;
 private namespace csw 
 = http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo
 rt;
 use namespace csw;
 ]]
 /mx:Script
 
 Excerpt where I try to parse out using the namespace (none of these 
 work);
 mx:columns
 mx:DataGridColumn headerText=Top Posts 
 dataField=*::getMostPopularPostsResponse.*::ColumnList.*::row.*::ite
 m/
 mx:DataGridColumn headerText=Clicks 
 dataField=getMostPopularPostsResponse.ColumnList.row.item 
 width=75/
 mx:DataGridColumn headerText=Blah 
 dataField=csw::getMostPopularPostsResponse.csw::ColumnList.csw::row.
 csw::item width=75/
 /mx:columns
 
 
 
 --- In flexcoders@yahoogroups.com, Derek Adams [EMAIL PROTECTED] 
 wrote:
 I have been successful in doing that by declaring the namespace as 
 a 
 local variable in ActionScript, then using it in the e4x query. 
 For 
 instance:

 private var aps:Namespace = new Namespace
 (http://cadtel.com/APWebService;);

 model.currentOrderPaths = 
 results.aps::Order.aps::RelatedPaths.aps::Paths.aps::NetworkPath;

 Hope that helps,
 Derek

 
 
 
 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE+iVesZ9+wiQzdmARAp2iAJoCskU6Zls3Q04H/YTt/ZvLJ+i6vgCgj0I3
a4nTJOoX/rDlAI5nHY50uz4=
=H9Lx
-END PGP SIGNATURE-


--
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/
 





[flexcoders] Re: How to parse web services response doc containing namespace

2006-07-15 Thread kevntrace
Thanks Derek.  I did read in the docs about declaring a namespace 
variable - indeed if you look at the code I posted, you will see I 
did exactly that with a variable named csw.  I also tried 
referencing the namespace in different ways - using the variable, 
using wildcards etc.  I still got nothing to work.

Could you take another look at my code and try to put in context how 
I would declare and use that namespace variable?  Like I said, I am 
a complete newbie to Flex, and this really is my first ever project 
and I've had no training.  So I'm not sure the namespace variable 
I've used is in scope when I'm trying to parse the result document, 
I'm not sure on how to mix MXML and ActionScript (so just giving me 
an extract of ActionScript code without showing me how to include it 
in my MXML doesn't really help too much).  I do appreciate all the 
responses from everyone though.


Excerpt where I declare the namespace var;
mx:Script
![CDATA[
import mx.controls.Alert;
private namespace csw 
= http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo
rt;
use namespace csw;
]]
/mx:Script

Excerpt where I try to parse out using the namespace (none of these 
work);
mx:columns
mx:DataGridColumn headerText=Top Posts 
dataField=*::getMostPopularPostsResponse.*::ColumnList.*::row.*::ite
m/
mx:DataGridColumn headerText=Clicks 
dataField=getMostPopularPostsResponse.ColumnList.row.item 
width=75/
mx:DataGridColumn headerText=Blah 
dataField=csw::getMostPopularPostsResponse.csw::ColumnList.csw::row.
csw::item width=75/
/mx:columns



--- In flexcoders@yahoogroups.com, Derek Adams [EMAIL PROTECTED] 
wrote:

 I have been successful in doing that by declaring the namespace as 
a 
 local variable in ActionScript, then using it in the e4x query. 
For 
 instance:
 
 private var aps:Namespace = new Namespace
 (http://cadtel.com/APWebService;);
 
 model.currentOrderPaths = 
 results.aps::Order.aps::RelatedPaths.aps::Paths.aps::NetworkPath;
 
 Hope that helps,
 Derek
 





 Yahoo! Groups Sponsor ~-- 
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/nhFolB/TM
~- 

--
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/
 




[flexcoders] Re: How to parse web services response doc containing namespace

2006-07-14 Thread Derek Adams
I have been successful in doing that by declaring the namespace as a 
local variable in ActionScript, then using it in the e4x query. For 
instance:

private var aps:Namespace = new Namespace
(http://cadtel.com/APWebService;);

model.currentOrderPaths = 
results.aps::Order.aps::RelatedPaths.aps::Paths.aps::NetworkPath;

Hope that helps,
Derek

--- In flexcoders@yahoogroups.com, ben.clinkinbeard 
[EMAIL PROTECTED] wrote:

 Tracy, can you post a more complete example? I would be very
 interested in something that does what you explained but am not
 totally sure I understand your description.
 
 Thanks,
 Ben
 
 --- In flexcoders@yahoogroups.com, Tracy Spratt tspratt@ wrote:
 
  I just discovered something that might help. (This is with beta 3
  though)
  
   
  
  If you do not set resultFormat as e4x, but instead do:
  
  var xmlResult:XML = newXML(result.toString())
  
   
  
  for me, that created an xml object without the namespace stuff.
  
   
  
  Let me know if it works.
  
   
  
  Tracy
  
   
  
  
  
  From: flexcoders@yahoogroups.com 
[mailto:[EMAIL PROTECTED] On
  Behalf Of kevntrace
  Sent: Thursday, July 13, 2006 2:25 PM
  To: flexcoders@yahoogroups.com
  Subject: [flexcoders] How to parse web services response doc 
containing
  namespace
  
   
  
  I am a complete newbie to Flex, ActionScript et al, so please 
  forgive me if my questions appear simplistic.
  
  I've implemented, and got working, the sample app which invokes 
a 
  web service and displays the Top 5 popular posts from a blog 
service.
  
  I now want to modify this app so it calls my own homegrown web 
  service. I have been able to get the invocation working, and I 
get a 
  valid response, which I confirmed by displaying the lastResult 
  object in a textbox.
  
  My problem now is I want to parse through the result document, 
which 
  contains a namespace, and populate items on the form - I have 
not 
  yet been successful in my attempts.
  
  Here is the source code to my MXML application, followed by the 
WS 
  response document;
  
  MXML App
  
  
  ?xml version=1.0 encoding=utf-8?
  mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
  http://www.adobe.com/2006/mxml  
  layout=absolute 
  creationComplete=wsBlogAggr.getMostPopularPosts.send()
  mx:Script
  ![CDATA[
  import mx.controls.Alert;
  private namespace csw 
  
= http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo
  
http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo 
  rt;
  use namespace csw;
  
  ]]
  /mx:Script
  
  mx:WebService id=wsBlogAggr 
  wsdl=http://localhost:9400/services/adobe?wsdl
  http://localhost:9400/services/adobe?wsdl 
  useProxy=false
  mx:operation name=getMostPopularPosts 
  resultFormat=e4x
  mx:request format=xml
  ns1:getMostPopularPosts 
  
xmlns:ns1=http://kevin.company.com/services/webservices/adobe/blogSv
  http://kevin.company.com/services/webservices/adobe/blogSv 
  c/blogPort
  
  ns1:daysBack10.0/ns1:daysBack
  ns1:limit5.0/ns1:limit
  /ns1:getMostPopularPosts
  /mx:request
  /mx:operation
  /mx:WebService
  
  mx:Panel x=10 y=10 width=475 height=400 
  layout=absolute title=Most Popular Posts
  
  mx:TextArea 
  text={wsBlogAggr.getMostPopularPosts.lastResult}/
  
  mx:ComboBox x=48 y=30 id=cbxNumPosts 
  change=wsBlogAggr.getMostPopularPosts.send()
  mx:Object label=Top 5 data=5/
  mx:Object label=Top 10 data=10/
  mx:Object label=Top 15 data=15/
  /mx:ComboBox
  
  mx:DataGrid x=48 y=80 id=dgTopPosts 
  columnWidth=400 
  dataProvider={wsBlogAggr.getMostPopularPosts.lastResult} 
  width=350
  mx:columns
  mx:DataGridColumn headerText=Top 
  Posts 
  
dataField=*::getMostPopularPostsResponse.*::ColumnList.*::row.*::ite
  m/
  mx:DataGridColumn 
  headerText=Clicks 
  dataField=getMostPopularPostsResponse.ColumnList.row.item 
  width=75/
  /mx:columns
  /mx:DataGrid
  mx:LinkButton x=48 y=264 label=Select an item 
  and click here for full post click=navigateToURL(new URLRequest
  (dgTopPosts.selectedItem.postLink));/
  /mx:Panel
  
  /mx:Application
  
  WS Response Doc
  ---
  
  ns1:getMostPopularPostsResponse xmlns:soap-
  env=http://schemas.xmlsoap.org/soap/envelope/
  http://schemas.xmlsoap.org/soap/envelope/  
  
xmlns:ns1=http://kevinobrien.composite.com/services/webservices/adob
  http://kevinobrien.composite.com/services/webservices/adob 
  e/blogSvc/blogPort xmlns:xsi=http://www.w3.org/2001/XMLSchema-
  http://www.w3.org/2001/XMLSchema- 
  instance
  ns1:ColumnList
  ns1:row
  ns1:itempostId/ns1:item
  /ns1:row
  ns1:row
  ns1:itemclicks/ns1:item
  /ns1:row
  ns1:row
  ns1:itemdateTimeAggregated/ns1:item
  /ns1:row
  ns1:row
  ns1:itemfeedId/ns1:item
  /ns1:row
  ns1:row
  ns1:itemfeedName/ns1:item
  /ns1:row
  ns1:row
  ns1:itempostTitle/ns1:item
  /ns1:row
  ns1:row
  ns1:itempostExcerpt/ns1:item
  /ns1:row
  ns1:row
  ns1:itempostLink/ns1:item
  /ns1:row
  /ns1:ColumnList
  /ns1:getMostPopularPostsResponse
  
  I tried 

[flexcoders] Re: How to parse web services response doc containing namespace

2006-07-13 Thread ben.clinkinbeard
Tracy, can you post a more complete example? I would be very
interested in something that does what you explained but am not
totally sure I understand your description.

Thanks,
Ben

--- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote:

 I just discovered something that might help. (This is with beta 3
 though)
 
  
 
 If you do not set resultFormat as e4x, but instead do:
 
 var xmlResult:XML = newXML(result.toString())
 
  
 
 for me, that created an xml object without the namespace stuff.
 
  
 
 Let me know if it works.
 
  
 
 Tracy
 
  
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of kevntrace
 Sent: Thursday, July 13, 2006 2:25 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] How to parse web services response doc containing
 namespace
 
  
 
 I am a complete newbie to Flex, ActionScript et al, so please 
 forgive me if my questions appear simplistic.
 
 I've implemented, and got working, the sample app which invokes a 
 web service and displays the Top 5 popular posts from a blog service.
 
 I now want to modify this app so it calls my own homegrown web 
 service. I have been able to get the invocation working, and I get a 
 valid response, which I confirmed by displaying the lastResult 
 object in a textbox.
 
 My problem now is I want to parse through the result document, which 
 contains a namespace, and populate items on the form - I have not 
 yet been successful in my attempts.
 
 Here is the source code to my MXML application, followed by the WS 
 response document;
 
 MXML App
 
 
 ?xml version=1.0 encoding=utf-8?
 mx:Application xmlns:mx=http://www.adobe.com/2006/mxml
 http://www.adobe.com/2006/mxml  
 layout=absolute 
 creationComplete=wsBlogAggr.getMostPopularPosts.send()
 mx:Script
 ![CDATA[
 import mx.controls.Alert;
 private namespace csw 
 = http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo
 http://kevin.company.com/services/webservices/adobe/blogSvc/blogPo 
 rt;
 use namespace csw;
 
 ]]
 /mx:Script
 
 mx:WebService id=wsBlogAggr 
 wsdl=http://localhost:9400/services/adobe?wsdl
 http://localhost:9400/services/adobe?wsdl 
 useProxy=false
 mx:operation name=getMostPopularPosts 
 resultFormat=e4x
 mx:request format=xml
 ns1:getMostPopularPosts 
 xmlns:ns1=http://kevin.company.com/services/webservices/adobe/blogSv
 http://kevin.company.com/services/webservices/adobe/blogSv 
 c/blogPort
 
 ns1:daysBack10.0/ns1:daysBack
 ns1:limit5.0/ns1:limit
 /ns1:getMostPopularPosts
 /mx:request
 /mx:operation
 /mx:WebService
 
 mx:Panel x=10 y=10 width=475 height=400 
 layout=absolute title=Most Popular Posts
 
 mx:TextArea 
 text={wsBlogAggr.getMostPopularPosts.lastResult}/
 
 mx:ComboBox x=48 y=30 id=cbxNumPosts 
 change=wsBlogAggr.getMostPopularPosts.send()
 mx:Object label=Top 5 data=5/
 mx:Object label=Top 10 data=10/
 mx:Object label=Top 15 data=15/
 /mx:ComboBox
 
 mx:DataGrid x=48 y=80 id=dgTopPosts 
 columnWidth=400 
 dataProvider={wsBlogAggr.getMostPopularPosts.lastResult} 
 width=350
 mx:columns
 mx:DataGridColumn headerText=Top 
 Posts 
 dataField=*::getMostPopularPostsResponse.*::ColumnList.*::row.*::ite
 m/
 mx:DataGridColumn 
 headerText=Clicks 
 dataField=getMostPopularPostsResponse.ColumnList.row.item 
 width=75/
 /mx:columns
 /mx:DataGrid
 mx:LinkButton x=48 y=264 label=Select an item 
 and click here for full post click=navigateToURL(new URLRequest
 (dgTopPosts.selectedItem.postLink));/
 /mx:Panel
 
 /mx:Application
 
 WS Response Doc
 ---
 
 ns1:getMostPopularPostsResponse xmlns:soap-
 env=http://schemas.xmlsoap.org/soap/envelope/
 http://schemas.xmlsoap.org/soap/envelope/  
 xmlns:ns1=http://kevinobrien.composite.com/services/webservices/adob
 http://kevinobrien.composite.com/services/webservices/adob 
 e/blogSvc/blogPort xmlns:xsi=http://www.w3.org/2001/XMLSchema-
 http://www.w3.org/2001/XMLSchema- 
 instance
 ns1:ColumnList
 ns1:row
 ns1:itempostId/ns1:item
 /ns1:row
 ns1:row
 ns1:itemclicks/ns1:item
 /ns1:row
 ns1:row
 ns1:itemdateTimeAggregated/ns1:item
 /ns1:row
 ns1:row
 ns1:itemfeedId/ns1:item
 /ns1:row
 ns1:row
 ns1:itemfeedName/ns1:item
 /ns1:row
 ns1:row
 ns1:itempostTitle/ns1:item
 /ns1:row
 ns1:row
 ns1:itempostExcerpt/ns1:item
 /ns1:row
 ns1:row
 ns1:itempostLink/ns1:item
 /ns1:row
 /ns1:ColumnList
 /ns1:getMostPopularPostsResponse
 
 I tried creating an XMLListCollection object, but I got a compile 
 error that, being a newbie, did not make sense. Here is the syntax I 
 used.
 
 mx:XMLListCollection id=xc
 source={wsBlogAggr.getMostPopularPosts.lastResult}/
 
 Can anyone help with info on how to parse the response doc?








--
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,