GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
XML::Compile::XOP(3) User Contributed Perl Documentation XML::Compile::XOP(3)

XML::Compile::XOP - MTOM and XOP handler

  # by default, XML::Compile encodes binary data
  my $answer    = $call->(image => $binary_image);

  # to enable use of MTOM
  use XML::Compile::XOP;
  my $xop       = XML::Compile::XOP->new;
  my $xop_image = $xop->bytes($binary_image);
  my $answer    = $call->(image => $xop_image);

  # returned XOPs in SOAP
  my ($answer, $trace, $xop) = $wsdl->call($operation)->(%data);
  print $_->string for @$xop;   # See XML::Compile::XOP::Include

The SOAP Message Transmission Optimization Mechanism (MTOM) is designed for SOAP1.2, but also usable for SOAP1.1. It optimizes the transport of binary information (like images) which are part of the XML message: in stead of base64 encoding them adding 25% to the size of the data, these binaries are added as pure binary attachment to the SOAP message.

In the official specification, the XML message will be created first with the base64 representation of the data in it. Only at transmission, a preprocessor XOP (XML-binary Optimized Packaging) extracts those components to be send separately. In Perl, we have to be more careful about performance. Therefore, the path via encoding to base64 and then decoding it back to binary in the sender (and the reverse process for the receiver) is avoided.

$obj->bytes( <STRING|SCALAR>, %options )
Create a XML::Compile::XOP::Include object which sources from a STRING (representing bytes) or a SCALAR reference to such a string. With the %options, you can overrule defaults generated for the "Include" object.

example: use of bytes()

  my $data = $xop->bytes($string, type => 'text/html');
  # $data is a XML::Compile::XOP::Include
    
$obj->file( <$filename|$fh>, %options )
Create a XML::Compile::XOP::Include object which sources from a FILE specified by NAME or HANDLE. With the %options, you can overrule defaults generated for the "Include" object.

example: use of file()

  use MIME::Types;
  my $mimetypes = MIME::Types->new;

  my $type = $mimetypes->mimeTypeOf($fn);
  my $data = $xop->file($fn, type => $fn);
  # $data is a XML::Compile::XOP::Include
    
XML::Compile::XOP->new(%options)
 -Option         --Default
  hostname         'localhost'
  xmlmime_version  XMIME11
  xop_version      XOP10
    
hostname => STRING
This is used as part of generated Content-IDs, which have the form of a email address.
xmlmime_version => URI
xop_version => URI

MTOM SOAP1.2: http://www.w3.org/TR/soap12-mtom/
MTOM SOAP1.1: http://schemas.xmlsoap.org/soap/mtom/SOAP11MTOM10.pdf
XOP: http://www.w3.org/TR/xop10/
XMLMIME: http://www.w3.org/TR/xml-media-types

This module is part of XML-Compile-SOAP distribution version 3.27, built on April 07, 2021. Website: http://perl.overmeer.net/CPAN/

Copyrights 2007-2021 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://dev.perl.org/licenses/

2021-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.