You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Daniel Kulp <dk...@apache.org> on 2012/11/13 13:12:21 UTC

Re: svn commit: r1408627 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java

Umm…   this puts a dependency on the jaxws API from the soap binding which would be a new dep.   That's "OK" for trunk since the JAX-WS API's are built in the JDK, but that wouldn't be ok to be merged back.   

Ideally, this should be done somehow in the JAXWS layer.  Most likely, after the invoke completes, the JAXWS invoker should remove the callback off of the param list.

Dan


On Nov 13, 2012, at 2:50 AM, ffang@apache.org wrote:

> Author: ffang
> Date: Tue Nov 13 07:50:14 2012
> New Revision: 1408627
> 
> URL: http://svn.apache.org/viewvc?rev=1408627&view=rev
> Log:
> [CXF-4623]Marshalling Error during asynchronous service invocation when adding a soap header using a SOAPHandler
> 
> Modified:
>    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
> 
> Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=1408627&r1=1408626&r2=1408627&view=diff
> ==============================================================================
> --- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
> +++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Tue Nov 13 07:50:14 2012
> @@ -27,6 +27,7 @@ import java.util.ResourceBundle;
> 
> import javax.xml.stream.XMLStreamException;
> import javax.xml.stream.XMLStreamWriter;
> +import javax.xml.ws.AsyncHandler;
> 
> import org.w3c.dom.Element;
> 
> @@ -212,13 +213,20 @@ public class SoapOutInterceptor extends 
>             if (headers == null) {
>                 return endedHeader;
>             }            
> +            
> 
>             for (SoapHeaderInfo header : headers) {
>                 MessagePartInfo part = header.getPart();
>                 if (wrappedBmi != bmi) {
>                     part = wrappedBmi.getMessageInfo().addMessagePart(part.getName());
>                 }
> -                if (part.getIndex() >= objs.size()) {
> +                int paraLength = objs.size();
> +                if (objs.get(paraLength - 1) instanceof AsyncHandler) {
> +                    //when use asyn handler in bare mode the last parameter is AsyncHandler
> +                    //which shouldn't count in as parameter length
> +                    paraLength = paraLength - 1;
> +                }
> +                if (part.getIndex() >= paraLength) {
>                     // The optional out of band header is not a part of parameters of the method
>                     continue;
>                 }
> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: svn commit: r1408627 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java

Posted by Freeman Fang <fr...@gmail.com>.
Thanks Dan.

Revised fix accordingly.
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-13, at 下午10:41, Daniel Kulp wrote:

> 
> On Nov 13, 2012, at 8:59 AM, Freeman Fang <fr...@gmail.com> wrote:
> 
>> Thanks Dan.
>> 
>> But this check is for client side. 
> 
> Ah… confused by the commit message.
> 
> In that case, the AsyncHandler shouldn't even be added to the MessageContentsList at the very beginning in the JaxWsClientProxy.invokeAsync method.  It likely should pull the handler completely off the param list and not pass it as its not really something that should ever be marshaled, etc...
> 
> Dan
> 
> 
> 
>> To avoid introducing new dependency, how about we just get obj interface name and compare it with string "javax.xml.ws.AsyncHandler"?
>> 
>> Freeman
>> -------------
>> Freeman(Yue) Fang
>> 
>> Red Hat, Inc. 
>> FuseSource is now part of Red Hat
>> Web: http://fusesource.com | http://www.redhat.com/
>> Twitter: freemanfang
>> Blog: http://freemanfang.blogspot.com
>> http://blog.sina.com.cn/u/1473905042
>> weibo: http://weibo.com/u/1473905042
>> 
>> On 2012-11-13, at 下午8:12, Daniel Kulp wrote:
>> 
>>> 
>>> Umm…   this puts a dependency on the jaxws API from the soap binding which would be a new dep.   That's "OK" for trunk since the JAX-WS API's are built in the JDK, but that wouldn't be ok to be merged back.   
>>> 
>>> Ideally, this should be done somehow in the JAXWS layer.  Most likely, after the invoke completes, the JAXWS invoker should remove the callback off of the param list.
>>> 
>>> Dan
>>> 
>>> 
>>> On Nov 13, 2012, at 2:50 AM, ffang@apache.org wrote:
>>> 
>>>> Author: ffang
>>>> Date: Tue Nov 13 07:50:14 2012
>>>> New Revision: 1408627
>>>> 
>>>> URL: http://svn.apache.org/viewvc?rev=1408627&view=rev
>>>> Log:
>>>> [CXF-4623]Marshalling Error during asynchronous service invocation when adding a soap header using a SOAPHandler
>>>> 
>>>> Modified:
>>>> cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>>>> 
>>>> Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>>>> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=1408627&r1=1408626&r2=1408627&view=diff
>>>> ==============================================================================
>>>> --- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
>>>> +++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Tue Nov 13 07:50:14 2012
>>>> @@ -27,6 +27,7 @@ import java.util.ResourceBundle;
>>>> 
>>>> import javax.xml.stream.XMLStreamException;
>>>> import javax.xml.stream.XMLStreamWriter;
>>>> +import javax.xml.ws.AsyncHandler;
>>>> 
>>>> import org.w3c.dom.Element;
>>>> 
>>>> @@ -212,13 +213,20 @@ public class SoapOutInterceptor extends 
>>>>          if (headers == null) {
>>>>              return endedHeader;
>>>>          }            
>>>> +            
>>>> 
>>>>          for (SoapHeaderInfo header : headers) {
>>>>              MessagePartInfo part = header.getPart();
>>>>              if (wrappedBmi != bmi) {
>>>>                  part = wrappedBmi.getMessageInfo().addMessagePart(part.getName());
>>>>              }
>>>> -                if (part.getIndex() >= objs.size()) {
>>>> +                int paraLength = objs.size();
>>>> +                if (objs.get(paraLength - 1) instanceof AsyncHandler) {
>>>> +                    //when use asyn handler in bare mode the last parameter is AsyncHandler
>>>> +                    //which shouldn't count in as parameter length
>>>> +                    paraLength = paraLength - 1;
>>>> +                }
>>>> +                if (part.getIndex() >= paraLength) {
>>>>                  // The optional out of band header is not a part of parameters of the method
>>>>                  continue;
>>>>              }
>>>> 
>>>> 
>>> 
>>> -- 
>>> Daniel Kulp
>>> dkulp@apache.org - http://dankulp.com/blog
>>> Talend Community Coder - http://coders.talend.com
>>> 
>> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
> 


Re: svn commit: r1408627 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java

Posted by Daniel Kulp <dk...@apache.org>.
On Nov 13, 2012, at 8:59 AM, Freeman Fang <fr...@gmail.com> wrote:

> Thanks Dan.
> 
> But this check is for client side. 

Ah… confused by the commit message.

In that case, the AsyncHandler shouldn't even be added to the MessageContentsList at the very beginning in the JaxWsClientProxy.invokeAsync method.  It likely should pull the handler completely off the param list and not pass it as its not really something that should ever be marshaled, etc...

Dan



> To avoid introducing new dependency, how about we just get obj interface name and compare it with string "javax.xml.ws.AsyncHandler"?
> 
> Freeman
> -------------
> Freeman(Yue) Fang
> 
> Red Hat, Inc. 
> FuseSource is now part of Red Hat
> Web: http://fusesource.com | http://www.redhat.com/
> Twitter: freemanfang
> Blog: http://freemanfang.blogspot.com
> http://blog.sina.com.cn/u/1473905042
> weibo: http://weibo.com/u/1473905042
> 
> On 2012-11-13, at 下午8:12, Daniel Kulp wrote:
> 
>> 
>> Umm…   this puts a dependency on the jaxws API from the soap binding which would be a new dep.   That's "OK" for trunk since the JAX-WS API's are built in the JDK, but that wouldn't be ok to be merged back.   
>> 
>> Ideally, this should be done somehow in the JAXWS layer.  Most likely, after the invoke completes, the JAXWS invoker should remove the callback off of the param list.
>> 
>> Dan
>> 
>> 
>> On Nov 13, 2012, at 2:50 AM, ffang@apache.org wrote:
>> 
>>> Author: ffang
>>> Date: Tue Nov 13 07:50:14 2012
>>> New Revision: 1408627
>>> 
>>> URL: http://svn.apache.org/viewvc?rev=1408627&view=rev
>>> Log:
>>> [CXF-4623]Marshalling Error during asynchronous service invocation when adding a soap header using a SOAPHandler
>>> 
>>> Modified:
>>>  cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>>> 
>>> Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>>> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=1408627&r1=1408626&r2=1408627&view=diff
>>> ==============================================================================
>>> --- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
>>> +++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Tue Nov 13 07:50:14 2012
>>> @@ -27,6 +27,7 @@ import java.util.ResourceBundle;
>>> 
>>> import javax.xml.stream.XMLStreamException;
>>> import javax.xml.stream.XMLStreamWriter;
>>> +import javax.xml.ws.AsyncHandler;
>>> 
>>> import org.w3c.dom.Element;
>>> 
>>> @@ -212,13 +213,20 @@ public class SoapOutInterceptor extends 
>>>           if (headers == null) {
>>>               return endedHeader;
>>>           }            
>>> +            
>>> 
>>>           for (SoapHeaderInfo header : headers) {
>>>               MessagePartInfo part = header.getPart();
>>>               if (wrappedBmi != bmi) {
>>>                   part = wrappedBmi.getMessageInfo().addMessagePart(part.getName());
>>>               }
>>> -                if (part.getIndex() >= objs.size()) {
>>> +                int paraLength = objs.size();
>>> +                if (objs.get(paraLength - 1) instanceof AsyncHandler) {
>>> +                    //when use asyn handler in bare mode the last parameter is AsyncHandler
>>> +                    //which shouldn't count in as parameter length
>>> +                    paraLength = paraLength - 1;
>>> +                }
>>> +                if (part.getIndex() >= paraLength) {
>>>                   // The optional out of band header is not a part of parameters of the method
>>>                   continue;
>>>               }
>>> 
>>> 
>> 
>> -- 
>> Daniel Kulp
>> dkulp@apache.org - http://dankulp.com/blog
>> Talend Community Coder - http://coders.talend.com
>> 
> 

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: svn commit: r1408627 - /cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java

Posted by Freeman Fang <fr...@gmail.com>.
Thanks Dan.

But this check is for client side. 
To avoid introducing new dependency, how about we just get obj interface name and compare it with string "javax.xml.ws.AsyncHandler"?

Freeman
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042

On 2012-11-13, at 下午8:12, Daniel Kulp wrote:

> 
> Umm…   this puts a dependency on the jaxws API from the soap binding which would be a new dep.   That's "OK" for trunk since the JAX-WS API's are built in the JDK, but that wouldn't be ok to be merged back.   
> 
> Ideally, this should be done somehow in the JAXWS layer.  Most likely, after the invoke completes, the JAXWS invoker should remove the callback off of the param list.
> 
> Dan
> 
> 
> On Nov 13, 2012, at 2:50 AM, ffang@apache.org wrote:
> 
>> Author: ffang
>> Date: Tue Nov 13 07:50:14 2012
>> New Revision: 1408627
>> 
>> URL: http://svn.apache.org/viewvc?rev=1408627&view=rev
>> Log:
>> [CXF-4623]Marshalling Error during asynchronous service invocation when adding a soap header using a SOAPHandler
>> 
>> Modified:
>>   cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>> 
>> Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java
>> URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java?rev=1408627&r1=1408626&r2=1408627&view=diff
>> ==============================================================================
>> --- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java (original)
>> +++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/SoapOutInterceptor.java Tue Nov 13 07:50:14 2012
>> @@ -27,6 +27,7 @@ import java.util.ResourceBundle;
>> 
>> import javax.xml.stream.XMLStreamException;
>> import javax.xml.stream.XMLStreamWriter;
>> +import javax.xml.ws.AsyncHandler;
>> 
>> import org.w3c.dom.Element;
>> 
>> @@ -212,13 +213,20 @@ public class SoapOutInterceptor extends 
>>            if (headers == null) {
>>                return endedHeader;
>>            }            
>> +            
>> 
>>            for (SoapHeaderInfo header : headers) {
>>                MessagePartInfo part = header.getPart();
>>                if (wrappedBmi != bmi) {
>>                    part = wrappedBmi.getMessageInfo().addMessagePart(part.getName());
>>                }
>> -                if (part.getIndex() >= objs.size()) {
>> +                int paraLength = objs.size();
>> +                if (objs.get(paraLength - 1) instanceof AsyncHandler) {
>> +                    //when use asyn handler in bare mode the last parameter is AsyncHandler
>> +                    //which shouldn't count in as parameter length
>> +                    paraLength = paraLength - 1;
>> +                }
>> +                if (part.getIndex() >= paraLength) {
>>                    // The optional out of band header is not a part of parameters of the method
>>                    continue;
>>                }
>> 
>> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com
>