I misspoke earlier - it was only "ns2011_05” I had to change, not “tns”.
I tried your suggestion (see attached sketch):
my $wsdl = XML::Compile::WSDL11->new(
$wsdlfn,
prefixes => {
ns2011_05 => 'http://www.taleo.com/ws/integration/toolkit/2005/07'
}
);
I got the following XML (note the change from “ns2011_05” to “ns2011_050":
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<wsa:MessageID
xmlns:wsa="http://www.w3.org/2005/03/addressing">Export-Test-0000</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>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<tns:submitDocument
xmlns:ns2011_050="http://www.taleo.com/ws/integration/toolkit/2011/05"
xmlns:tns="http://www.taleo.com/ws/integration/toolkit/2011/05/management"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ns2011_050:Document>
<ns2011_050:Attributes>
<ns2011_050:Attribute name="locale">en</ns2011_050:Attribute>
<ns2011_050:Attribute
name="version">http://www.taleo.com/ws/tee800/2009/01</ns2011_050:Attribute>
<ns2011_050:Attribute name="mode">T-XML</ns2011_050:Attribute>
<ns2011_050:Attribute name="largegraph">true</ns2011_050:Attribute>
</ns2011_050:Attributes>
<Content xmlns="http://www.taleo.com/ws/integration/toolkit/2005/07">
<ExportQuery>
<query xmlns="http://www.taleo.com/ws/integration/query"
projectedClass="Candidate"
alias="Query-Candidate-2F52C01E-E25D-11E5-B311-DF6053E18CB9"
preventDuplicates="false">
<projections>
<projection>
<field path="FirstName"/>
</projection>
<projection>
<field path="LastName"/>
</projection>
<projection>
<field path="EmailAddress"/>
</projection>
<projection>
<field path="Number"/>
</projection>
</projections>
<filterings>
<filtering>
<equal>
<field path="Number"/>
<integer>28423</integer>
</equal>
</filtering>
</filterings>
</query>
</ExportQuery>
</Content>
</ns2011_050:Document>
</tns:submitDocument>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Kit Peters
Doer of Things, ATS Integrations
D: 8162000279 M: 8162000279
On 3/31/16, 23:58, "Mark Overmeer" <[email protected]> wrote:
>* Kit Peters ([email protected]) [160331 22:27]:
>> However, when I change the namespaces with prefix “ns2011_05” and
>> “tns”, the server accepts the request. At present, I’m modifying
>> the namespaces in the transport_hook, but is there a better / more
>> elegant way to handle this?
>
>This sometimes happens: when the implementors of the server do
>not understand namespaces.
>
>You can do this:
>
> my $wsdl = XML::Compile::WSDL11->new($wsdlfn,
> prefixes => { tns => $somens, ... } );
>
>You must set your prefix preference before you read the XSD or WSDL.
>addPrefixes() is too late.
>--
>success,
> MarkOv
>
>------------------------------------------------------------------------
> Mark Overmeer MSc MARKOV Solutions
> [email protected] [email protected]
>http://Mark.Overmeer.net http://solutions.overmeer.net
use 5.016;
use DDP;
use Encode;
use FindBin qw($Bin);
use IPC::Run qw(run timeout);
use LWP::UserAgent;
use XML::Compile::Transport::SOAPHTTP;
use XML::Compile::SOAP11;
use XML::Compile::WSDL11;
use XML::LibXML;
#--------------------------------------------------------------
my $request_header_MsgID = { _ => "Export-Test-0000", };
#--------------------------------------------------------------
my $request_header_ReplyToAddress = { Address => "http://www.taleo.com/ws/integration/toolkit/2005/07/addressing/queue", };
#--------------------------------------------------------------
my $request_header_Action = { _ => 'http://www.taleo.com/ws/integration/toolkit/2005/07/action/export' };
my $doc = XML::LibXML::Document->new;
my $content = $doc->createElementNS( q(http://www.taleo.com/ws/integration/toolkit/2005/07), 'Content' );
$doc->setDocumentElement($content);
my $export_query = $content->appendChild( $doc->createElement(q(ExportQuery)) );
my $query = $export_query->appendChild( $doc->createElementNS( 'http://www.taleo.com/ws/integration/query', 'query' ) );
$query->setAttribute( projectedClass => 'Candidate' );
$query->setAttribute( alias => 'Query-Candidate-2F52C01E-E25D-11E5-B311-DF6053E18CB9' );
$query->setAttribute( preventDuplicates => 'false' );
my $projections = $query->appendChild( $doc->createElement('projections') );
for my $key (qw/FirstName LastName EmailAddress Number/) {
my $projection = $doc->createElement('projection');
my $field = $doc->createElement('field');
$field->setAttribute( path => $key );
$projection->appendChild($field);
$projections->appendChild($projection);
}
my $filterings = $query->appendChild( $doc->createElement('filterings') );
my %conditions = ( Number => 28423 );
for my $key (keys %conditions) {
my $filtering = $doc->createElement('filtering');
my $field = $filtering->appendChild($doc->createElement('equal'))->appendChild($doc->createElement('field'));
$field->setAttribute( path => $key );
$field->parentNode->appendTextChild( 'integer', $conditions{$key} );
$filterings->appendChild($filtering);
}
#--------------------------------------------------------------
my $parameters = {
#Document => $d
Document => { # sequence of Attributes, Content
Attributes => {
Attribute => [
{ name => "locale",
_ => "en",
},
{ name => 'version',
_ => 'http://www.taleo.com/ws/tee800/2009/01',
},
{ name => 'mode',
_ => 'T-XML',
},
{ name => 'largegraph',
_ => 'true',
}
],
},
# is an unnamed complex
Content => $content,
},
};
# Call with the combination of parts.
my @params = (
request_header_MsgID => $request_header_MsgID,
request_header_ReplyToAddress => $request_header_ReplyToAddress,
request_header_Action => $request_header_Action,
parameters => $parameters,
);
my $ua = LWP::UserAgent->new;
my $wsdl_file = qq{$Bin/bbdev_integration_management_service.wsdl};
my $soap = XML::Compile::WSDL11->new( $wsdl_file, prefixes => { ns2011_05 => 'http://www.taleo.com/ws/integration/toolkit/2005/07' } );
#my $soap = XML::Compile::WSDL11->new( $wsdl_file );
#$soap->addWSDL($wsdl_file);
$soap->compileCall(
'submitDocument',
alias => undef,
user_agent => $ua,
transport_hook => sub {
my ( $request, $trace ) = @_;
say prettify($request->decoded_content);
},
);
$soap->call('submitDocument', @params);
sub prettify {
my $in = shift;
my $content = "$in";
my ($out, $err);
run [qw/xmllint --format -/], \$content, \$out, \$err, timeout(10) or die qq{xmllint: $?};
die $err if $err;
return $out;
}
_______________________________________________
Xml-compile mailing list
[email protected]
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile