WSDL::Compile::Serialize - serialize to and from class for XML::Compile::SOAP::Client
use strict; use warnings; use XML::Compile::WSDL11; use XML::Compile::SOAP11; use XML::Compile::Transport::SOAPHTTP; use WSDL::Compile::Serialize; use Example::Op::CreateCustomer::Request; use Example::Op::CreateCustomer::Response; use Example::CT::Contact; my $s = WSDL::Compile::Serialize->new(); my $request_class = 'Example::Op::CreateCustomer::Request'; my $response_class = 'Example::Op::CreateCustomer::Response'; my $contact_class = 'Example::CT::Contact'; my $req = $request_class->new( 'TemplateCode' => 'example', 'Contact' => $contact_class->new( 'Street' => 'example', 'County' => 'example', 'City' => 'example' ), 'CustomerID' => [ 'example', 'example' ], 'Contacts' => [ $contact_class->new( 'Street' => 'example', 'County' => 'example', 'City' => undef ), $contact_class->new( 'Street' => 'example', 'County' => 'example', 'City' => 'example' ), ], 'BuildingNumber' => undef, 'CustomerType' => ['example', undef, 'example2'], ); my $wsdl = XML::Compile::WSDL11->new('Example.wsdl'); my $call = $wsdl->compileClient('CreateCustomer'); # turn object into hashref my $call_request = $s->for_xml( $req ); my $answer = $call->( %$call_request ); # turn hashref into class args my $res_args = $s->for_class( $response_class, $answer ); my $res = Example::Op::CreateCustomer::Response->new( %$res_args );
This allows developers to work with classes instead of building the hashrefs. Those (Request|Response|Fault)$ classes could have their own methods, triggers, extended validation etc.
Please take a look at example/ directory for more details.
Regexp pattern for the class names namespace.
For given class name and hashref returned from SOAP call creates arguments needed to instantiate that class.
For class object creates arguments needed to pass to SOAP call.
Alex J. G. Burzyński, <ajgb at cpan.org>
<ajgb at cpan.org>
Please report any bugs or feature requests to bug-wsdl-compile at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WSDL-Compile. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-wsdl-compile at rt.cpan.org
Copyright 2009 Alex J. G. Burzyński.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License.
To install WSDL::Compile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WSDL::Compile
CPAN shell
perl -MCPAN -e shell install WSDL::Compile
For more information on module installation, please visit the detailed CPAN module installation guide.