I've seen this same problem.  I think it's related to JAXB.  I'm not
positive here but I think if you use the same namespace for your web
service and your xsd file you'll end up with that ns2: namespace prefix.
I haven't done any real test to tell.  

 

________________________________

From: Daniel Brake [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 07, 2007 4:17 AM
To: [email protected]
Subject: [xfire-user] Using annotations to change the namespace prefix
from ns2 default

 

Hi There, 

We are having issues changing the namespace prefix in a SOAP message
when using xfire as our client to call a web service. 

Using annotations at package level we should be able to do something
like the following: 

@javax.xml.bind.annotation.XmlSchema ( 
  xmlns = { 
    @javax.xml.bind.annotation.XmlNs(prefix="prd",
namespaceURI="http://www.example.com/schemas/productSearch/20070108";),

    @javax.xml.bind.annotation.XmlNs(prefix="common",
namespaceURI="http://www.example.com/schemas/commonTypes/20070108";)

  } 
) 

 

In package-info.java and then see prefixes such as "prd" and "common" in
the resulting SOAP message. We always get the following:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>

        <soap:Body> 
                <ns2:productSearch
xmlns:ns3="http://www.example.com/schemas/commonTypes/20070108";
xmlns:ns2="http://www.example.com/schemas/productSearch/20070108";>

 
<ns2:productSearchText>HEDGEHOG</ns2:productSearchText> 
                        <ns3:dateRange> 
 
<ns3:startDate>2007-01-10</ns3:startDate> 
                                <ns3:endDate>2007-01-20</ns3:endDate> 
                        </ns3:dateRange> 
                </ns2:productSearch> 
        </soap:Body> 
</soap:Envelope> 

For some reason our element namespaces are being used correctly to
generate the xmlns tags, but the prefixes are the defaults n2, n3,
etc... instead of "prd", "common", etc... It seems like the package
level annotations, in particular the XmlNS annotation is being ignored.

Does anyone have any tips to try or examples to share? Is this a known
issue (we are using 1.2.4)? 

Thank you for your help. 

Daniel (Optimad) 


This email and any files transmitted with it are intended only for the
person(s) or entity to which they are addressed and may contain
confidential information. Any review, retransmission, dissemination,
copying or other use of, this information by persons or entities other
than the intended recipient is prohibited. If you have received this in
error and/or, are not the named addressee, please contact the sender and
delete the material from all computers.

Optimad does not accept any liability for the content of the email.
Although emails are routinely screened for viruses Optimad does not
accept responsibility for any damage caused. 

Replies to this email and all emails sent to Optimad Media Systems may
be intercepted by Message Labs and screened for viruses. Optimad
excludes all liability (to the extent permitted by law) to the senders
of emails to Optimad for the access to emails granted to Message Labs.

Reply via email to