<div dir="ltr">Hi Kit,<div><br></div><div>You do not need to do any formatting - just add the data to the data structure.  XML::Compile will take care of the Base64 encoding.</div><div><br></div><div><div>I created the data structure using explain method from the XML::Compile::WSDL11 module.</div><div><br></div><div>Creating the request looks something like this:</div><div><br></div><div>my %Request;</div><div>$Request{TransactionId} = $transaction_number;</div><div>$Request{SenderInfo}    = \%SenderInfo;</div><div>$Request{Document}      = \%Document;</div><div>my @result              = (parameters =&gt; { Request =&gt; \%Request });</div><div><br></div><div>And, here is the script that I used to generate the data structure using explain.</div><div> </div><div>use strict;</div><div>use warnings;</div><div> </div><div>use XML::Compile::WSDL11;      # use WSDL version 1.1</div><div>use XML::Compile::SOAP11;      # use SOAP version 1.1</div><div>use XML::Compile::Transport::SOAPHTTP;</div><div>use XML::Compile::XOP;</div><div> </div><div>my $explain_input_file  = &#39;input.txt&#39;;</div><div>my $explain_output_file = &#39;output.txt&#39;;</div><div> </div><div>my $wsdl                = XML::Compile::WSDL11-&gt;new(&#39;SERVICE.WSDL&#39;);</div><div>$wsdl-&gt;importDefinitions(&#39;XMLMimeTypes.xsd&#39;);</div><div>$wsdl-&gt;importDefinitions(&#39;SERVICE.XSD&#39;);</div><div><br></div><div>my $call                = $wsdl-&gt;compileClient(&#39;UploadOperation&#39;);</div><div> </div><div>if (open(my $ifh, &#39;&gt;&#39;, $explain_input_file)) {</div><div>  </div><div>   print $ifh $wsdl-&gt;explain(&#39;UploadOperation&#39;, PERL =&gt; &#39;INPUT&#39;, recurse =&gt; 1);</div><div>   close($ifh);</div><div>   </div><div>} else {</div><div>  </div><div>   die &quot;[Error] UNABLE TO OPEN [$explain_input_file] - [$!]&quot;;</div><div>   </div><div>}</div><div> </div><div>if (open(my $ofh, &#39;&gt;&#39;, $explain_output_file)) {</div><div>  </div><div>   print $ofh $wsdl-&gt;explain(&#39;UploadOperation&#39;, PERL =&gt; &#39;OUTPUT&#39;, recurse =&gt; 1);</div><div>   close($ofh);</div><div>   </div><div>} else {</div><div>  </div><div>   die &quot;[Error] UNABLE TO OPEN [$explain_output_file] - [$!]&quot;;</div><div>   </div><div>}</div><div> </div><div>print &quot;Done\n&quot;;</div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 18, 2016 at 7:23 AM, 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">







<div bgcolor="white" lang="EN-US" link="blue" vlink="purple">
<div class="m_5193527851839430188WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">What do your @request_params look like there? Because I’m not seeing anywhere that your request is being formatted as XOP/MTOM.<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri">KP<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Calibri;color:black">--<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:11.5pt;font-family:&quot;Calibri Light&quot;;color:#919195">Kit Peters</span><span style="font-size:13.5pt;font-family:Times;color:black"><br>
</span><span style="font-size:9.5pt;font-family:&quot;Calibri Light&quot;;color:#566b10">Doer of Things, ATS Integrations<br>
</span><span style="font-size:9.5pt;font-family:&quot;Calibri Light&quot;;color:#919195">D: <a href="tel:%2B1%20949%20793%208208" value="+19497938208" target="_blank">+1 949 793 8208</a>   M: <a href="tel:%2B1%20816%20200%200279" value="+18162000279" target="_blank">+1 816 200 0279</a></span><span style="font-size:11.0pt;font-family:Calibri"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Calibri"><u></u> <u></u></span></p>
</span><div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-family:Calibri;color:black">From: </span>
</b><span style="font-family:Calibri;color:black">Christopher Taranto &lt;<a href="mailto:christopher@tokpela.com" target="_blank">christopher@tokpela.com</a>&gt;<br>
<b>Date: </b>Monday, October 17, 2016 at 18:55<br>
<b>To: </b>Kit Peters &lt;<a href="mailto:Kit.Peters@broadbean.com" target="_blank">Kit.Peters@broadbean.com</a>&gt;<br>
<b>Cc: </b>Mark Overmeer &lt;<a href="mailto:mark@overmeer.net" target="_blank">mark@overmeer.net</a>&gt;, &quot;<a href="mailto:xml-compile@lists.scsys.co.uk" target="_blank">xml-compile@lists.scsys.co.uk</a><wbr>&quot; &lt;<a href="mailto:xml-compile@lists.scsys.co.uk" target="_blank">xml-compile@lists.scsys.co.uk</a><wbr>&gt;<br>
<b>Subject: </b>Re: [Xml-compile] XOP with XML::Compile::WSDL11<u></u><u></u></span></p>
</div><div><div class="h5">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Hi Kip, <u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">@Hi Mark!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I&#39;ve been using XOP for a few years in Production with XML::Compile in two different scripts.  <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">It&#39;s been a while since I had to put this together so I don&#39;t remember the particulars.  <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">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:<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I hope this helps!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Chris<u></u><u></u></p>
</div>
<div>
<pre style="white-space:pre-wrap"><span style="color:black">use XML::Compile::WSDL11;      # use WSDL version 1.1<u></u><u></u></span></pre>
<pre><span style="color:black">use XML::Compile::SOAP11;      # use SOAP version 1.1<u></u><u></u></span></pre>
<pre><span style="color:black">use XML::Compile::Transport::<wbr>SOAPHTTP;<u></u><u></u></span></pre>
<pre><span style="color:black">use XML::Compile::XOP;<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">my $xml_compile = XML::Compile::WSDL11-&gt;new($<wbr>primary_wsdl,<u></u><u></u></span></pre>
<pre><span style="color:black">                                          schema_dirs =&gt; \@schema_dirs) <u></u><u></u></span></pre>
<pre><span style="color:black">                    || die &quot;[Error] UNABLE TO CREATE XML::Compile::WSDL11 OBJECT&quot;;<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">foreach (@wsdls) {<u></u><u></u></span></pre>
<pre><span style="color:black">        $xml_compile-&gt;addWSDL($_);<u></u><u></u></span></pre>
<pre><span style="color:black">}<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">foreach (@schemas) {<u></u><u></u></span></pre>
<pre><span style="color:black">        $xml_compile-&gt;<wbr>importDefinitions($_);<u></u><u></u></span></pre>
<pre><span style="color:black">}<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black"># setup the XML::Compile transport for HTTP with the LWP user_agent<u></u><u></u></span></pre>
<pre><span style="color:black">my $ua = LWP::UserAgent-&gt;new(keep_alive =&gt; 1);<u></u><u></u></span></pre>
<pre><span style="color:black"> <u></u><u></u></span></pre>
<pre><span style="color:black">if ($jar_file) {<u></u><u></u></span></pre>
<pre><span style="color:black"> <u></u><u></u></span></pre>
<pre><span style="color:black">        $ua-&gt;cookie_jar( {file =&gt; $jar_file, <u></u><u></u></span></pre>
<pre><span style="color:black">                         autosave       =&gt; 1, <u></u><u></u></span></pre>
<pre><span style="color:black">                         ignore_discard =&gt; 1 });<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">}<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">my $transport = XML::Compile::Transport::<wbr>SOAPHTTP-&gt;new(user_agent =&gt; $ua, <u></u><u></u></span></pre>
<pre><span style="color:black">                              <wbr>                       soap       =&gt; $self-&gt;soap_version);<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black"># compile the client call    <u></u><u></u></span></pre>
<pre><span style="color:black">my $client_call = $xml_compile-&gt;compileClient($<wbr>operation_name, <u></u><u></u></span></pre>
<pre><span style="color:black">                                             port  =&gt; $service_port, <u></u><u></u></span></pre>
<pre><span style="color:black">                              <wbr>              trans =&gt; $transport);<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">my ($answer, $trace, $xops);<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">eval {<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">        ($answer, $trace, $xops) = $client_call-&gt;(@request_<wbr>params);<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">};<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">if ($@) {<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">        die &quot;[Error] UNABLE TO COMPLETE REQUEST: [$@] - ANSWER[$answer] - TRACE[$trace] - XOPS[$xops]&quot;;<u></u><u></u></span></pre>
<pre><span style="color:black"><u></u> <u></u></span></pre>
<pre><span style="color:black">}<u></u><u></u></span></pre>
</div>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Mon, Oct 17, 2016 at 4:27 PM, Kit Peters &lt;<a href="mailto:Kit.Peters@broadbean.com" target="_blank">Kit.Peters@broadbean.com</a>&gt; wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<p class="MsoNormal">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;<span style="font-family:PMingLiU"><br>
</span>my $xop = XML::Compile::XOP-&gt;new;<span style="font-family:PMingLiU"><br>
</span>my $content = $xop-&gt;bytes( $xml_content, type =&gt; ‘text/xml’ );<span style="font-family:PMingLiU"><br>
</span># Call to submitLargeDocument has been compiled already<span style="font-family:PMingLiU"><br>
</span>$wsdl-&gt;call( ‘submitLargeDocument’, parameters =&gt; { Document =&gt; $content } );<span style="font-family:PMingLiU"><br>
<br>
</span>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:<span style="font-family:PMingLiU"><br>
<br>
</span>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<span style="font-family:PMingLiU"><br>
</span>&lt;soap11:Envelope xmlns:soap11=&quot;<a href="http://schemas.xmlsoap.org/soap/envelope/" 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" 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" 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" 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" 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" 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" 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" 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>
<br>
KP<br>
--<br>
Kit Peters<br>
Doer of Things, ATS Integrations<br>
D: <a href="tel:%2B1%20949%20793%208208" target="_blank">+1 949 793 8208</a>   M: <a href="tel:%2B1%20816%20200%200279" target="_blank">
+1 816 200 0279</a><br>
<br>
On 10/17/16, 04:54, &quot;Mark Overmeer&quot; &lt;<a href="mailto:mark@overmeer.net" target="_blank">mark@overmeer.net</a>&gt; wrote:<br>
<br>
    * Kit Peters (<a href="mailto:Kit.Peters@broadbean.com" target="_blank">Kit.Peters@broadbean.com</a>) [161014 15:33]:<br>
    &gt; How do I make an XOP request using XML::Compile::WSDL11? I’ve seen<span style="font-family:PMingLiU"><br>
</span>    &gt; the XOP unit test in XML::Compile::SOAP, but I’m not sure how to adapt<span style="font-family:PMingLiU"><br>
</span>    &gt; that to a compiled call with XML::Compile::WSDL11.<span style="font-family:PMingLiU"><br>
<br>
</span>    Produce the XOP Include elements and put them in your data-tree on the<span style="font-family:PMingLiU"><br>
</span>    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" target="_blank">
solutions@overmeer.net</a><br>
    <a href="http://Mark.Overmeer.net" target="_blank">http://Mark.Overmeer.net</a>                   <a href="http://solutions.overmeer.net" 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" target="_blank">Xml-compile@lists.scsys.co.uk</a><br>
<a href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile" target="_blank">http://lists.scsys.co.uk/cgi-<wbr>bin/mailman/listinfo/xml-<wbr>compile</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>