What do your @request_params look like there? Because I’m not seeing anywhere 
that your request is being formatted as XOP/MTOM.


Kit Peters
Doer of Things, ATS Integrations
D: +1 949 793 8208   M: +1 816 200 0279

From: Christopher Taranto <christop...@tokpela.com>
Date: Monday, October 17, 2016 at 18:55
To: Kit Peters <kit.pet...@broadbean.com>
Cc: Mark Overmeer <m...@overmeer.net>, "xml-compile@lists.scsys.co.uk" 
Subject: Re: [Xml-compile] XOP with XML::Compile::WSDL11

Hi Kip,

@Hi Mark!

I've been using XOP for a few years in Production with XML::Compile in two 
different scripts.

It's been a while since I had to put this together so I don't remember the 

The below code is not the working code - as it is separated behind objects etc 
- but I think I have patched together the general theme:

I hope this helps!


use XML::Compile::WSDL11;      # use WSDL version 1.1

use XML::Compile::SOAP11;      # use SOAP version 1.1

use XML::Compile::Transport::SOAPHTTP;

use XML::Compile::XOP;

my $xml_compile = XML::Compile::WSDL11->new($primary_wsdl,

                                          schema_dirs => \@schema_dirs)

                    || die "[Error] UNABLE TO CREATE XML::Compile::WSDL11 

foreach (@wsdls) {



foreach (@schemas) {



# setup the XML::Compile transport for HTTP with the LWP user_agent

my $ua = LWP::UserAgent->new(keep_alive => 1);

if ($jar_file) {

        $ua->cookie_jar( {file => $jar_file,

                         autosave       => 1,

                         ignore_discard => 1 });


my $transport = XML::Compile::Transport::SOAPHTTP->new(user_agent => $ua,

                                                     soap       => 

# compile the client call

my $client_call = $xml_compile->compileClient($operation_name,

                                             port  => $service_port,

                                            trans => $transport);

my ($answer, $trace, $xops);

eval {

        ($answer, $trace, $xops) = $client_call->(@request_params);


if ($@) {

        die "[Error] UNABLE TO COMPLETE REQUEST: [$@] - ANSWER[$answer] - 
TRACE[$trace] - XOPS[$xops]";


On Mon, Oct 17, 2016 at 4:27 PM, Kit Peters 
<kit.pet...@broadbean.com<mailto:kit.pet...@broadbean.com>> wrote:
I tried that, like so (not actual code):

# $xml_content is <Attributes>…</Attributes><Content>…</Content>
my $xop = XML::Compile::XOP->new;
my $content = $xop->bytes( $xml_content, type => ‘text/xml’ );
# Call to submitLargeDocument has been compiled already
$wsdl->call( ‘submitLargeDocument’, parameters => { Document => $content } );

And when I look at the content just before it’s sent to the server, I don’t see 
that it’s being translated into MTOM. Instead I see:

<?xml version="1.0" encoding="UTF-8"?>
<soap11:Envelope xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/";>
    <wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/03/addressing";>
      <tns0:Document><!-- # Long base64 string redacted --> tns0:Document>

I expect this is happening because of the following element in the WSDL:

            <xsd:element name="submitLargeDocument">
                        <xsd:element maxOccurs="1" minOccurs="1" 
name="Document" nillable="true" type="nsm:StreamBody" 

Am I doing the XOP right, and if so, how do I put this into MTOM, rather than 
just base64 encoding the XML fragment? Do I need to fiddle the WSDL somehow?

Kit Peters
Doer of Things, ATS Integrations
D: +1 949 793 8208<tel:%2B1%20949%20793%208208>   M: +1 816 200 

On 10/17/16, 04:54, "Mark Overmeer" 
<m...@overmeer.net<mailto:m...@overmeer.net>> wrote:

    * Kit Peters (kit.pet...@broadbean.com<mailto:kit.pet...@broadbean.com>) 
[161014 15:33]:
    > How do I make an XOP request using XML::Compile::WSDL11? I’ve seen
    > the XOP unit test in XML::Compile::SOAP, but I’m not sure how to adapt
    > that to a compiled call with XML::Compile::WSDL11.

    Produce the XOP Include elements and put them in your data-tree on the
    usual spot for that data.  During the creation of the SOAP message,
    it will get attached and replaced by the attachement reference.

           Mark Overmeer MSc                                MARKOV Solutions
    http://Mark.Overmeer.net                   http://solutions.overmeer.net

Xml-compile mailing list

Xml-compile mailing list

Reply via email to