<div dir="ltr">Hi Kip,<div><br></div><div>@Hi Mark!<br></div><div><br></div><div>I've been using XOP for a few years in Production with XML::Compile in two different scripts. </div><div><br></div><div>It's been a while since I had to put this together so I don'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->new($primary_wsdl,
                                          schema_dirs => \@schema_dirs)
                 || die "[Error] UNABLE TO CREATE XML::Compile::WSDL11 OBJECT";
foreach (@wsdls) {
        $xml_compile->addWSDL($_);
}
foreach (@schemas) {
        $xml_compile->importDefinitions($_);
}
# 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 => $self->soap_version);
# 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]";
}</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"><<a href="mailto:Kit.Peters@broadbean.com" target="_blank">Kit.Peters@broadbean.com</a>></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 <Attributes>…</Attributes><<wbr>Content>…</Content><br>
my $xop = XML::Compile::XOP->new;<br>
my $content = $xop->bytes( $xml_content, type => ‘text/xml’ );<br>
# Call to submitLargeDocument has been compiled already<br>
$wsdl->call( ‘submitLargeDocument’, parameters => { Document => $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>
<?xml version="1.0" encoding="UTF-8"?><br>
<soap11:Envelope xmlns:soap11="<a href="http://schemas.xmlsoap.org/soap/envelope/" rel="noreferrer" target="_blank">http://schemas.<wbr>xmlsoap.org/soap/envelope/</a>"><br>
<soap11:Header><br>
<wsa:MessageID xmlns:wsa="<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>">Query-<wbr>Export-5490E6F8-94BE-11E6-<wbr>9A62-DBB52521867A</wsa:<wbr>MessageID><br>
<wsa:ReplyTo xmlns:wsa="<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>"><br>
<wsa:Address><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></wsa:<wbr>Address><br>
</wsa:ReplyTo><br>
<wsa:Action xmlns:wsa="<a href="http://www.w3.org/2005/03/addressing" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2005/03/addressing</a>"><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><<wbr>/wsa:Action><br>
</soap11:Header><br>
<soap11:Body><br>
<tns0:submitLargeDocument xmlns:tns0="<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>" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance" rel="noreferrer" target="_blank">http://www.w3.org/<wbr>2001/XMLSchema-instance</a>"><br>
<tns0:Document><!-- # Long base64 string redacted --> tns0:Document><br>
</tns0:submitLargeDocument><br>
</soap11:Body><br>
</soap11:Envelope><br>
<br>
I expect this is happening because of the following element in the WSDL:<br>
<br>
<xsd:element name="submitLargeDocument"><br>
<xsd:complexType><br>
<xsd:sequence><br>
<xsd:element maxOccurs="1" minOccurs="1" name="Document" nillable="true" type="nsm:StreamBody" nsxmlmime:<wbr>expectedContentTypes="<wbr>application/octet-stream"/><br>
</xsd:sequence><br>
</xsd:complexType><br>
</xsd:element><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, "Mark Overmeer" <<a href="mailto:mark@overmeer.net">mark@overmeer.net</a>> wrote:<br>
<br>
* Kit Peters (<a href="mailto:Kit.Peters@broadbean.com">Kit.Peters@broadbean.com</a>) [161014 15:33]:<br>
<span class=""> > How do I make an XOP request using XML::Compile::WSDL11? I’ve seen<br>
> the XOP unit test in XML::Compile::SOAP, but I’m not sure how to adapt<br>
> 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>