You are here iC Home > Know-how > Perl > SOAP > How to debug > Debugging Flag

Perl / SOAP

3.2.1 Debugging Flag

20.06.2006
3.2 How to debug [  up  ] - [ a - z ] - [ search PC ] - [ top ] 3.3 How to set a timeout (s)

→ +trace => [qw(debug)]

→ Download soapdebug.pl
#!/usr/bin/perl -w
use strict;

# -- Nested attributes

use SOAP::Lite
	#proxy => ['mailto:reto@example.com',
	#	smtp => 'localhost',
	#	From => 'reto@tertius.example.com',
	#	Subject => 'SOAP message -> ns(urn:foo, urn), prefix=urn'] ,

	+trace => [qw(debug)]
	# +trace => [qw(transport result parameters debug dispatch trace)]
;

#####  GLOBAL
my $NS_PREF = 'urn';

&main();

##############################################
sub main() {
##############################################

	my $client = SOAP::Lite
		->readable(1)
		->uri('urn:catalogue.eshop.ws.crm.example.net')
		->proxy('http://localhost:8081/cgi-bin/dummy.cgi', timeout => 1 )
		;

	# Add namespace
	$client->ns('urn:catalogue.eshop.ws.crm.example.net', 'urn');
 
	my $temp_elements;
	my @params = ();

	# my $method = SOAP::Data->name('AddItemRequest')->attr({
	#	xmlns => 'urn:catalogue.eshop.ws.crm.example.net'});

	$temp_elements = SOAP::Data
        	->name("$NS_PREF:targetStaging" => 'STAGING')
	        ->type("");
		push(@params, $temp_elements);

	$temp_elements = SOAP::Data
		->name("$NS_PREF:Item" =>
		\SOAP::Data->value(
			SOAP::Data->name("$NS_PREF:type" => 'ADSL_CF_HARDWARE'),
			SOAP::Data->name("$NS_PREF:external_id" => 4711),

			SOAP::Data->name("$NS_PREF:category" =>
				\SOAP::Data->name("$NS_PREF:name" => 'ADSL_CF'),
			),

			&createAttribute('ORDERBY', 1),
			&createAttribute('LINE_TYPE', 'analog'),
		)
	)
	;
	push(@params, $temp_elements);

	# my $response = $client->call($method => @params); 
	my $response = $client->AddItemRequest(@params); 
}

#######################################
sub createAttribute($$) {
#######################################
	my $key = $_[0] || '';
	my $val = $_[1] || '';
	my $nspref = $NS_PREF ? "$NS_PREF:attribute" : 'attribute';

	SOAP::Data->name($nspref =>
		\SOAP::Data->value(
			SOAP::Data->name("$NS_PREF:key" => $key),
			SOAP::Data->name("$NS_PREF:value" => $val)
		)
	)
}

__END__
 
1 Introduction to SOAP
2 Namespaces in SOAP
3 SOAP::Lite
 3.1Construct an object    
 3.2How to debug    
  3.2.1    Debugging Flag
 3.3How to set a timeout (s)    
 3.4Manpage of SOAP::Lite    



Advanced search tips
3.2 How to debug [  up  ] - [ top ] 3.3 How to set a timeout (s)



[ home ] - [ search ] - [ feedback ]

copyright by reto - created with mytexi