I need to put the result of a web service in an variable (type xml).
I've created the variable by the Variable builder but i'm not able to instantiate it.
The result of the web service is an xml file and I can see the right xml tags and structure in the data services folder (see attached picture).
My provblem is that I can assign to my variable the value of a particular xml tag but not the full xml structure (I mean the structure in the result folder).
Any suggestion about i can do that?
Thanks a lot!
This topic has been locked.
6 replies Latest Post - 2009-10-13T16:08:25Z by SystemAdmin
Pinned topic Problem in creating an xml variable
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2009-10-13T16:08:25Z at 2009-10-13T16:08:25Z by SystemAdmin
mburati 060000VQ2030 PostsACCEPTED ANSWER
Re: Problem in creating an xml variable2009-10-09T16:17:23Z in response to SystemAdminWeb Service results are stored in a WPF Variable. Look in your WebApp Tree for an _results Variable matching the name of your Web Service Call builder.
They're also exposed via DataService metadata to make them easier to use with Service Operation and consumer/provider layer, but under the covers they first go into the Web Service Call's results variable.
What exactly is it that you need to do that you think you need to assign it to another XML variable for? If we understand what you're trying to accomplish with that copy of the data, it might be easier to help suggest a solution specific to your use case.
I don't recommend ActionLists for manipulating XML structures if that's what you mean by assignment. If the transform builders aren't what you need, then I recommend manipulating XML via Java based Method builder or LJO, rather than an Action List.
Re: Problem in creating an xml variable2009-10-12T15:57:33Z in response to mburatiHi, thanks for your answer!
You r right, perhpas my question is not clear.
To be honest i'm not sure i need to create an xml variable...
My problem is:
- i've an input form, when i click the submit button it executes the web Service call
- once i get the results (xml type) i want to fire an event for other widgets and send the full xml output.
In order to do that i'm using a "Widget Event" builder in order to fire the event after the web Service is executed.
The problem is: what is the argument for the FIREevent?
I have the _reply varibale storing the content of all xml tags but my problem is that i'm not able to send the full xml but just the content of each tag. I mean, i don't have a variable containing the full xml (have a look at the picture attached in the original question) but many varibales containing tag contents.
Perhpas this is not the right way to work... in this case... may you please suggest what i should do?
Thanks a lot in advance!
Re: Problem in creating an xml variable2009-10-12T16:13:59Z in response to SystemAdminIf the widget that you are sending the data to is another Factory Model in the same WAR (i.e. the same project in the designer), then the best approach for transferring a large amount of data is to use a shared variable. With the Shared Variable builder, you can specify a variable in one model (the data service operation's result variable works just fine) and a variable in another model (which you can create yourself with the Variable buuilder) and they will always have the same value. They are functionally the same variable.
Then your event is just a note that says that the value in the shared variable has changed, and doesn't actually carry any data. This approach works very well also when the widgets (or portlets) are on different pages. If the receiving widget/portlet hasn't yet been initialized before the event is fired, then it won't catch the event. But with this approach, that doesn't matter, because it will naturally look in the shared variable for data when it is initialized.
Re: Problem in creating an xml variable2009-10-13T09:01:18Z in response to SystemAdminHi Steve,
thanks for your suggestion. I didn't know about that and Shared Variable builder.
Anyway i'm not sure the sending and receiving widgets will be in the same war. At the moment this is true but there are more developers creating widgets and the user should be free to mash-up my widgets with other ones (developed by someone else and deployed in a different one).
For this reason, perhaps, the shared variables is not the right solution. What do u think?
I'm trying another solution... I've created an schema type variable by "Variable" builder. Then I used the Transfrom builder to match the Web Service output to the my variable. Then i fire an event and send my xml variable. But I get the following error message: "It is not possible to find a match, create or ignore instruction for the output node" (or something like that...I'm translating from italian).
What does it mean? Any idea? Perhpas what i'm trying to do is not correct...
Thanks in advance!
Re: Problem in creating an xml variable2009-10-13T16:08:25Z in response to SystemAdminThere are two ways I can think of to reliably send XML data across WAR boundaries: 1) use a Widget Event with a structured payload type, passing each XML element as an event payload sub-element or 2) passing the XML document as an encoded string, un-encoding/parsing it when it is received.
I've attached a model that includes samples of both approaches (note that this uses the Orders sample data, and so requires the "building models" sample feature set be installed.) The "structured payload" technique is cleaner, but could be tedious if the XML structure is complex.
Hope this helps.