MOBY::Client::SimpleArticle - a small object describing the Simple articles from the findService Response message of MOBY Central
foreach my $queryID(keys %$inputs){ my $this_invocation = $inputs->{$queryID}; # this is the <mobyData> block with this queryID my $invocation_output = ""; if (my $input = $this_invocation->{'This_articleName'}){ # $input contains a MOBY::Client::SimpleArticle, ::CollectionArticle or ::SecondaryArticle next unless $input->isSimple; $XML = $input->XML; # get the raw XML of the object, including <Simple> or <Collection> elements $moby_object = $input->content; # get the raw XML of the object EXCLUDING <Simple> or <Collection> elements $DOM = $input->XML_DOM; # get the XML as a LibXML DOM object $namespace = $input->namespace; # get the namespace of the object $id = $input->id; # get the id of the object (the id of the outermost MOBY object XML block)
# do your business here and fill $invocation_output }
$MOBY_RESPONSE .= simpleResponse( # create an empty response for this queryID $invocation_output # response for this query , "myOutput" # the article name of that output object , $queryID); # the queryID of the input that we are responding to } return SOAP::Data->type('base64' => (responseHeader("illuminae.com") . $MOBY_RESPONSE . responseFooter));
or to construct a representation of a simple article from a findService call to MOBY::Central
This describes the Simple articles from either the findService Response of MOBY Central (i.e. the description of the service), or Simple articles as provided in a service invocation or response message (i.e. simple articles containing data)
Basically it parses the following part of a findService response:
<Simple articleName='foo'> <objectType>someNbject</objectType> <Namespace>someNamespace</Namespace> <Namespace>someNamespace2</Namespace> </Simple>
OR it parses the following part of a service invocation or response message:
<Simple articleName='foo'> <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject> </Simple>
The articleName is retrieved with ->articleName
The namespace(s)
are retrieved with ->namespaces
The objectType is retrieved with ->objectType
the id (if instantiated) is retrieved with ->id
Mark Wilkinson (markw at illuminae dot com)
Usage : my $SA = MOBY::Client::SimpleArticle->new(%args) Function : create SimpleArticle object Returns : MOBY::Client::SimpleArticle object Args : either of the following two methods may be used to auto-generate the object by passing the appropriate XML node as a string, or XML::DOM node object
XML => $XML XML_DOM => $XML::LibXML::Node
Usage : $name = $SA->articleName($name) Function : get/set articleName Returns : string Arguments : (optional) string representing articleName to set
Usage : $type = $SA->objectType($type) Function : get/set name Returns : string Arguments : (optional) string representing objectType to set
Usage : $type = $SA->objectLSID($type) Function : get/set LSID Returns : string Arguments : (optional) string representing objectLSID to set
Usage : $namespace = $SA->namespace Function : get namespace for the MOBY Object Returns : namespace as a string Arguments : none
Usage : $namespaces = $SA->namespaces(\@namespaces) Function : get/set namespaces for the objectType in a service instance object Returns : arrayref of namespace strings Arguments : (optional) arrayref of namespace strings to set
Usage : $SA = $SA->XML($XML) Function : set/reset all parameters for this object from the XML Returns : MOBY::Client::SimpleArticle Arguments : (optional) XML fragment from and including <Simple>...</Simple>
Usage : $XML = $SA->content Function : get XML of the article EXCLUDING the <Simple>..</Simple> tags Returns : string Arguments : none
Usage : $namespaces = $SA->XML_DOM($XML_DOM_NODE) Function : set/reset all parameters for this object from the XML::DOM node for <Simple> Returns : MOBY::Client::SimpleArticle Arguments : (optional) an $XML::DOM node from the <Simple> article of a DOM
Usage : $namespaces = $IN->addNamespace($namespace) Function : add another namespace for the objectType Returns : namespace string
Usage : $boolean = $IN->isSimple() Function : is this a SimpleArticle type (yes, I know this is obvious, but since you can get both Simple and Collection objects in your Input and output lists, it is good to be able to test what you have in-hand) Returns : 1 (true)
Usage : $boolean = $IN->isCollection() Function : is this a CollectionArticle type (yes, I know this is obvious, but since you can get both Simple and Collection objects in your Input and output lists, it is good to be able to test what you have in-hand) Returns : 0 for false
Usage : $boolean = $IN->isSecondary() Function : is this a SecondaryArticle type? (yes, I know this is obvious) Returns : 0 (true)