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 Raphael Jacquemin <rj...@gmail.com> on 2005/08/11 15:09:47 UTC

Namespace and prefix issues

Hello, 

I use Axis for creating Web Services.

I' ve some troubles with my namespace. 
I use a the tool wsdl2java for generating my java class.

Here is the beginning of my wsdl file, where are defined the different
namespace  :

<wsdl:definitions
    targetNamespace='http://schemas.xmlsoap.org/ws/2004/09/mex'
    xmlns:wsm='http://schemas.xmlsoap.org/ws/2004/09/mex'
    xmlns:wsa='http://schemas.xmlsoap.org/ws/2004/08/addressing'
    xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
....
________________________________________________________________

My troubles are with my the prefix "wsm". I have to use this specific
prefix.But with my generate java code, I don't find this prefix in my
SOAP messages.
First I will show you the required SOAP message and then the SOAP
message obtain with my code. I'm sure I use the good wsdl file


Here is a well formed SOAP message : 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"
xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wdp="http://schemas.xmlsoap.org/ws/2004/08/devprof"
xmlns:wsm="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:wsd="http://schemas.xmlsoap.org/ws/2004/02/discovery">

<SOAP-ENV:Header>
<wsa:To>uuid:00001f90-0000-1000-8000-000bcd4ab3de</wsa:To>
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/mex/MetadataExchange/GetMetadataRequest</wsa:Action>
<wsa:MessageId>uuid:65cb6464-d758-11d9-b16f-000bcd4ab3de</wsa:MessageId>
<wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo>
</SOAP-ENV:Header>
<SOAP-ENV:Body id="_0">
<wsm:GetMetadata>
<wsm:Dialect>http://schemas.xmlsoap.org/ws/2004/08/devprof/Relationship</wsm:Dialect>
</wsm:GetMetadata>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Here, is my obtained SOAP 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"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<soapenv:Header>
<wsa:MessageID soapenv:mustUnderstand="0">uuid:7ed58220-0a64-11da-aa4d-bc6f8a64de0c</wsa:MessageID>
<wsa:To soapenv:mustUnderstand="0">http://localhost:8085/</wsa:To>
<wsa:Action soapenv:mustUnderstand="0">http://schemas.xmlsoap.org/ws/2004/09/mex/MetadataExchange/GetMetadataRequest</wsa:Action>
<wsa:From soapenv:mustUnderstand="0">           
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:From>
<wsa:ReplyTo soapenv:mustUnderstand="0">           
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:ReplyTo>
</soapenv:Header>
<soapenv:Body>
<GetMetadata xmlns="">
<ns1:Dialect xmlns:ns1="http://schemas.xmlsoap.org/ws/2004/09/mex">http://schemas.xmlsoap.org/ws/2004/08/devprof/ThisModel</ns1:Dialect>
</GetMetadata>
</soapenv:Body>
</soapenv:Envelope>



So, As you can see in my SOAP message the "wsm" prefix is replaced by the ns1.
I know that normally a translation is made and only the URL :
"http://schemas.xmlsoap.org/ws/2004/09/mex" is important. But I need
an exact matching with wsm for my application :
<wsm:GetMetadata>
<wsm:Dialect>http://schemas.xmlsoap.org/ws/2004/08/devprof/Relationship</wsm:Dialect>
</wsm:GetMetadata>

What 's possible in order to force the "wsm" prefix.
Do I modify the Wsdl2java tools or modify the wsdl file  ?

I can send my complete wsdl file if you need.

Thanks in advance.

Regards
Raphael Jacquemin