Hi,
I guess you can achieve it by setting elementFormDefault to unqualified in your
schema:
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:your="http://www.chinamobile.com/vgop/serviceorder/v1_0">
...
Than you will get the namespace prefix only in the first tag:
<ns3:subscribeServCfm
xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0"
xmlns:ns3="http://main.ehealth.funo.com/">
<subscribeServCfmReq>
<cfmResult>00</cfmResult>
<msgTransactionID>qq</msgTransactionID>
<oprTime>123</oprTime>
</subscribeServCfmReq>
</ns3:subscribeServCfm>
In the same way it should work by @XmlSchema annotation in your
package-info.java:
@javax.xml.bind.annotation.XmlSchema(namespace =
"http://www.w3.org/2002/03/xkms#", elementFormDefault =
javax.xml.bind.annotation.XmlNsForm.UNQUALIFIED)
Hope it helps.
Regards,
Andrei.
-----Original Message-----
From: cantalou89 [mailto:[email protected]]
Sent: Freitag, 12. Oktober 2012 03:17
To: users
Subject: cxf namespace
deal all:
i have a problem about the customize namespace, i public a webservice interface
below:
@WebService(targetNamespace="http://www.chinamobile.com/vgop/serviceorder/v1_0")
@EndpointProperty(key = "soap.no.validate.parts", value = "true") public
interface UserOrderServer {
@ResponseWrapper(className="com.funo.ehealth.SubscribeServCfmResp",targetNamespace="http://www.chinamobile.com/vgop/serviceorder/v1_0")
@WebMethod(operationName="subscribeServCfm")
public SubscribeServCfmResp
subscribeServCfm(@WebParam(name="subscribeServCfmReq")SubscribeServCfmReq
subscribeServCfmReq) ; }
@XmlType(name="subscribeServCfmReq",namespace="http://www.chinamobile.com/vgop/serviceorder/v1_0")
public class SubscribeServCfmReq {
...
}
this interface can handle the soap message like below. the subscribeServCfmReq
is without namespace, <ns3:subscribeServCfm
xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0"
xmlns:ns3="http://main.ehealth.funo.com/">
<subscribeServCfmReq>
<cfmResult>00</cfmResult>
<msgTransactionID>qq</msgTransactionID>
<oprTime>123</oprTime>
</subscribeServCfmReq>
</ns3:subscribeServCfm>
and the client send a message like below,the subscribeServCfmReq is with
namespace <ns2:subscribeServCfm
xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
<ns2:subscribeServCfmReq>
<ns1:msgTransactionID
xmlns:ns1="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">555</ns1:msgTransactionID>
<ns1:oprTime
xmlns:ns1="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">20121011094323</ns1:oprTime>
<ns1:cfmResult
xmlns:ns1="http://www.chinamobile.com/vgop/serviceorder/v1_0/common">00</ns1:cfmResult>
</ns2:subscribeServCfmReq>
</ns2:subscribeServCfm>
i try to use StaxTransformFeature with expression "<entry
key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq"
value="subscribeServCfmReq" /> " , and then it works fine,but i want to modify
the annotataion to meet the message, not StaxTransformFeature , is it any way
to do?
thanks
cantalou89