thanks your reply, 
i am sorry for my befor problem description,it is not correct completely,
i want to receive a message like below , because client sends the fiexed soap 
message format and we can not modify it:
<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>

now my server can handle message below :
<ns2:subscribeServCfm 
xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0";> 
    <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>
   </subscribeServCfmReq>
</ns2:subscribeServCfm>
my publiced interface will throw exception if i did not replace element 
<ns2:subscribeServCfmReq> of <subscribeServCfmReq>.
i am confused , subscribeServCfm conbines with the namespace , but 
subscribeServCfmReq is not(althought i have add @XmlType namespace in t the 
class ) ? so that i  have to use StaxTransformFeature  to replace 
<ns2:subscribeServCfmReq> by <subscribeServCfmReq> . is there a way to add 
namespace for subscribeServCfmReq param in my interface configuration?

@WebService(targetNamespace="http://www.chinamobile.com/vgop/serviceorder/v1_0";)
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 {

@XmlElement(namespace="http://www.chinamobile.com/vgop/serviceorder/v1_0/common";)
public String getMsgTransactionID() {
return msgTransactionID;
}
...
}




cantalou89
From: Andrei Shakirin
Date: 2012-10-12 21:03
To: users@cxf.apache.org
CC: cantalou89
Subject: RE: cxf namespace
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:cantalo...@gmail.com] 
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

Reply via email to