WSO2::WSF::WSHeader - Create a WSHeader object.


WSO2-WSF-Perl documentation Contained in the WSO2-WSF-Perl distribution.

Index


Code Index:

NAME

Top

WSO2::WSF::WSHeader - Create a WSHeader object.

SYNOPSYS

Top

  my $header = new WSO2::WSF::WSHeader( { WSHEADER_OPTIONS } );

  my $header = new WSO2::WSF::WSHeader( { 'name' => 'person',
                                          'data' => 'Frodo',
                                          ...
                                        } );

  my $client = new WSO2::WSF::WSClient( { ...
                                          'inputHeaders' => [ $header ],
                                          ...
                                        } );

DESCRIPTION

Top

A WSMessage object can be used to store all the info in order to successfully consume a Web service. This could be passed to the request method after you create a WSClient object.

A WSHeader object can be used to hold a custom header element which could then be passed as an array to 'inputHeaders' option when creating a WSClient object.

WSHEADER_OPTIONS

Top

ns

Specify SOAP header's namespace URI.

nsprefix

Soap header's namespace prefix.

name

Soap header element's localname

data

If it's a single value give it as a string, if nested elements are need to be generated give an array of WSHeader objects.

# a single header element

  my $h1 = new WSO2::WSF::WSHeader( { 'name' => 'person',
                                      'data' => 'Frodo'
                                    } );

# header with child elements

  my $name = new WSO2::WSF::WSHeader( { 'name' => 'fullname',
                                        'data' => 'Frodo Baggins'
                                      } );

  my $age = new WSO2::WSF::WSHeader( { 'name' => 'age',
                                       'data' => 'Eleventy-one'
                                     } );

  my $h3 = new WSO2::WSF::WSHeader( { 'name' => 'person',
                                      'data' => [ $name, $age ]
                                    } );

mustUnderstand

Can contain either 'TRUE' or 'FALSE' values. Specifys whether to add mustUnderstand attribute to the Soap Header or not.

role

Can either be 1, 2 or 3. 1 - This will set the role to none, meaning if there are intermediary SOAP nodes they will not process the header. 2 - This will set the role to next, meaning the next SOAP node to receive the header must process it. 3 - This will set the role to ultimate receiver, meaning the last SOAP node to receive the SOAP header will process it.

SEE ALSO

Top

Look at WSO2::WSF::WSClient to see how to pass a WSHeader and create a custom header element.

AUTHOR

Top

WSO2 WSF/Perl Team

COPYRIGHT AND LICENSE

Top


WSO2-WSF-Perl documentation Contained in the WSO2-WSF-Perl distribution.

package WSO2::WSF::WSHeader;

# Copyright 2005,2006 WSO2, Inc. http://wso2.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

use 5.008008;
# use strict;
use warnings;
use base 'Exporter';

sub new {
    my $class = shift;
    my $this = ref( $class ) || $class;
    my $self = shift;		# options

    # add options as "instance variables"
    if( defined( $self ) ) {
	foreach my $k (keys (%{$self})) {
	    $this->{$k} = $self->{$k};
	}
    }

    bless $self, $this;
    return $self;
}

1;
__END__