SOAP-Lite
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
my $server = SOAP::Transport::HTTP::CGI
->dispatch_to('My::Parameters')
->options({compress_threshold => 10000})
->handle;
For more information see COMPRESSION in HTTP::Transport.
SECURITY
For security reasons, the existing path for Perl modules (@INC) will be
disabled once you have chosen dynamic deployment and specified your own
"PATH/". If you wish to access other modules in your included package
you have several options:
1 Switch to static linking:
use MODULE;
$server->dispatch_to('MODULE');
Which can also be useful when you want to import something specific
from the deployed modules:
use MODULE qw(import_list);
2 Change "use" to "require". The path is only unavailable during the
initialization phase. It is available once more during execution.
Therefore, if you utilize "require" somewhere in your package, it
will work.
3 Wrap "use" in an "eval" block:
eval 'use MODULE qw(import_list)'; die if $@;
4 Set your include path in your package and then specify "use". Don't
forget to put @INC in a "BEGIN{}" block or it won't work. For
example,
BEGIN { @INC = qw(my_directory); use MODULE }
INTEROPERABILITY
Microsoft .NET client with SOAP::Lite Server
In order to use a .NET client with a SOAP::Lite server, be sure you use
fully qualified names for your return values. For example:
return SOAP::Data->name('myname')
->type('string')
->uri($MY_NAMESPACE)
->value($output);
In addition see comment about default encoding in .NET Web Services
below.
SOAP::Lite client with a .NET server
If experiencing problems when using a SOAP::Lite client to call a .NET
Web service, it is recommended you check, or adhere to all of the
following recommendations:
Declare a proper soapAction in your call
For example, use "on_action( sub {
'http://www.myuri.com/WebService.aspx#someMethod'; } )".
Disable charset definition in Content-type header
Some users have said that Microsoft .NET prefers the value of the
Content-type header to be a mimetype exclusively, but SOAP::Lite
specifies a character set in addition to the mimetype. This results
in an error similar to:
Server found request content type to be 'text/xml; charset=utf-8',
but expected 'text/xml'
To turn off this behavior specify use the following code:
use SOAP::Lite;
$SOAP::Constants::DO_NOT_USE_CHARSET = 1;
# The rest of your code
Use fully qualified name for method parameters
For example, the following code is preferred:
SOAP::Data->name(Query => 'biztalk')
->uri('http://tempuri.org/')
As opposed to:
SOAP::Data->name('Query' => 'biztalk')
Place method in default namespace
For example, the following code is preferred:
my $method = SOAP::Data->name('add')
->attr({xmlns => 'http://tempuri.org/'});
my @rc = $soap->call($method => @parms)->result;
As opposed to:
my @rc = $soap->call(add => @parms)->result;
# -- OR --
my @rc = $soap->add(@parms)->result;
Disable use of explicit namespace prefixes
Some user's have reported that .NET will simply not parse messages
that use namespace prefixes on anything but SOAP elements
themselves. For example, the following XML would not be parsed:
<SOAP-ENV:Envelope ...attributes skipped>
<SOAP-ENV:Body>
<namesp1:mymethod xmlns:namesp1="urn:MyURI" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
SOAP::Lite allows users to disable the use of explicit namespaces
through the "use_prefix()" method. For example, the following code:
$som = SOAP::Lite->uri('urn:MyURI')
->proxy($HOST)
->use_prefix(0)
->myMethod();
Will result in the following XML, which is more palatable by .NET:
<SOAP-ENV:Envelope ...attributes skipped>
<SOAP-ENV:Body>
<mymethod xmlns="urn:MyURI" />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Modify your .NET server, if possible
Stefan Pharies <stefanph@microsoft.com>:
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.631 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )