You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by arcus <mm...@arcus.com.au> on 2004/01/04 11:19:57 UTC

Repeated namespace declarations

The WSDL my Axis based client has to use has its messages and types in
different namespaces. This leads to repetition of the namespace declaration
inflating the message sizes quite significantly. Is there a way to tell Axis
to add a namespace declaration to top element.

Here is an example message:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <PackageCommit
xmlns="http://Portal1.landata.vic.gov.au/Portal/2.50/ExternalWSDL">
   <applicantData>
    <ns1:name
xmlns:ns1="http://Portal1.landata.vic.gov.au/Portal/2.50/types">Anstat
Property Information</ns1:name>
    <ns2:address1
xmlns:ns2="http://Portal1.landata.vic.gov.au/Portal/2.50/types"> 224-226
Normanby Rd</ns2:address1>
    <ns3:address2
xmlns:ns3="http://Portal1.landata.vic.gov.au/Portal/2.50/types"> Southbank
VIC 3006</ns3:address2>
    <ns4:phone
xmlns:ns4="http://Portal1.landata.vic.gov.au/Portal/2.50/types">03 9278
1172</ns4:phone>
    <ns5:dx
xmlns:ns5="http://Portal1.landata.vic.gov.au/Portal/2.50/types">DX332
MELBOURNE</ns5:dx>
    <ns6:fax
xmlns:ns6="http://Portal1.landata.vic.gov.au/Portal/2.50/types">03 9645
2519</ns6:fax>
   </applicantData>
  </PackageCommit>
 </soapenv:Body>
</soapenv:Envelope>

The namespace delcaration for
"http://Portal1.landata.vic.gov.au/Portal/2.50/types" is repeated 6 times.
It would be much more economical if this message would look like:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <PackageCommit
xmlns="http://Portal1.landata.vic.gov.au/Portal/2.50/ExternalWSDL"

xmlns:ns=http://Portal1.landata.vic.gov.au/Portal/2.50/types"
  >
   <applicantData>
    <ns:name>Anstat Property Information</ns:name>
    <ns:address1> 224-226 Normanby Rd</ns:address1>
    <ns:address2> Southbank VIC 3006</ns:address2>
    <ns:phone>03 9278 1172</ns:phone>
    <ns:dx>DX332 MELBOURNE</ns:dx>
    <ns:fax>03 9645 2519</ns:fax>
   </applicantData>
  </PackageCommit>
 </soapenv:Body>
</soapenv:Envelope>

Is there a way to do that in Axis? Note: I used the WSDL2Java tool to
generate all the message encoder/decoders.

Manuel