Hello, I'm new to using XML::Compile and all it's related modules. Today is my first day in fact!
So, I'll present what I need, what I'm producing, and the code used to do so. Hope this helps explain my problem: What I'm expected to produce: <?xml version="1.0" encoding="utf-8"?> <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"> <soap12:Body> <ProcessEligibility xmlns="https://claims.realmed.com">; <request> <SubmitterID>string</SubmitterID> <UserName>string</UserName> <Password>string</Password> <AnsiRequest>string</AnsiRequest> <ExternalPayerID>string</ExternalPayerID> <UserDefined1>string</UserDefined1> <UserDefined2>string</UserDefined2> <TimeStamp>string</TimeStamp> </request> </ProcessEligibility> </soap12:Body> </soap12:Envelope> What I'm getting: <?xml version="1.0" encoding="UTF-8"?> <env12:Envelope xmlns:env12="http://www.w3.org/2003/05/soap-envelope">; <env12:Body> <tns:ProcessEligibility xmlns:tns="https://claims.realmed.com">; <tns:request> <tns:SubmitterID>[submitter]</tns:SubmitterID> <tns:UserName>[username]</tns:UserName> <tns:Password>[password]</tns:Password> <tns:AnsiRequest>ISA*00* *00* *ZZ*~</tns:Ansi Request> <tns:UserDefined1></tns:UserDefined1> <tns:UserDefined2></tns:UserDefined2> <tns:TimeStamp>20170415 07:17:38</tns:TimeStamp> </tns:request> </tns:ProcessEligibility> </env12:Body> </env12:Envelope> So... the problem, well, I think it's an issue anyway, is the various namespace identifiers. How do I make it so there are no "tns:" markers? Also, it looks like "env12:" should be "soap12" The endpoint is a Microsoft server *I think*, but vendor won't confirm. I think the solution could be had here: https://metacpan.org/pod/XML::C ompile::Cache#Prefix-management but so far, I've not had much success. My code is mostly from the examples and the helper scripts: #!/home/jax/local/bin/perl use strict; use warnings; use Config::General; use Data::Dumper; use XML::Compile::WSDL11; use XML::Compile::SOAP; use XML::Compile::SOAP11; use XML::Compile::SOAP12; use XML::Compile::Transport::SOAPHTTP; #use Log::Report mode => 'DEBUG'; # or 'VERBOSE' my $conf = Config::General->new( -ConfigFile => "config.conf")->{DefaultConfig}; my $AnsiRequest = "ISA*00* *00* *ZZ*~"; my $wsdl = XML::Compile::WSDL11->new($conf->{'WSDL'}, server_type => 'SharePoint'); my $call = $wsdl->compileClient('ProcessEligibility', port => 'wsElig270Soap12' ); # This struture based on the output from the explain... my $parameters = { (request => {'SubmitterID' => $conf->{'SubmitterID'}, 'UserName' => $conf->{'UserName'}, 'Password' => $conf->{'Password'}, 'AnsiRequest' => $AnsiRequest, 'UserDefined1' => '', 'UserDefined2' => '', 'TimeStamp' => quick_timestamp() } )}; my ($answer, $trace) = $call->($parameters); # @params will become %$data_in in the server handler. # $answer is a HASH, an operation OUTPUT or Fault. # $trace is an XML::Compile::SOAP::Trace object. # You may get an error back from the server if(my $f = $answer->{Fault}) { my $errname = $f->{_NAME}; my $error = $answer->{$errname}; print "$error->{code}\n"; my $details = $error->{detail}; if(not $details) { # system error, no $details } exit 1; } print Dumper($answer); print Dumper($trace); sub quick_timestamp { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); my $nice_timestamp = sprintf ( "%04d%02d%02d %02d:%02d:%02d", $year+1900,$mon+1,$mday,$hour,$min,$ sec); return $nice_timestamp; } thanks much! Jack _______________________________________________ Xml-compile mailing list [email protected] http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/xml-compile
