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

KP

--
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" 
<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 
particulars.

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!

Chris

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]";



}

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/";>
  <soap11:Header>
    <wsa:MessageID 
xmlns:wsa="http://www.w3.org/2005/03/addressing";>Query-Export-5490E6F8-94BE-11E6-9A62-DBB52521867A</wsa:MessageID>
    <wsa:ReplyTo xmlns:wsa="http://www.w3.org/2005/03/addressing";>
      
<wsa:Address>http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue</wsa:Address>
    </wsa:ReplyTo>
    <wsa:Action 
xmlns:wsa="http://www.w3.org/2005/03/addressing";>http://www.taleo.com/ws/integration/toolkit/2005/07/action/export</wsa:Action>
  </soap11:Header>
  <soap11:Body>
    <tns0:submitLargeDocument 
xmlns:tns0="http://www.taleo.com/ws/integration/toolkit/2011/05/management"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
      <tns0:Document><!-- # Long base64 string redacted --> tns0:Document>
    </tns0:submitLargeDocument>
  </soap11:Body>
</soap11:Envelope>

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

            <xsd:element name="submitLargeDocument">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="1" minOccurs="1" 
name="Document" nillable="true" type="nsm:StreamBody" 
nsxmlmime:expectedContentTypes="application/octet-stream"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>

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?

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

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.
    --
    greetz,
                   MarkOv

    ------------------------------------------------------------------------
           Mark Overmeer MSc                                MARKOV Solutions
           m...@overmeer.net                          
soluti...@overmeer.net<mailto:soluti...@overmeer.net>
    http://Mark.Overmeer.net                   http://solutions.overmeer.net



_______________________________________________
Xml-compile mailing list
Xml-compile@lists.scsys.co.uk<mailto:Xml-compile@lists.scsys.co.uk>
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile

_______________________________________________
Xml-compile mailing list
Xml-compile@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile

Reply via email to