[Xml-compile] namespace adjustment

Jack Downes jax at nwmt.us
Sat Apr 15 17:28:08 GMT 2017


Mark, 
thanks for the really fast reply!  I have attempted several times to
sort out how to change the namespaces, and have solved the simple
problems.  There's one I cannot solve.  

Like you say, these shouldn't matter to the SOAP spec, so I'm not sure
if this is wasted time or not.  They have listed their example with the
namespaces as 'soap12' and not 'env12'.  Here's where I'm at:

<?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>
    <ProcessEligibility xmlns="https://claims.realmed.com">;
      <request>
	<SubmitterID>[submitter]</SubmitterID>
	<UserName>[Username]</UserName>
	<Password>[password]</Password>
	<AnsiRequest>ISA*00*          *00*          *ZZ*~</AnsiRequest>
	<ExternalPayerID>100222</ExternalPayerID>
	<UserDefined1></UserDefined1>
	<UserDefined2></UserDefined2>
	<TimeStamp>20170415 16:57:35</TimeStamp>
      </request>
    </ProcessEligibility>
  </env12:Body>
</env12:Envelope>

Now, trying to switch those last namespaces has been an interesting
series of failure on my part ;)

My relevant code:

my $wsdl = XML::Compile::WSDL11->new($conf->{'WSDL'},
                                 prefixes => {
                                       '' => 'https://claims.realmed.com',
                                    #'xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
                                    #'xsd' => 'http://www.w3.org/2001/XMLSchema',
                                    'body12' => "http://schemas.xmlsoap.org/wsdl/soap12/",
                                    'soap12' => "http://www.w3.org/2003/05/soap-envelope" }
                                 #use_default_namespace => 1
                                    );

and the error produced:
error: prefix `soap12' already refers to http://www.w3.org/2003/05/soap-envelope, cannot use it for http://schemas.xmlsoap.org/wsdl/soap12/
 at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/Cache.pm line 126

the body12 was an attempt to set the namespace, but that's failing...  so, it's prudent to ask.

Here's the trace as well:

./rtiv.pl 
trace: register prefix  for 'https://claims.realmed.com'
trace: register prefix soap12 for 'http://www.w3.org/2003/05/soap-envelope'
trace: register prefix body12 for 'http://schemas.xmlsoap.org/wsdl/soap12/'
trace: register prefix wsdl for 'http://schemas.xmlsoap.org/wsdl/'
trace: register prefix soap for 'http://schemas.xmlsoap.org/wsdl/soap/'
trace: register prefix http for 'http://schemas.xmlsoap.org/wsdl/http/'
trace: initialize SOAP11 for WSDL11
trace: cache parsed file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/WSDL11/xsd/wsdl-soap.xsd-1474318945-5761
trace: parsing XML from file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/WSDL11/xsd/wsdl-soap.xsd
trace: register prefix xs for 'http://www.w3.org/2001/XMLSchema'
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}address READER
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}operation READER
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}binding READER
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}body READER
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}header READER
trace: declare {http://schemas.xmlsoap.org/wsdl/soap/}fault READER
trace: initialize SOAP12 operations for WSDL11
trace: register prefix xsd for 'http://www.w3.org/2001/XMLSchema'
trace: register prefix xsi for 'http://www.w3.org/2001/XMLSchema-instance'
trace: register prefix env12 for 'http://www.w3.org/2003/05/soap-envelope'
trace: register prefix enc12 for 'http://www.w3.org/2003/05/soap-encoding'
trace: register prefix rpc12 for 'http://www.w3.org/2003/05/soap-rpc'
trace: cache parsed file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-encoding.xsd-1449659547-17192
trace: parsing XML from file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-encoding.xsd
trace: cache parsed file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-envelope.xsd-1449659547-5618
trace: parsing XML from file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-envelope.xsd
trace: cache parsed file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-rpc.xsd-1449659547-1090
trace: parsing XML from file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12/xsd/2003-soap-rpc.xsd
trace: cache parsed file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/xsd/1998-namespace.xsd-1490857076-5829
trace: parsing XML from file /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/xsd/1998-namespace.xsd
error: prefix `soap12' already refers to http://www.w3.org/2003/05/soap-envelope, cannot use it for http://schemas.xmlsoap.org/wsdl/soap12/
 at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/Cache.pm line 126
Log::Report::error("Log::Report::Message=HASH(0x1db8960)") at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/Cache.pm line 126
XML::Compile::Cache::addPrefixes("XML::Compile::WSDL11=HASH(0x42b878)", "soap12", "http://schemas.xmlsoap.org/wsdl/soap12/") at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/SOAP12.pm line 76
XML::Compile::SOAP12::_initWSDL11("XML::Compile::SOAP12", "XML::Compile::WSDL11=HASH(0x42b878)") at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile/WSDL11.pm line 48
XML::Compile::WSDL11::init("XML::Compile::WSDL11=HASH(0x42b878)", "HASH(0x1dafae0)") at /home/jax/local/lib/perl5/site_perl/5.24.1/XML/Compile.pm line 43
XML::Compile::new("XML::Compile::WSDL11", "/home/jax/rt-ins-verification/WSDL/QAVersion.wsdl", "prefixes", "HASH(0x4150c8)") at ./rtiv.pl line 20


if this is adjustable cool, if not; the world still spins!

thanks,
Jack

On Sat, 2017-04-15 at 11:10 +0200, Mark Overmeer wrote:
> * Jack Downes (jax at nwmt.us) [170415 07:49]:
> > 
> > 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:
> > 
> >   <soap12:Body>
> >     https://claims.realmed.com">;;
> >       <request>
> > 
> > What I'm getting:
> > 
> >   <env12:Body>
> >     https://claims.realmed.com">;;
> >       <tns:request>
> > 
> > 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"
> In the design of XML, the prefix (like soap12, env12, tns, or '') do
> not matter: they are abbreviations for the namespaces which look like
> URIs.  Above fragments mean exactly the same.
> 
> When you want a blank prefix to be used, you can use the
>     use_default_namespace => 1
> 
> Better to avoid the '' prefix for a namespace: it is also possible
> to have schema's which do not use namespaces (very bad idea, but they
> do exist)  They would also have no prefix.  Confusion all over the
> place.
> 
> Or even specify your preference by:
> 
>    $wsdl->new(...
>       prefixes => {
>           soap12 => "http://www.w3.org/2003/05/soap-envelope",
>           '' => 'https://claims.realmed.com',
>       }
>    );
> 
> > 
> > The endpoint is a Microsoft server *I think*, but vendor won't confirm.
> You do not need to specify the server's type.  Some servers produce
> error messages which use their private schema... to be able to interpret
> those correctly, you need to load that schema.  By specifying the
> server type, that schema is loaded for you... but in practive, usually
> those extensions are invisible for a well-behaving server.
-- 
-- 
Jack Downes
Unique Solutions, Inc.
e: jack at unisolinc.us, jax at nwmt.us
skype: coder at nwmt.us
p: 406 387 4242
f: 406 387 4541




More information about the Xml-compile mailing list