NAME

MOBY::Client::CollectionArticle - a small object describing the Collection articles from the findService Response message of MOBY Central or representing the collection part of a MOBY invocation or response block


SYNOPSIS

This module can be used in two ways. One is to represent the Collection portion of a findService response. The other is to represent the Collecion portion of a MOBY service invocation or response message.

Parsing a MOBY Service Invocation

 use MOBY::CommonSubs qw(:all);
 sub myService {
    my ($caller, $data) = @_;

Can be used either in this way:

 use MOBY::CommonSubs qw{:all};
    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->isCollection;
            @simples= @{$input->Simples};
            # @simples contains a list of MOBY::Client::SimpleArticles
            # 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 collection article from a findService call to MOBY::Central


DESCRIPTION

This describes the Collection articles from either the findService Response of MOBY Central (i.e. the description of the service), or Collection 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:

 <Collection articleName="foo">
  <Simple>
     <objectType>someNbject</objectType>
     <Namespace>someNamespace</Namespace>
     <Namespace>someNamespace2</Namespace>
  </Simple>
  <Simple>
     <objectType>someNbject</objectType>
     <Namespace>someNamespace</Namespace>
     <Namespace>someNamespace2</Namespace>
  </Simple>
 </Collection>

OR it parses the following part of a service invocation or response message:

 <Collection articleName="foo">
  <Simple>
    <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject>
  </Simple>
  <Simple>
    <SomeObject namespace='someNamespace' id='someID'>.....</SomeObject>
  </Simple>
 </Collection>

The articleName is retrieved with ->articleName The contained Simples are retrieved as MOBY::Client::SimpleArticle objects using the ->Simples method call.


AUTHORS

Mark Wilkinson (markw at illuminae dot com)


METHODS

new

 Usage     :    my $IN = MOBY::Client::CollectionArticle->new(%args)
 Function  :    create CollectionArticle 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::DOM::NODE

articleName

 Usage     :    $name = $IN->articleName($name)
 Function  :    get/set articleName
 Returns   :    string
 Arguments :    (optional) string to set articleName

Simples

 Usage     :    $simples = $IN->Simples(\@SimpleArticles)
 Function  :    get/set simple articles
 Returns   :    arrayRef of MOBY::Client::SimpleArticle's in this collection
 Arguments :    (optional) arrayRef of MOBY::Client::SimpleArticle's in this collection

addSimple

 Usage     :    $simples = $IN->addSimple($SimpleArticle)
 Function  :    add another SimpleArticle
 Returns   :    arrayref of MOBY::Client::SimpleArticle's or 0 if argument
                was not a MOBY::Client::SimpleArticle (or other failure)
 Arguments :    a new MOBY::Client::SimpleArticle to add to collection

XML

 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>

XML_DOM

 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

isSimple

 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   :    0 (false)

isCollection

 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   :    1 (true)

isSecondary

 Usage     :    $boolean = $IN->isSecondary()
 Function  :    is this a SecondaryArticle type?
                (yes, I know this is obvious)
 Returns   :    0 (true)