Lombrera Lombrera wrote:
Hi all,
Well, what I would like to do is something like this (first just wanna
say that I work with network management and I am not a XMl or
WebServices expert,
but in the free time I like to enjoy Apollo, Pubscribe and Muse projetcs):
Let's suppose that I am building a FileSystem service with only two
properties (just to be simple to explain my doubts). The
"MountPointDirectory" propertie and the "Comments" propertie.
Here is how my .WSDL file looks like to define this properties:
...
...
...
<element name="MountPointDirectory" type="xsd:string"/>
<element name="Comments">
<complexType>
<sequence>
<element name="Date" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<element name="Time" type="xsd:string" minOccurs="0"
maxOccurs="1"/>
<element name="Username" type="xsd:string"
minOccurs="0" maxOccurs="1"/>
</sequence>
</complexType>
</element>
<!-- Resource Properties Document Schema -->
<element name="FileSystemProperties">
<complexType>
<sequence>
<!-- props for wsrl:ScheduledResourceTermination
portType -->
<element ref="wsrl:CurrentTime"/>
<element ref="wsrl:TerminationTime"/>
<!-- props for tns:FileSystemPortType portType -->
<element ref="tns:MountPointDirectory"/>
<element ref="tns:Comments"/>
</sequence>
</complexType>
</element>
...
...
...
Notice that the "Comments" propertie is a ComplexType (thanks Murray)
and the "Date", "Time" and "Username" elements have maxOccurs="1".
So, when I send a set request to the "Comments" propertie, it would
looks like this:
...
...
...
<wsrp:Update>
<fs:Comments>
<fs:Date>12/12/2005</fs:Date>
<fs:Time>11:23:54</fs:Time>
<fs:Username>Mike</fs:Username>
</fs:Comments>
</wsrp:Update>
...
...
...
So my doubts are:
1) How will the code fragment that goes in the
"FilesystemResource.java" file looks like?
2) How will the callback file "CommentsCallback.java" looks like?
3) How can I catch the values from Date, Time and Username in the Backend?
Have someone already done something like this? Is it possible to do this?
Excuses for the big message but I have already tried some ways but not
having fun. You can see that this case is a little bit different from
the "Options" propertie that comes with the FileSystem example that
comes with Apollo and Muse (because it has only one element inside it,
that has
maxOccurs = "Unbounded" and is a ArrayList).
Thats it guys,
hope someone can help me.
Thank all once more.
[]s
Lombrera
------------------------------------------------------------------------
Yahoo! Messenger com voz: PROMOÇÃO VOCÊ PODE LEVAR UMA VIAGEM NA
CONVERSA. Participe!
<http://us.rd.yahoo.com/mail/br/taglines/*http://br.yahoo.com/messenger/promocao/>
Lombrera,
I think the problem is that you are confusing a ResourceProperty's
subelements with ResourceProperties themselves....A ResourceProperty may
be complex and have subelements as you have shown. The generated
XmlBean type for the given property (say CommentsDocument or
CommentsType) will have setters and getters for these subelements.
With this in mind, here are my responses:
1) The code fragment will be generated for you and will probably be
something like:
resourceProperty = resourcePropertySet.get(...PropertyQNames.COMMENTS);
CommentsDocument prop_comments = CommentsDocument.Factory.newInstance();
//TODO: Initialize the prop_comments.......
resourcePropery.add(prop_comments);
This is dealing with the ResourceProperty directly. It is up to you to
further initialize the prop_comments as the generated TODO is saying.
You will need to initialize all the subelements via their setters....
2) We do not generate Callbacks for you so you will need to write it
yourself....If you are asking how to do it for a complex type then look
at the OptionsCallback provided with the Filesystem example. It is not
different in the fact that it is a complexType, your type just has more
elements....The XmlBeans generated type will have getters for Time and
Date etc....You'd get the values of those from the property which is
passed in. Basically you are dealing with the entire property as a
whole (all its subelements)....The sub elements are not handled as
seperate ResourceProperties because they ARE NOT ResourceProperties
themselves, they are merely parts of the ResoruceProperty.
3) You would use the Callback mechanism and dig into the what gets
passed to the operations (refreshProperty, updateProperty etc) and pull
the values for the sub elements (Date, Time etc)...You then use these
values to update your backend, else refuse them....So your
CommentCallback (A callback is associated with the ResourceProperty as a
whole) will need the logic to introspect the XmlBean for your Comments
type and check the values of Time, Date etc....
I hope that clears things up...
-S
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]