<div dir="ltr">Hi Kip,<div><br></div><div>@Hi Mark!<br></div><div><br></div><div>I&#39;ve been using XOP for a few years in Production with XML::Compile in two different scripts.  </div><div><br></div><div>It&#39;s been a while since I had to put this together so I don&#39;t remember the particulars.  </div><div><br></div><div>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:</div><div><br></div><div>I hope this helps!</div><div><br></div><div>Chris</div><div><pre class="gmail-_ad_Y1" style="white-space:pre-wrap;color:rgb(0,0,0)">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-&gt;new($primary_wsdl,
                                              schema_dirs =&gt; \@schema_dirs) 
                       || die &quot;[Error] UNABLE TO CREATE XML::Compile::WSDL11 OBJECT&quot;;

foreach (@wsdls) {
        $xml_compile-&gt;addWSDL($_);
}

foreach (@schemas) {
        $xml_compile-&gt;importDefinitions($_);
}

# setup the XML::Compile transport for HTTP with the LWP user_agent
my $ua = LWP::UserAgent-&gt;new(keep_alive =&gt; 1);
 
if ($jar_file) {
 
        $ua-&gt;cookie_jar( {file =&gt; $jar_file, 
                          autosave       =&gt; 1, 
                          ignore_discard =&gt; 1 });

}

my $transport = XML::Compile::Transport::SOAPHTTP-&gt;new(user_agent =&gt; $ua, 
                                                       soap       =&gt; $self-&gt;soap_version);

# compile the client call    
my $client_call = $xml_compile-&gt;compileClient($operation_name, 
                                                port  =&gt; $service_port, 
                                              trans =&gt; $transport);

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

eval {

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

};

if ($@) {

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

}</pre></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 17, 2016 at 4:27 PM, Kit Peters <span dir="ltr">&lt;<a href="mailto:Kit.Peters@broadbean.com" target="_blank">Kit.Peters@broadbean.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried that, like so (not actual code):<br>
<br>
# $xml_content is &lt;Attributes&gt;…&lt;/Attributes&gt;&lt;<wbr>Content&gt;…&lt;/Content&gt;<br>
my $xop = XML::Compile::XOP-&gt;new;<br>
my $content = $xop-&gt;bytes( $xml_content, type =&gt; ‘text/xml’ );<br>
# Call to submitLargeDocument has been compiled already<br>
$wsdl-&gt;call( ‘submitLargeDocument’, parameters =&gt; { Document =&gt; $content } );<br>
<br>
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:<br>
<br>
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;soap11:Envelope xmlns:soap11=&quot;<a href="http://schemas.xmlsoap.org/soap/envelope/" rel="noreferrer" target="_blank">http://schemas.<wbr>xmlsoap.org/soap/envelope/</a>&quot;&gt;<br>
  &lt;soap11:Header&gt;<br>
    &lt;wsa:MessageID xmlns:wsa=&quot;<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>&quot;&gt;Query-<wbr>Export-5490E6F8-94BE-11E6-<wbr>9A62-DBB52521867A&lt;/wsa:<wbr>MessageID&gt;<br>
    &lt;wsa:ReplyTo xmlns:wsa=&quot;<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>&quot;&gt;<br>
      &lt;wsa:Address&gt;<a href="http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue" rel="noreferrer" target="_blank">http://www.taleo.<wbr>com/ws/integration/toolkit/<wbr>2005/07/addressing/queue</a>&lt;/wsa:<wbr>Address&gt;<br>
    &lt;/wsa:ReplyTo&gt;<br>
    &lt;wsa:Action xmlns:wsa=&quot;<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>&quot;&gt;<a href="http://www.taleo.com/ws/integration/toolkit/2005/07/action/export" rel="noreferrer" target="_blank">http://<wbr>www.taleo.com/ws/integration/<wbr>toolkit/2005/07/action/export</a>&lt;<wbr>/wsa:Action&gt;<br>
  &lt;/soap11:Header&gt;<br>
  &lt;soap11:Body&gt;<br>
    &lt;tns0:submitLargeDocument xmlns:tns0=&quot;<a href="http://www.taleo.com/ws/integration/toolkit/2011/05/management" rel="noreferrer" target="_blank">http://www.taleo.<wbr>com/ws/integration/toolkit/<wbr>2011/05/management</a>&quot; xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2001/XMLSchema-instance</a>&quot;&gt;<br>
      &lt;tns0:Document&gt;&lt;!-- # Long base64 string redacted --&gt; tns0:Document&gt;<br>
    &lt;/tns0:submitLargeDocument&gt;<br>
  &lt;/soap11:Body&gt;<br>
&lt;/soap11:Envelope&gt;<br>
<br>
I expect this is happening because of the following element in the WSDL:<br>
<br>
            &lt;xsd:element name=&quot;submitLargeDocument&quot;&gt;<br>
                &lt;xsd:complexType&gt;<br>
                    &lt;xsd:sequence&gt;<br>
                        &lt;xsd:element maxOccurs=&quot;1&quot; minOccurs=&quot;1&quot; name=&quot;Document&quot; nillable=&quot;true&quot; type=&quot;nsm:StreamBody&quot; nsxmlmime:<wbr>expectedContentTypes=&quot;<wbr>application/octet-stream&quot;/&gt;<br>
                    &lt;/xsd:sequence&gt;<br>
                &lt;/xsd:complexType&gt;<br>
            &lt;/xsd:element&gt;<br>
<br>
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?<br>
<span class=""><br>
KP<br>
--<br>
Kit Peters<br>
Doer of Things, ATS Integrations<br>
</span><span class="">D: <a href="tel:%2B1%20949%20793%208208" value="+19497938208">+1 949 793 8208</a>   M: <a href="tel:%2B1%20816%20200%200279" value="+18162000279">+1 816 200 0279</a><br>
<br>
</span>On 10/17/16, 04:54, &quot;Mark Overmeer&quot; &lt;<a href="mailto:mark@overmeer.net">mark@overmeer.net</a>&gt; wrote:<br>
<br>
    * Kit Peters (<a href="mailto:Kit.Peters@broadbean.com">Kit.Peters@broadbean.com</a>) [161014 15:33]:<br>
<span class="">    &gt; How do I make an XOP request using XML::Compile::WSDL11? I’ve seen<br>
    &gt; the XOP unit test in XML::Compile::SOAP, but I’m not sure how to adapt<br>
    &gt; that to a compiled call with XML::Compile::WSDL11.<br>
<br>
</span>    Produce the XOP Include elements and put them in your data-tree on the<br>
    usual spot for that data.  During the creation of the SOAP message,<br>
    it will get attached and replaced by the attachement reference.<br>
    --<br>
    greetz,<br>
                   MarkOv<br>
<br>
    ------------------------------<wbr>------------------------------<wbr>------------<br>
           Mark Overmeer MSc                                MARKOV Solutions<br>
           Mark@Overmeer.net                          <a href="mailto:solutions@overmeer.net">solutions@overmeer.net</a><br>
    <a href="http://Mark.Overmeer.net" rel="noreferrer" target="_blank">http://Mark.Overmeer.net</a>                   <a href="http://solutions.overmeer.net" rel="noreferrer" target="_blank">http://solutions.overmeer.net</a><br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Xml-compile mailing list<br>
<a href="mailto:Xml-compile@lists.scsys.co.uk">Xml-compile@lists.scsys.co.uk</a><br>
<a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile" rel="noreferrer" target="_blank">http://lists.scsys.co.uk/cgi-<wbr>bin/mailman/listinfo/xml-<wbr>compile</a><br>
</blockquote></div><br></div>