Email-ExactTarget

 view release on metacpan or  search on metacpan

lib/Email/ExactTarget.pm  view on Meta::CPAN

		'arguments' => $arguments,
	);

=cut

sub soap_call
{
	my ( $self, %args ) = @_;
	my $verbose = $self->verbose();
	my $use_test_environment = $self->use_test_environment();
	my $endpoint = $use_test_environment
		? $ENDPOINT_TEST
		: $ENDPOINT_LIVE;

	# Check the parameters.
	confess 'You must define a SOAP action'
		if !defined( $args{'action'} ) || ( $args{'action'} eq '' );
	confess 'You must define a SOAP method'
		if !defined( $args{'method'} ) || ( $args{'method'} eq '' );
	$args{'arguments'} ||= [];

	# Do not forget to specify the soapaction (on_action), you will find it in the
	# wsdl.
	#    - uri is the target namespace in the wsdl
	#    - proxy is the endpoint address
	my $soap = SOAP::Lite
		->uri( $NAMESPACE )
		->on_action( sub { return '"' . $args{'action'} . '"' } )
		->proxy( $endpoint )
		->readable( ( $verbose ? 1 : 0 ) );

	# You must define the namespace used in the wsdl, as an attribute to the
	# method without namespace prefix for compatibility with .NET
	# (document/literal).
	my $method = SOAP::Data->name( $args{'method'} )
		->attr( { xmlns => $NAMESPACE } );

	# SOAP envelope headers. SOAP API requires addressing, security extensions.
	#

lib/Email/ExactTarget.pm  view on Meta::CPAN

	#     <wsse:Username>username</wsse:Username>
	#     <wsse:Password>password</wsse:Password>
	#   </wsse:UsernameToken>
	# </wsse:Security>
	my @header = (
		SOAP::Header
			->name( Action => $args{'action'} )
			->uri( 'http://schemas.xmlsoap.org/ws/2004/08/addressing' )
			->prefix( 'wsa' ),
		SOAP::Header
			->name( To => $endpoint )
			->uri( 'http://schemas.xmlsoap.org/ws/2004/08/addressing' )
			->prefix( 'wsa' ),
		SOAP::Header
			->name(
				Security => \SOAP::Data->value(
					SOAP::Data->name(
						UsernameToken => \SOAP::Data->value(
							SOAP::Data->name( Username => $self->{'username'} )->prefix( 'wsse' ),
							SOAP::Data->name( Password => $self->{'password'} )->prefix( 'wsse' )
						)



( run in 1.162 second using v1.01-cache-2.11-cpan-beeb90c9504 )