You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Gary Gregory <ga...@gmail.com> on 2019/03/21 21:28:53 UTC

Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

In master, at
org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663), we
throw a IllegalEmptyResponseException where I see:

            if (!boi.getOutput().getMessageParts().isEmpty()) {
                //we were supposed to get some output, but didn't.
                throw new IllegalEmptyResponseException("Response message
did not contain proper response data."
                    + " Expected: " +
boi.getOutput().getMessageParts().get(0).getConcreteName());
            }

The test does not seem right:

!boi.getOutput().getMessageParts().isEmpty()

Should the "!" really be there if we want an error is there is no response?

Gary

Re: Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

Posted by Gary Gregory <ga...@gmail.com>.
One last thing: This test started failing when I updated from one version
of CXF 3.1.x to another a long time ago. I am now migrating to CXF 3.3.x
and must resolve this outstanding issue. I see that this check was added by
https://issues.apache.org/jira/browse/CXF-7653 and I can only deduce that
this started failing with this change.

Thank you!

Gary

On Fri, Mar 22, 2019 at 9:14 AM Gary Gregory <ga...@gmail.com> wrote:

> In the debugger, for "boi.getOutput().getMessageParts()" I get one part:
>
> boi.getOutput().getMessageParts()
> (java.util.ArrayList<E>) [[MessagePartInfo
> name={TestWebServiceNS}parameters,
> ConcreteName={TestWebServiceNS}echoVoidResponse]
>
> boi.getOutput().getMessageParts().get(0)
> (org.apache.cxf.service.model.MessagePartInfo) [MessagePartInfo
> name={TestWebServiceNS}parameters,
> ConcreteName={TestWebServiceNS}echoVoidResponse
>
> Thoughts?
>
> Gary
>
> On Fri, Mar 22, 2019 at 9:11 AM Gary Gregory <ga...@gmail.com>
> wrote:
>
>> Hi Andriy,
>>
>> Thank you for your prompt reply :-)
>>
>> I am not convinced just yet. To confirm we both see this the same way now:
>> - If resList is null, then there is no response defined in the schema?
>> (which matches my app's "echo void" test)
>>
>> My echo void test looks like this; I believe this was generated by some
>> CXF tooling:
>>
>> package testwebservicens;
>>
>> import javax.xml.bind.annotation.XmlAccessType;
>> import javax.xml.bind.annotation.XmlAccessorType;
>> import javax.xml.bind.annotation.XmlType;
>>
>>
>> /**
>>  * <p>Java class for echoVoidResponse complex type.
>>  *
>>  * <p>The following schema fragment specifies the expected content
>> contained within this class.
>>  *
>>  * <pre>
>>  * &lt;complexType name="echoVoidResponse">
>>  *   &lt;complexContent>
>>  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
>>  *       &lt;sequence>
>>  *       &lt;/sequence>
>>  *     &lt;/restriction>
>>  *   &lt;/complexContent>
>>  * &lt;/complexType>
>>  * </pre>
>>  *
>>  *
>>  */
>> @XmlAccessorType(XmlAccessType.FIELD)
>> @XmlType(name = "*echoVoidResponse*")
>> public class EchoVoidResponse {
>>
>>
>> }
>>
>> This is referred by another class generated by CXF like this:
>>
>>     @RequestWrapper(localName = "echoVoid", targetNamespace =
>> "TestWebServiceNS", className = "testwebservicens.EchoVoid")
>>     @WebMethod(action = "lde:echoVoid")
>>     @ResponseWrapper(localName = "*echoVoidResponse*", targetNamespace =
>> "TestWebServiceNS", className = "testwebservicens.EchoVoidResponse")
>>     public void echoVoid();
>>
>>
>> - Then if "!boi.getOutput().getMessageParts().isEmpty()" evaluates to
>> false then there is actual data on the wire? Would there be no "data" for
>> "void"?
>>
>> Thank you,
>> Gary
>>
>> On Thu, Mar 21, 2019 at 8:17 PM Andriy Redko <dr...@gmail.com> wrote:
>>
>>> Hey Gary,
>>>
>>> I think the interpretation is different. The if
>>> (!boi.getOutput().getMessageParts().isEmpty()) states the
>>> expecations that response should not be empty. The resList variable
>>> (which comes from resList = CastUtils.cast(inMsg.getContent(List.class)) a
>>> few statements above) is the response indicator, if it is null (no response)
>>> but boi.getOutput().getMessageParts().isEmpty() is "false", it means
>>> response is expected but was not received.
>>> I think the code is correct. Thank you.
>>>
>>> Best Regards,
>>>     Andriy Redko
>>>
>>>
>>>
>>> GG> In master, at
>>> GG>
>>> org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663), we
>>> GG> throw a IllegalEmptyResponseException where I see:
>>>
>>> GG>             if (!boi.getOutput().getMessageParts().isEmpty()) {
>>> GG>                 //we were supposed to get some output, but didn't.
>>> GG>                 throw new IllegalEmptyResponseException("Response
>>> message
>>> GG> did not contain proper response data."
>>> GG>                     + " Expected: " +
>>> GG> boi.getOutput().getMessageParts().get(0).getConcreteName());
>>> GG>             }
>>>
>>> GG> The test does not seem right:
>>>
>>> GG> !boi.getOutput().getMessageParts().isEmpty()
>>>
>>> GG> Should the "!" really be there if we want an error is there is no
>>> response?
>>>
>>> GG> Gary
>>>
>>>

Re: Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

Posted by Andriy Redko <dr...@gmail.com>.
Hey Gary,

Yeah, looking at your example, the

    @ResponseWrapper(localName = "echoVoidResponse", targetNamespace = "TestWebServiceNS", className = "testwebservicens.EchoVoidResponse")

is directly projected to boi.getOutput().getMessageParts(), it looks like a metadata part (?).
The resList is the actual response, which I believe is "null" since method returns void, and the
exception is raised due to the conditional logic you pointed out ... Why is that is not clear to me, 
guys, any thoughts?

Best Regards,
    Andriy Redko

GG> In the debugger, for "boi.getOutput().getMessageParts()" I get one part:


GG> boi.getOutput().getMessageParts()
GG>          (java.util.ArrayList<E>) [[MessagePartInfo name={TestWebServiceNS}parameters, ConcreteName={TestWebServiceNS}echoVoidResponse]


GG> boi.getOutput().getMessageParts().get(0)
GG>          (org.apache.cxf.service.model.MessagePartInfo) [MessagePartInfo name={TestWebServiceNS}parameters, ConcreteName={TestWebServiceNS}echoVoidResponse


GG> Thoughts?


GG> Gary
GG> On Fri, Mar 22, 2019 at 9:11 AM Gary Gregory <ga...@gmail.com> wrote:

GG> Hi Andriy,


GG> Thank you for your prompt reply :-)


GG> I am not convinced just yet. To confirm we both see this the same way now:
GG> - If resList is null, then there is no response defined in the schema? (which matches my app's "echo void" test)


GG> My echo void test looks like this; I believe this was generated by some CXF tooling:


GG> package testwebservicens;


GG> import javax.xml.bind.annotation.XmlAccessType;
GG> import javax.xml.bind.annotation.XmlAccessorType;
GG> import javax.xml.bind.annotation.XmlType;




GG> /**
GG>  * <p>Java class for echoVoidResponse complex type.
GG>  * 
GG>  * <p>The following schema fragment specifies the expected content contained within this class.
GG>  * 
GG>  * <pre>
GG>  * &lt;complexType name="echoVoidResponse">
GG>  *   &lt;complexContent>
GG>  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
GG>  *       &lt;sequence>
GG>  *       &lt;/sequence>
GG>  *     &lt;/restriction>
GG>  *   &lt;/complexContent>
GG>  * &lt;/complexType>
GG>  * </pre>
GG>  * 
GG>  * 
GG>  */
GG> @XmlAccessorType(XmlAccessType.FIELD)
GG> @XmlType(name = "echoVoidResponse")
GG> public class EchoVoidResponse {




GG> }


GG> This is referred by another class generated by CXF like this:


GG>     @RequestWrapper(localName = "echoVoid", targetNamespace = "TestWebServiceNS", className = "testwebservicens.EchoVoid")
GG>     @WebMethod(action = "lde:echoVoid")
GG>     @ResponseWrapper(localName = "echoVoidResponse", targetNamespace = "TestWebServiceNS", className = "testwebservicens.EchoVoidResponse")
GG>     public void echoVoid();




GG> - Then if "!boi.getOutput().getMessageParts().isEmpty()" evaluates to false then there is actual data on the wire? Would there be no "data" for "void"?


GG> Thank you,
GG> Gary

GG> On Thu, Mar 21, 2019 at 8:17 PM Andriy Redko <dr...@gmail.com> wrote:

GG> Hey Gary,

GG>  I think the interpretation is different. The if (!boi.getOutput().getMessageParts().isEmpty()) states the
GG>  expecations that response should not be empty. The resList variable (which comes from resList =
GG> CastUtils.cast(inMsg.getContent(List.class)) a few statements above) is the response indicator, if it is null (no response)
GG>  but boi.getOutput().getMessageParts().isEmpty() is "false", it means response is expected but was not received.
GG>  I think the code is correct. Thank you.

GG>  Best Regards,
GG>      Andriy Redko



 GG>> In master, at
 GG>> org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663), we
 GG>> throw a IllegalEmptyResponseException where I see:

 GG>>             if (!boi.getOutput().getMessageParts().isEmpty()) {
 GG>>                 //we were supposed to get some output, but didn't.
 GG>>                 throw new IllegalEmptyResponseException("Response message
 GG>> did not contain proper response data."
 GG>>                     + " Expected: " +
 GG>> boi.getOutput().getMessageParts().get(0).getConcreteName());
 GG>>             }

 GG>> The test does not seem right:

 GG>> !boi.getOutput().getMessageParts().isEmpty()

 GG>> Should the "!" really be there if we want an error is there is no response?

 GG>> Gary





Re: Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

Posted by Gary Gregory <ga...@gmail.com>.
In the debugger, for "boi.getOutput().getMessageParts()" I get one part:

boi.getOutput().getMessageParts()
(java.util.ArrayList<E>) [[MessagePartInfo
name={TestWebServiceNS}parameters,
ConcreteName={TestWebServiceNS}echoVoidResponse]

boi.getOutput().getMessageParts().get(0)
(org.apache.cxf.service.model.MessagePartInfo) [MessagePartInfo
name={TestWebServiceNS}parameters,
ConcreteName={TestWebServiceNS}echoVoidResponse

Thoughts?

Gary

On Fri, Mar 22, 2019 at 9:11 AM Gary Gregory <ga...@gmail.com> wrote:

> Hi Andriy,
>
> Thank you for your prompt reply :-)
>
> I am not convinced just yet. To confirm we both see this the same way now:
> - If resList is null, then there is no response defined in the schema?
> (which matches my app's "echo void" test)
>
> My echo void test looks like this; I believe this was generated by some
> CXF tooling:
>
> package testwebservicens;
>
> import javax.xml.bind.annotation.XmlAccessType;
> import javax.xml.bind.annotation.XmlAccessorType;
> import javax.xml.bind.annotation.XmlType;
>
>
> /**
>  * <p>Java class for echoVoidResponse complex type.
>  *
>  * <p>The following schema fragment specifies the expected content
> contained within this class.
>  *
>  * <pre>
>  * &lt;complexType name="echoVoidResponse">
>  *   &lt;complexContent>
>  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
>  *       &lt;sequence>
>  *       &lt;/sequence>
>  *     &lt;/restriction>
>  *   &lt;/complexContent>
>  * &lt;/complexType>
>  * </pre>
>  *
>  *
>  */
> @XmlAccessorType(XmlAccessType.FIELD)
> @XmlType(name = "*echoVoidResponse*")
> public class EchoVoidResponse {
>
>
> }
>
> This is referred by another class generated by CXF like this:
>
>     @RequestWrapper(localName = "echoVoid", targetNamespace =
> "TestWebServiceNS", className = "testwebservicens.EchoVoid")
>     @WebMethod(action = "lde:echoVoid")
>     @ResponseWrapper(localName = "*echoVoidResponse*", targetNamespace =
> "TestWebServiceNS", className = "testwebservicens.EchoVoidResponse")
>     public void echoVoid();
>
>
> - Then if "!boi.getOutput().getMessageParts().isEmpty()" evaluates to
> false then there is actual data on the wire? Would there be no "data" for
> "void"?
>
> Thank you,
> Gary
>
> On Thu, Mar 21, 2019 at 8:17 PM Andriy Redko <dr...@gmail.com> wrote:
>
>> Hey Gary,
>>
>> I think the interpretation is different. The if
>> (!boi.getOutput().getMessageParts().isEmpty()) states the
>> expecations that response should not be empty. The resList variable
>> (which comes from resList = CastUtils.cast(inMsg.getContent(List.class)) a
>> few statements above) is the response indicator, if it is null (no response)
>> but boi.getOutput().getMessageParts().isEmpty() is "false", it means
>> response is expected but was not received.
>> I think the code is correct. Thank you.
>>
>> Best Regards,
>>     Andriy Redko
>>
>>
>>
>> GG> In master, at
>> GG>
>> org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663), we
>> GG> throw a IllegalEmptyResponseException where I see:
>>
>> GG>             if (!boi.getOutput().getMessageParts().isEmpty()) {
>> GG>                 //we were supposed to get some output, but didn't.
>> GG>                 throw new IllegalEmptyResponseException("Response
>> message
>> GG> did not contain proper response data."
>> GG>                     + " Expected: " +
>> GG> boi.getOutput().getMessageParts().get(0).getConcreteName());
>> GG>             }
>>
>> GG> The test does not seem right:
>>
>> GG> !boi.getOutput().getMessageParts().isEmpty()
>>
>> GG> Should the "!" really be there if we want an error is there is no
>> response?
>>
>> GG> Gary
>>
>>

Re: Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

Posted by Gary Gregory <ga...@gmail.com>.
Hi Andriy,

Thank you for your prompt reply :-)

I am not convinced just yet. To confirm we both see this the same way now:
- If resList is null, then there is no response defined in the schema?
(which matches my app's "echo void" test)

My echo void test looks like this; I believe this was generated by some CXF
tooling:

package testwebservicens;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for echoVoidResponse complex type.
 *
 * <p>The following schema fragment specifies the expected content
contained within this class.
 *
 * <pre>
 * &lt;complexType name="echoVoidResponse">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "*echoVoidResponse*")
public class EchoVoidResponse {


}

This is referred by another class generated by CXF like this:

    @RequestWrapper(localName = "echoVoid", targetNamespace =
"TestWebServiceNS", className = "testwebservicens.EchoVoid")
    @WebMethod(action = "lde:echoVoid")
    @ResponseWrapper(localName = "*echoVoidResponse*", targetNamespace =
"TestWebServiceNS", className = "testwebservicens.EchoVoidResponse")
    public void echoVoid();


- Then if "!boi.getOutput().getMessageParts().isEmpty()" evaluates to false
then there is actual data on the wire? Would there be no "data" for "void"?

Thank you,
Gary

On Thu, Mar 21, 2019 at 8:17 PM Andriy Redko <dr...@gmail.com> wrote:

> Hey Gary,
>
> I think the interpretation is different. The if
> (!boi.getOutput().getMessageParts().isEmpty()) states the
> expecations that response should not be empty. The resList variable (which
> comes from resList = CastUtils.cast(inMsg.getContent(List.class)) a few
> statements above) is the response indicator, if it is null (no response)
> but boi.getOutput().getMessageParts().isEmpty() is "false", it means
> response is expected but was not received.
> I think the code is correct. Thank you.
>
> Best Regards,
>     Andriy Redko
>
>
>
> GG> In master, at
> GG> org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663),
> we
> GG> throw a IllegalEmptyResponseException where I see:
>
> GG>             if (!boi.getOutput().getMessageParts().isEmpty()) {
> GG>                 //we were supposed to get some output, but didn't.
> GG>                 throw new IllegalEmptyResponseException("Response
> message
> GG> did not contain proper response data."
> GG>                     + " Expected: " +
> GG> boi.getOutput().getMessageParts().get(0).getConcreteName());
> GG>             }
>
> GG> The test does not seem right:
>
> GG> !boi.getOutput().getMessageParts().isEmpty()
>
> GG> Should the "!" really be there if we want an error is there is no
> response?
>
> GG> Gary
>
>

Re: Possible problem in org.apache.cxf.endpoint.ClientImpl.processResult()?

Posted by Andriy Redko <dr...@gmail.com>.
Hey Gary,

I think the interpretation is different. The if (!boi.getOutput().getMessageParts().isEmpty()) states the
expecations that response should not be empty. The resList variable (which comes from resList = CastUtils.cast(inMsg.getContent(List.class)) a few statements above) is the response indicator, if it is null (no response)
but boi.getOutput().getMessageParts().isEmpty() is "false", it means response is expected but was not received.
I think the code is correct. Thank you.

Best Regards,
    Andriy Redko



GG> In master, at
GG> org.apache.cxf.endpoint.ClientImpl.processResult(ClientImpl.java:663), we
GG> throw a IllegalEmptyResponseException where I see:

GG>             if (!boi.getOutput().getMessageParts().isEmpty()) {
GG>                 //we were supposed to get some output, but didn't.
GG>                 throw new IllegalEmptyResponseException("Response message
GG> did not contain proper response data."
GG>                     + " Expected: " +
GG> boi.getOutput().getMessageParts().get(0).getConcreteName());
GG>             }

GG> The test does not seem right:

GG> !boi.getOutput().getMessageParts().isEmpty()

GG> Should the "!" really be there if we want an error is there is no response?

GG> Gary