I did this for tracking.
The only way to do this in 1.1 is to download the source, edit org.apache.axis.encoding.SerializationContextImpl method getPrefixForURI and replace the hardcoded "ns" with your string of choice (or I changed it to a system property for on the fly environment changes).
 
Then as long as you put this class folder higher in the classpath than axis, it will pick it up and you don't have to mess with anything else. Works like a charm for me.
 
jeremy


From: Sam Amarteifio [mailto:[EMAIL PROTECTED]
Sent: Friday, May 27, 2005 5:09 AM
To: [email protected]
Subject: Overriding default namespace - "ns1:xyz" to "ac:xyz"

We are in the early stages of building a web services application. In order for us to test what we have done so far were are sending a test message to the web services. In building the request message using Axis 1.1, the namespace prefixes are automatically generated by axis e.g. 'ns1' e.t.c. What we would like to do is to specify a prefix of our choice e.g. "ac".=20 =20 Below is a snap shot of how we are building the request message. =20

      Element reqElement     =3D document.createElementNS(Util.targetNS,

"Quote");

      reqElement.setPrefix("ac");

      Element sender     =3D document.createElementNS(Util.targetNS,

"Sender");

     reqElement.appendChild(sender);

=20

This is the current output of the request message.

=20

<?xml version=3D"1.0" encoding=3D"UTF-8"?>

<soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"

xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance">

 <soapenv:Body>

    <ns1:Quote xmlns:ns1=3D"....">

        <ns1:Sender> </ns1:Sender>

    </ns1:Quote>

 </soapenv:Body>

=20

=20

=20

Below is what we expected the request message will look like. =20 <?xml version=3D"1.0" encoding=3D"UTF-8"?> <soapenv:Envelope xmlns:soapenv=3D"http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema"

xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance">

 <soapenv:Body>

    <ac:Quote xmlns:ac=3D"....">

        <ac:Sender> </ac:Sender>

    </ac:Quote>

 </soapenv:Body>

 

 

 

SAM AMARTEIFIO

[EMAIL PROTECTED]

+44 (0)20 7780 5955

 

ec3 solutions /
1st floor 9-13 fenchurch buildings

london ec3m 5hr /

+44 (0)20 7780 5955 /

http://www.ec3.com /

 

 


Confidentiality Notice

This communication is strictly confidential. If you are not the intended recipient, you must not copy, distribute or take any action in reliance of it and destroy this email. Please immediately notify the sender or contact EC3 on telephone +44 (0)845 330 4396 or email '[EMAIL PROTECTED]'. The views represented in this email are not necessarily those of EC3.


Reply via email to