You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cantalou89 <ca...@gmail.com> on 2012/10/12 04:29:00 UTC
cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
dear all:
i use cxf2.6.2 to public webservice , now i want to replace elememt , it works fine in inTransformElements , but outTransformElements was not.
the configuration:
<bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
<property name="inTransformElements">
<map>
<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
</map>
</property>
<property name="outTransformElements">
<map>
<entry key="return" value="ns2:subscribeServCfmResp" />
</map>
</property>
</bean>
but client receive a message like that:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>
<return><result>0</result></return></ns2:subscribeServCfmResponse></soap:Body></soap:Envelope>
the outTransformElements is not work , is it the configuration correct ? or there is another way to do this
thanks
cantalou89
Re: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements
does not work
Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 12/10/12 03:29, cantalou89 wrote:
> dear all:
> i use cxf2.6.2 to public webservice , now i want to replace elememt , it works fine in inTransformElements , but outTransformElements was not.
> the configuration:
> <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
> <property name="inTransformElements">
> <map>
> <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
> </map>
> </property>
> <property name="outTransformElements">
> <map>
> <entry key="return" value="ns2:subscribeServCfmResp" />
> </map>
> </property>
> </bean>
> but client receive a message like that:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
> <ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>
> <return><result>0</result></return></ns2:subscribeServCfmResponse></soap:Body></soap:Envelope>
>
It has to be
<entry key="return"
value="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResp"
/>
Cheers, Sergey
> the outTransformElements is not work , is it the configuration correct ? or there is another way to do this
> thanks
>
>
>
>
> cantalou89
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements
does not work
Posted by Sergey Beryozkin <sb...@gmail.com>.
On 12/10/12 15:04, cantalou89 wrote:
> Thanks for your reply.
> 1.the problem about<ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0> is just type error
> 2.my all configuration is below
> <jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws" implementor="com.funo.ehealth.ws.UserOrderServerImpl">
> <jaxws:features>
> <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
> <property name="inTransformElements">
> <map>
> <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
> </map>
> </property>
> <property name="outTransformElements">
> <map>
> <entry key="return" value="ns2:subscribeServCfmResp" />
> </map>
> </property>
> </bean>
> <bean class="org.apache.cxf.feature.LoggingFeature" />
> </jaxws:features>
> </jaxws:endpoint>
>
> after many tests, i found a interesting thing that outTransformElements will work fine when i add a SAAJOutInterceptor or impl the SAAJOutInterceptor (althought do nothing in handle method ) to the<jaxws:outInterceptors> . Why ? Does the soap message not generated when StaxTransformFeature invokes ? Does SAAJOutInterceptor handles the message before StaxTransformFeature and genetate the soap message ?
I'm not sure why SAAJOutInterceptor is needed in this case but you can
always configure the feature interceptors directly to run at a stage
different to the default one they run at.
Perhaps it is the structure of SOAP response that affects the way CXF
Soap interceptors operate with XML writers and SAAJOutInterceptor
indirectly helps. Adjusting the phase of the feature interceptors may
help instead.
Also, please check if SAAJOutInterceptor is still needed if you remove
LoggingFeature ?
Sergey
>
>
>
> cantalou89
>
> From: Andrei Shakirin
> Date: 2012-10-12 20:33
> To: users@cxf.apache.org
> CC: cantalou89
> Subject: RE: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
> Hi,
>
> Just re-tested in my environment, it works without problem.
>
> I receive response
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
> <soap:Body>
> <ns2:subscribeServCfmResponse xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
> <ns2:subscribeServCfmResp>
> <result>0</result>
> </ns2:subscribeServCfmResp>
> </ns2:subscribeServCfmResponse>
> </soap:Body>
> </soap:Envelope>
>
> from original response
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
> <ns2:subscribeServCfmReq xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
> <return><result>0</result></return></ns2:subscribeServCfmReq></soap:Body></soap:Envelope>
>
> "result" element was replaced.
> Could you also provide spring configuration for the service endpoint?
>
> Two other points:
> 1) Response in your mail was not well-formed, double quotas are missing for the namespace:<ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>.
> Not sure is that just typo error.
>
> 2) I find fragile to replace element with predefined prefix:
> <entry key="return" value="ns2:subscribeServCfmResp" />
>
> If new namespace will be added, prefix ns2 can point on another namespace or be undefined.
> The safer was is to replace element wit namespace:
> <entry key="return" value="="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResp" />
>
> Regards,
> Andrei.
>
> -----Original Message-----
> From: cantalou89 [mailto:cantalou89@gmail.com]
> Sent: Freitag, 12. Oktober 2012 04:29
> To: users
> Subject: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
>
> dear all:
> i use cxf2.6.2 to public webservice , now i want to replace elememt , it works fine in inTransformElements , but outTransformElements was not.
> the configuration:
> <bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
> <property name="inTransformElements">
> <map>
> <entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
> </map>
> </property>
> <property name="outTransformElements">
> <map>
> <entry key="return" value="ns2:subscribeServCfmResp" />
> </map>
> </property>
> </bean>
> but client receive a message like that:
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
> <ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>
> <return><result>0</result></return></ns2:subscribeServCfmResponse></soap:Body></soap:Envelope>
>
> the outTransformElements is not work , is it the configuration correct ? or there is another way to do this thanks
>
>
>
>
> cantalou89
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
Re: RE: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
Posted by cantalou89 <ca...@gmail.com>.
Thanks for your reply.
1.the problem about <ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0> is just type error
2.my all configuration is below
<jaxws:endpoint id="UserOrderServer" address="/UserOrderServer.jws" implementor="com.funo.ehealth.ws.UserOrderServerImpl">
<jaxws:features>
<bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
<property name="inTransformElements">
<map>
<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
</map>
</property>
<property name="outTransformElements">
<map>
<entry key="return" value="ns2:subscribeServCfmResp" />
</map>
</property>
</bean>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
</jaxws:endpoint>
after many tests, i found a interesting thing that outTransformElements will work fine when i add a SAAJOutInterceptor or impl the SAAJOutInterceptor (althought do nothing in handle method ) to the <jaxws:outInterceptors> . Why ? Does the soap message not generated when StaxTransformFeature invokes ? Does SAAJOutInterceptor handles the message before StaxTransformFeature and genetate the soap message ?
cantalou89
From: Andrei Shakirin
Date: 2012-10-12 20:33
To: users@cxf.apache.org
CC: cantalou89
Subject: RE: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
Hi,
Just re-tested in my environment, it works without problem.
I receive response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:subscribeServCfmResponse xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
<ns2:subscribeServCfmResp>
<result>0</result>
</ns2:subscribeServCfmResp>
</ns2:subscribeServCfmResponse>
</soap:Body>
</soap:Envelope>
from original response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<ns2:subscribeServCfmReq xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
<return><result>0</result></return></ns2:subscribeServCfmReq></soap:Body></soap:Envelope>
"result" element was replaced.
Could you also provide spring configuration for the service endpoint?
Two other points:
1) Response in your mail was not well-formed, double quotas are missing for the namespace: <ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>.
Not sure is that just typo error.
2) I find fragile to replace element with predefined prefix:
<entry key="return" value="ns2:subscribeServCfmResp" />
If new namespace will be added, prefix ns2 can point on another namespace or be undefined.
The safer was is to replace element wit namespace:
<entry key="return" value="="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResp" />
Regards,
Andrei.
-----Original Message-----
From: cantalou89 [mailto:cantalou89@gmail.com]
Sent: Freitag, 12. Oktober 2012 04:29
To: users
Subject: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
dear all:
i use cxf2.6.2 to public webservice , now i want to replace elememt , it works fine in inTransformElements , but outTransformElements was not.
the configuration:
<bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
<property name="inTransformElements">
<map>
<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
</map>
</property>
<property name="outTransformElements">
<map>
<entry key="return" value="ns2:subscribeServCfmResp" />
</map>
</property>
</bean>
but client receive a message like that:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>
<return><result>0</result></return></ns2:subscribeServCfmResponse></soap:Body></soap:Envelope>
the outTransformElements is not work , is it the configuration correct ? or there is another way to do this thanks
cantalou89
RE: cxf org.apache.cxf.feature.StaxTransformFeature
outTransformElements does not work
Posted by Andrei Shakirin <as...@talend.com>.
Hi,
Just re-tested in my environment, it works without problem.
I receive response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:subscribeServCfmResponse xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
<ns2:subscribeServCfmResp>
<result>0</result>
</ns2:subscribeServCfmResp>
</ns2:subscribeServCfmResponse>
</soap:Body>
</soap:Envelope>
from original response
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<ns2:subscribeServCfmReq xmlns:ns2="http://www.chinamobile.com/vgop/serviceorder/v1_0">
<return><result>0</result></return></ns2:subscribeServCfmReq></soap:Body></soap:Envelope>
"result" element was replaced.
Could you also provide spring configuration for the service endpoint?
Two other points:
1) Response in your mail was not well-formed, double quotas are missing for the namespace: <ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>.
Not sure is that just typo error.
2) I find fragile to replace element with predefined prefix:
<entry key="return" value="ns2:subscribeServCfmResp" />
If new namespace will be added, prefix ns2 can point on another namespace or be undefined.
The safer was is to replace element wit namespace:
<entry key="return" value="="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmResp" />
Regards,
Andrei.
-----Original Message-----
From: cantalou89 [mailto:cantalou89@gmail.com]
Sent: Freitag, 12. Oktober 2012 04:29
To: users
Subject: cxf org.apache.cxf.feature.StaxTransformFeature outTransformElements does not work
dear all:
i use cxf2.6.2 to public webservice , now i want to replace elememt , it works fine in inTransformElements , but outTransformElements was not.
the configuration:
<bean id="transformFeature" class="org.apache.cxf.feature.StaxTransformFeature">
<property name="inTransformElements">
<map>
<entry key="{http://www.chinamobile.com/vgop/serviceorder/v1_0}subscribeServCfmReq" value="subscribeServCfmReq" />
</map>
</property>
<property name="outTransformElements">
<map>
<entry key="return" value="ns2:subscribeServCfmResp" />
</map>
</property>
</bean>
but client receive a message like that:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body>
<ns2:subscribeServCfmResponse xmlns:ns2=http://www.chinamobile.com/vgop/serviceorder/v1_0>
<return><result>0</result></return></ns2:subscribeServCfmResponse></soap:Body></soap:Envelope>
the outTransformElements is not work , is it the configuration correct ? or there is another way to do this thanks
cantalou89