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

Re: CXF absolutely ignores method arguments

My gut feeling is that you need to flip:

-        ServerFactoryBean factory = new ServerFactoryBean();
+        JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();

The default ServerFactoryBean would know about all the JAXWS annotations (WebParam, WebService, etc….) and thus is dropping to various defaults which might not match what you are sending since you ARE using JAXWS on the client side.


Dan



> On May 1, 2020, at 1:01 PM, Alex Sviridov <oo...@mail.ru.INVALID> wrote:
> 
> 
> By the way, I did a test project, so, if anyone could make it work
> I would be very thankful. To run it execute the following commands:
> git clone https://github.com/PashaTurok/cxftest.git
> cd cxftest
> mvn clean install
>   
>> Пятница, 1 мая 2020, 13:55 +03:00 от Mark Presling <ma...@argonaut.nz>:
>>  
>> What if you make the name attribute match the param name? Ie, instead of:
>> 
>> @WebParam(name="value1")
>> 
>> try:
>> 
>> @WebParam(name="v1")
>> 
>> FYI, I’m not part of the project, just looking at what I’ve done in the
>> past.
>> 
>> Thanks,
>> Mark
>> 
>> On Fri, 1 May 2020 at 19:36, Alex Sviridov < ooo_saturn7@mail.ru.invalid >
>> wrote:
>>  
>>> 
>>> Hi Mark,
>>> 
>>> Thank you very much for your answer. I tried to add @WebParam:
>>> 
>>> @WebService(name="CalculatorService",
>>> serviceName="CalculatorService",
>>> wsdlLocation="http://localhost:8080/webservices/calcService?wsdl")
>>> public class CalculatorService {
>>> 
>>> @WebMethod
>>> public double addNumbers(@WebParam(name="value1") double v1,
>>> @WebParam(name="value2") double v2) {
>>> return v1 + v2;
>>> }
>>> }
>>> 
>>> Here is port dumping:
>>> 
>>> T 127.0.0.1:53516 -> 127.0.0.1:8080 [AP]
>>> <soap:Envelope xmlns:soap=" http://schemas.xmlsoap.org/soap/envelope/ "><soap:Body><ns2:addNumbers
>>> xmlns:ns2=" http://cfx.foo.com/ "><value1>1.2</value1><value2>1.2</value2></ns2:addNumbers></soap:Body></soap:Envelope>
>>> 
>>> ##
>>> T 127.0.0.1:8080 -> 127.0.0.1:53516 [AP]
>>> HTTP/1.1 500 Server Error..Date: Fri, 01 May 2020 07:28:46
>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>> Jetty(
>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>> http://schemas.xmlsoap.org/soap/envelope/
>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>> aultcode><faultstring>null while invoking public double
>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>> null, null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>> 
>>> Anyway I opened an issue here
>>> https://issues.apache.org/jira/browse/CXF-8274
>>> 
>>> Best regards.
>>> 
>>>> Пятница, 1 мая 2020, 1:37 +03:00 от Mark Presling <
>>> mark.presling@argonaut.nz >:
>>>> 
>>>> Try adding @WebParam to the v1 and v2 parameters.
>>>> 
>>>> 
>>> https://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-AnnotatingtheSEI
>>>> 
>>>> On Fri, 1 May 2020 at 03:45, Alex Sviridov <  ooo_saturn7@mail.ru.invalid
>>>> 
>>>> wrote:
>>>> 
>>>>> 
>>>>> Hi all,
>>>>> 
>>>>> Please help me to run the simplest example with CXF. After spending ten
>>>>> hours
>>>>> I still can pass any arguments to my methods.
>>>>> 
>>>>> This is my service:
>>>>> 
>>>>> @WebService(name="CalculatorService", serviceName="CalculatorService")
>>>>> public class CalculatorService {
>>>>> 
>>>>> @WebMethod
>>>>> public double addNumbers(double v1, double v2) {
>>>>> return v1 + v2;
>>>>> }
>>>>> }
>>>>> Upon it I generate using cxf plugin the following wsdl
>>>>> 
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <wsdl:definitions name="CalculatorService" targetNamespace="
>>>>> http://cfx.foo.com/ " xmlns:wsdl="  http://schemas.xmlsoap.org/wsdl/ "
>>>>> xmlns:xsd="  http://www.w3.org/2001/XMLSchema " xmlns:tns="
>>>>> http://cfx.foo.com/ " xmlns:soap="
>>> http://schemas.xmlsoap.org/wsdl/soap/ ">
>>>>> <wsdl:types>
>>>>> <xs:schema xmlns:tns="  http://cfx.foo.com/ " xmlns:xs="
>>>>> http://www.w3.org/2001/XMLSchema " elementFormDefault="unqualified"
>>>>> targetNamespace="  http://cfx.foo.com/ " version="1.0">
>>>>> 
>>>>> <xs:element name="addNumbers" type="tns:addNumbers"/>
>>>>> 
>>>>> <xs:element name="addNumbersResponse" type="tns:addNumbersResponse"/>
>>>>> 
>>>>> <xs:complexType name="addNumbers">
>>>>> <xs:sequence>
>>>>> <xs:element name="arg0" type="xs:double"/>
>>>>> <xs:element name="arg1" type="xs:double"/>
>>>>> </xs:sequence>
>>>>> </xs:complexType>
>>>>> 
>>>>> <xs:complexType name="addNumbersResponse">
>>>>> <xs:sequence>
>>>>> <xs:element name="return" type="xs:double"/>
>>>>> </xs:sequence>
>>>>> </xs:complexType>
>>>>> 
>>>>> </xs:schema>
>>>>> </wsdl:types>
>>>>> <wsdl:message name="addNumbers">
>>>>> <wsdl:part name="parameters" element="tns:addNumbers">
>>>>> </wsdl:part>
>>>>> </wsdl:message>
>>>>> <wsdl:message name="addNumbersResponse">
>>>>> <wsdl:part name="parameters" element="tns:addNumbersResponse">
>>>>> </wsdl:part>
>>>>> </wsdl:message>
>>>>> <wsdl:portType name="CalculatorService">
>>>>> <wsdl:operation name="addNumbers">
>>>>> <wsdl:input name="addNumbers" message="tns:addNumbers">
>>>>> </wsdl:input>
>>>>> <wsdl:output name="addNumbersResponse"
>>>>> message="tns:addNumbersResponse">
>>>>> </wsdl:output>
>>>>> </wsdl:operation>
>>>>> </wsdl:portType>
>>>>> <wsdl:binding name="CalculatorServiceSoapBinding"
>>>>> type="tns:CalculatorService">
>>>>> <soap:binding style="document" transport="
>>>>> http://schemas.xmlsoap.org/soap/http "/>
>>>>> <wsdl:operation name="addNumbers">
>>>>> <soap:operation soapAction="" style="document"/>
>>>>> <wsdl:input name="addNumbers">
>>>>> <soap:body use="literal"/>
>>>>> </wsdl:input>
>>>>> <wsdl:output name="addNumbersResponse">
>>>>> <soap:body use="literal"/>
>>>>> </wsdl:output>
>>>>> </wsdl:operation>
>>>>> </wsdl:binding>
>>>>> <wsdl:service name="CalculatorService">
>>>>> <wsdl:port name="CalculatorServicePort"
>>>>> binding="tns:CalculatorServiceSoapBinding">
>>>>> <soap:address location="http://localhost:9090/CalculatorServicePort
>>>>> "/>
>>>>> </wsdl:port>
>>>>> </wsdl:service>
>>>>> </wsdl:definitions>
>>>>> 
>>>>> Upon wsdl I generate java code. When I call my generated services I see
>>>>> the following
>>>>> 
>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>> POST /webservices/calcService HTTP/1.1..Content-Type: text/xml;
>>>>> charset=UTF-8..Accept: */*..SOAPAction: ""..User-Agent: Apache-CXF/
>>> 3.3.6.
>>>>> .Cache-Control: no-cache..Pragma: no-cache..Host: 127.0.0.1:8080
>>> ..Connection:
>>>>> keep-alive..Content-Length: 218....
>>>>> ##
>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/
>>> "><soap:Body><ns2:addNumbers
>>>>> xmlns:ns2="  http://cfx.foo.com/
>>> "><arg0>1.2</arg0><arg1>1.2</arg1></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>> 
>>>>> ##
>>>>> T 127.0.0.1:8080 -> 127.0.0.1:33602 [AP]
>>>>> HTTP/1.1 500 Server Error..Date: Thu, 30 Apr 2020 15:38:13
>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>> Jetty(
>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>> http://schemas.xmlsoap.org/soap/envelope/
>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>> aultcode><faultstring>null while invoking public double
>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>> null,
>>>>> null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>> 
>>>>> #######
>>>>> 
>>>>> And the following stacktrace:
>>>>> 
>>>>> org.apache.cxf.interceptor.Fault: null while invoking public double
>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params
>>> [null,
>>>>> null].
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>>>>> at
>>>>> 
>>> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>>>>> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>>>>> at  org.apache.cxf.core@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>> 
>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
>>>>> 
>>>>> I can’t understand why my arguments are ignored. Is there some
>>> dependency
>>>>> problems? Then why there is no any exceptions? Please, help me to solve
>>>>> this problem.
>>>>> 
>>>>> The question is also asked on SO here
>>>>> 
>>> https://stackoverflow.com/questions/61512699/cxf-ignores-method-arguments
>>>>> 
>>>>> --
>>>>> Alex Sviridov
>>>> 
>>>> 
>>>> --
>>>> 
>>>> Mark Presling
>>>> 
>>>> *Senior Developer / Technical Lead*
>>>> 
>>>> Argonaut Ltd
>>>> 
>>>> DDI: (04) 9016504
>>>> Mobile: 021549540
>>>> Do you use Outlook? Stop sending me winmail.dat
>>>> <
>>> https://www.lifewire.com/prevent-sending-winmail-dat-attachments-1173717 >
>>>> files!
>>>> 
>>> 
>>> 
>>> --
>>> Alex Sviridov
>>> 
>> --
>> Mark Presling
>> 
>> Senior Developer / Technical Lead
>> 
>> Argonaut Ltd
>> 
>> DDI: (04) 9016504
>> Mobile: 021549540
>>   
>  
>  
> --
> Alex Sviridov
>  

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

Re[2]: CXF absolutely ignores method arguments

Posted by Alex Sviridov <oo...@mail.ru.INVALID>.
Yes, I removed this parameter and now it works. Thank you very much for your help!
 
Best regards, Alex
  
>Понедельник, 4 мая 2020, 18:44 +03:00 от Daniel Kulp <dk...@apache.org>:
> 
>
>You have the wsdlLocation set on the @WebService annotation. Thus, at startup, it’s trying to hit that URL for the WSDL. Since the web server isn’t fully up, it’s waiting.
>
>Since you are generating the wsdl, you likely need to remove that parameter from the annotation.
>
>Dan
>
>
> 
>> On May 4, 2020, at 10:31 AM, Alex Sviridov < ooo_saturn7@mail.ru.INVALID > wrote:
>>
>>
>> Hi Dan,
>>
>> Thank you very much for your answer. I changed ServerFactoryBean to
>> to JaxWsServerFactoryBean but after that my service is not created.
>> Last message I see is :
>> [qtp20853837-21] INFO org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean - Creating Service { http://webapp.mycompany.com/}CalculatorService from WSDL: http://localhost:8080/webservices/calcService?wsdl
>>
>> And when I try to open http://localhost:8080/webservices/calcService it doesnt answer.
>>
>> Using debugger I found out that program hangs in org.apache.cxf.transport.http.URLConnectionHTTPConduit
>> at line 373 :
>> return AccessController.doPrivileged(new PrivilegedExceptionAction<Integer>() {
>> @Override
>> public Integer run() throws IOException {
>> return connection.getResponseCode();
>> } });
>>
>> Best regards Alex
>>
>>> Понедельник, 4 мая 2020, 15:34 +03:00 от Daniel Kulp < dkulp@apache.org >:
>>>
>>> My gut feeling is that you need to flip:
>>>
>>> - ServerFactoryBean factory = new ServerFactoryBean();
>>> + JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
>>>
>>> The default ServerFactoryBean would know about all the JAXWS annotations (WebParam, WebService, etc….) and thus is dropping to various defaults which might not match what you are sending since you ARE using JAXWS on the client side.
>>>
>>>
>>> Dan
>>>
>>>
>>>
>>>> On May 1, 2020, at 1:01 PM, Alex Sviridov <  ooo_saturn7@mail.ru.INVALID > wrote:
>>>>
>>>>
>>>> By the way, I did a test project, so, if anyone could make it work
>>>> I would be very thankful. To run it execute the following commands:
>>>> git clone  https://github.com/PashaTurok/cxftest.git
>>>> cd cxftest
>>>> mvn clean install
>>>>
>>>>> Пятница, 1 мая 2020, 13:55 +03:00 от Mark Presling <  mark.presling@argonaut.nz >:
>>>>>
>>>>> What if you make the name attribute match the param name? Ie, instead of:
>>>>>
>>>>> @WebParam(name="value1")
>>>>>
>>>>> try:
>>>>>
>>>>> @WebParam(name="v1")
>>>>>
>>>>> FYI, I’m not part of the project, just looking at what I’ve done in the
>>>>> past.
>>>>>
>>>>> Thanks,
>>>>> Mark
>>>>>
>>>>> On Fri, 1 May 2020 at 19:36, Alex Sviridov <  ooo_saturn7@mail.ru.invalid >
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Hi Mark,
>>>>>>
>>>>>> Thank you very much for your answer. I tried to add @WebParam:
>>>>>>
>>>>>> @WebService(name="CalculatorService",
>>>>>> serviceName="CalculatorService",
>>>>>> wsdlLocation="http://localhost:8080/webservices/calcService?wsdl")
>>>>>> public class CalculatorService {
>>>>>>
>>>>>> @WebMethod
>>>>>> public double addNumbers(@WebParam(name="value1") double v1,
>>>>>> @WebParam(name="value2") double v2) {
>>>>>> return v1 + v2;
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> Here is port dumping:
>>>>>>
>>>>>> T 127.0.0.1:53516 -> 127.0.0.1:8080 [AP]
>>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/ "><soap:Body><ns2:addNumbers
>>>>>> xmlns:ns2="  http://cfx.foo.com/ "><value1>1.2</value1><value2>1.2</value2></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>>>
>>>>>> ##
>>>>>> T 127.0.0.1:8080 -> 127.0.0.1:53516 [AP]
>>>>>> HTTP/1.1 500 Server Error..Date: Fri, 01 May 2020 07:28:46
>>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>>> Jetty(
>>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>>>  http://schemas.xmlsoap.org/soap/envelope/
>>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>>> aultcode><faultstring>null while invoking public double
>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>>> null, null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>>>
>>>>>> Anyway I opened an issue here
>>>>>>  https://issues.apache.org/jira/browse/CXF-8274
>>>>>>
>>>>>> Best regards.
>>>>>>
>>>>>>> Пятница, 1 мая 2020, 1:37 +03:00 от Mark Presling <
>>>>>>  mark.presling@argonaut.nz >:
>>>>>>>
>>>>>>> Try adding @WebParam to the v1 and v2 parameters.
>>>>>>>
>>>>>>>
>>>>>>  https://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-AnnotatingtheSEI
>>>>>>>
>>>>>>> On Fri, 1 May 2020 at 03:45, Alex Sviridov <  ooo_saturn7@mail.ru.invalid
>>>>>>>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> Please help me to run the simplest example with CXF. After spending ten
>>>>>>>> hours
>>>>>>>> I still can pass any arguments to my methods.
>>>>>>>>
>>>>>>>> This is my service:
>>>>>>>>
>>>>>>>> @WebService(name="CalculatorService", serviceName="CalculatorService")
>>>>>>>> public class CalculatorService {
>>>>>>>>
>>>>>>>> @WebMethod
>>>>>>>> public double addNumbers(double v1, double v2) {
>>>>>>>> return v1 + v2;
>>>>>>>> }
>>>>>>>> }
>>>>>>>> Upon it I generate using cxf plugin the following wsdl
>>>>>>>>
>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> <wsdl:definitions name="CalculatorService" targetNamespace="
>>>>>>>>  http://cfx.foo.com/ " xmlns:wsdl="  http://schemas.xmlsoap.org/wsdl/ "
>>>>>>>> xmlns:xsd="  http://www.w3.org/2001/XMLSchema " xmlns:tns="
>>>>>>>>  http://cfx.foo.com/ " xmlns:soap="
>>>>>>  http://schemas.xmlsoap.org/wsdl/soap/ ">
>>>>>>>> <wsdl:types>
>>>>>>>> <xs:schema xmlns:tns="  http://cfx.foo.com/ " xmlns:xs="
>>>>>>>>  http://www.w3.org/2001/XMLSchema " elementFormDefault="unqualified"
>>>>>>>> targetNamespace="  http://cfx.foo.com/ " version="1.0">
>>>>>>>>
>>>>>>>> <xs:element name="addNumbers" type="tns:addNumbers"/>
>>>>>>>>
>>>>>>>> <xs:element name="addNumbersResponse" type="tns:addNumbersResponse"/>
>>>>>>>>
>>>>>>>> <xs:complexType name="addNumbers">
>>>>>>>> <xs:sequence>
>>>>>>>> <xs:element name="arg0" type="xs:double"/>
>>>>>>>> <xs:element name="arg1" type="xs:double"/>
>>>>>>>> </xs:sequence>
>>>>>>>> </xs:complexType>
>>>>>>>>
>>>>>>>> <xs:complexType name="addNumbersResponse">
>>>>>>>> <xs:sequence>
>>>>>>>> <xs:element name="return" type="xs:double"/>
>>>>>>>> </xs:sequence>
>>>>>>>> </xs:complexType>
>>>>>>>>
>>>>>>>> </xs:schema>
>>>>>>>> </wsdl:types>
>>>>>>>> <wsdl:message name="addNumbers">
>>>>>>>> <wsdl:part name="parameters" element="tns:addNumbers">
>>>>>>>> </wsdl:part>
>>>>>>>> </wsdl:message>
>>>>>>>> <wsdl:message name="addNumbersResponse">
>>>>>>>> <wsdl:part name="parameters" element="tns:addNumbersResponse">
>>>>>>>> </wsdl:part>
>>>>>>>> </wsdl:message>
>>>>>>>> <wsdl:portType name="CalculatorService">
>>>>>>>> <wsdl:operation name="addNumbers">
>>>>>>>> <wsdl:input name="addNumbers" message="tns:addNumbers">
>>>>>>>> </wsdl:input>
>>>>>>>> <wsdl:output name="addNumbersResponse"
>>>>>>>> message="tns:addNumbersResponse">
>>>>>>>> </wsdl:output>
>>>>>>>> </wsdl:operation>
>>>>>>>> </wsdl:portType>
>>>>>>>> <wsdl:binding name="CalculatorServiceSoapBinding"
>>>>>>>> type="tns:CalculatorService">
>>>>>>>> <soap:binding style="document" transport="
>>>>>>>>  http://schemas.xmlsoap.org/soap/http "/>
>>>>>>>> <wsdl:operation name="addNumbers">
>>>>>>>> <soap:operation soapAction="" style="document"/>
>>>>>>>> <wsdl:input name="addNumbers">
>>>>>>>> <soap:body use="literal"/>
>>>>>>>> </wsdl:input>
>>>>>>>> <wsdl:output name="addNumbersResponse">
>>>>>>>> <soap:body use="literal"/>
>>>>>>>> </wsdl:output>
>>>>>>>> </wsdl:operation>
>>>>>>>> </wsdl:binding>
>>>>>>>> <wsdl:service name="CalculatorService">
>>>>>>>> <wsdl:port name="CalculatorServicePort"
>>>>>>>> binding="tns:CalculatorServiceSoapBinding">
>>>>>>>> <soap:address location="http://localhost:9090/CalculatorServicePort
>>>>>>>> "/>
>>>>>>>> </wsdl:port>
>>>>>>>> </wsdl:service>
>>>>>>>> </wsdl:definitions>
>>>>>>>>
>>>>>>>> Upon wsdl I generate java code. When I call my generated services I see
>>>>>>>> the following
>>>>>>>>
>>>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>>>> POST /webservices/calcService HTTP/1.1..Content-Type: text/xml;
>>>>>>>> charset=UTF-8..Accept: */*..SOAPAction: ""..User-Agent: Apache-CXF/
>>>>>> 3.3.6.
>>>>>>>> .Cache-Control: no-cache..Pragma: no-cache..Host: 127.0.0.1:8080
>>>>>> ..Connection:
>>>>>>>> keep-alive..Content-Length: 218....
>>>>>>>> ##
>>>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/
>>>>>> "><soap:Body><ns2:addNumbers
>>>>>>>> xmlns:ns2="  http://cfx.foo.com/
>>>>>> "><arg0>1.2</arg0><arg1>1.2</arg1></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>>>>>
>>>>>>>> ##
>>>>>>>> T 127.0.0.1:8080 -> 127.0.0.1:33602 [AP]
>>>>>>>> HTTP/1.1 500 Server Error..Date: Thu, 30 Apr 2020 15:38:13
>>>>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>>>>> Jetty(
>>>>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>>>>>  http://schemas.xmlsoap.org/soap/envelope/
>>>>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>>>>> aultcode><faultstring>null while invoking public double
>>>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>>>>> null,
>>>>>>>> null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>>>>>
>>>>>>>> #######
>>>>>>>>
>>>>>>>> And the following stacktrace:
>>>>>>>>
>>>>>>>> org.apache.cxf.interceptor.Fault: null while invoking public double
>>>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params
>>>>>> [null,
>>>>>>>> null].
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>>>>>>>> at
>>>>>>>>
>>>>>> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>>>>>>>> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>>>
>>>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
>>>>>>>>
>>>>>>>> I can’t understand why my arguments are ignored. Is there some
>>>>>> dependency
>>>>>>>> problems? Then why there is no any exceptions? Please, help me to solve
>>>>>>>> this problem.
>>>>>>>>
>>>>>>>> The question is also asked on SO here
>>>>>>>>
>>>>>>  https://stackoverflow.com/questions/61512699/cxf-ignores-method-arguments
>>>>>>>>
>>>>>>>> --
>>>>>>>> Alex Sviridov
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Mark Presling
>>>>>>>
>>>>>>> *Senior Developer / Technical Lead*
>>>>>>>
>>>>>>> Argonaut Ltd
>>>>>>>
>>>>>>> DDI: (04) 9016504
>>>>>>> Mobile: 021549540
>>>>>>> Do you use Outlook? Stop sending me winmail.dat
>>>>>>> <
>>>>>>  https://www.lifewire.com/prevent-sending-winmail-dat-attachments-1173717 >
>>>>>>> files!
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Alex Sviridov
>>>>>>
>>>>> --
>>>>> Mark Presling
>>>>>
>>>>> Senior Developer / Technical Lead
>>>>>
>>>>> Argonaut Ltd
>>>>>
>>>>> DDI: (04) 9016504
>>>>> Mobile: 021549540
>>>>>
>>>>
>>>>
>>>> --
>>>> Alex Sviridov
>>>>
>>> --
>>> Daniel Kulp
>>>  dkulp@apache.org <ma...@apache.org> -  http://dankulp.com/blog <  http://dankulp.com/blog >
>>> Talend Community Coder -  http://talend.com <  http://coders.talend.com/ >
>>>
>>
>>
>> --
>> Alex Sviridov
>>
>--
>Daniel Kulp
>dkulp@apache.org <ma...@apache.org> -  http://dankulp.com/blog < http://dankulp.com/blog >
>Talend Community Coder -  http://talend.com < http://coders.talend.com/ >
>  
 
 
--
Alex Sviridov
 

Re: CXF absolutely ignores method arguments

Posted by Daniel Kulp <dk...@apache.org>.
You have the wsdlLocation set on the @WebService annotation.     Thus, at startup, it’s trying to hit that URL for the WSDL.   Since the web server isn’t fully up, it’s waiting.

Since you are generating the wsdl, you likely need to remove that parameter from the annotation.

Dan



> On May 4, 2020, at 10:31 AM, Alex Sviridov <oo...@mail.ru.INVALID> wrote:
> 
> 
> Hi Dan,
>  
> Thank you very much for your answer. I changed ServerFactoryBean to
> to JaxWsServerFactoryBean but after that my service is not created.
> Last message I see is :
> [qtp20853837-21] INFO org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean - Creating Service {http://webapp.mycompany.com/}CalculatorService from WSDL: http://localhost:8080/webservices/calcService?wsdl
>  
> And when I try to open  http://localhost:8080/webservices/calcService it doesnt answer.
>  
> Using debugger I found out that program hangs in org.apache.cxf.transport.http.URLConnectionHTTPConduit
> at line 373 :
>                 return AccessController.doPrivileged(new PrivilegedExceptionAction<Integer>() {
>                     @Override
>                     public Integer run() throws IOException {
>                         return connection.getResponseCode();
>                     } });
>  
> Best regards Alex
>   
>> Понедельник, 4 мая 2020, 15:34 +03:00 от Daniel Kulp <dk...@apache.org>:
>>  
>> My gut feeling is that you need to flip:
>> 
>> - ServerFactoryBean factory = new ServerFactoryBean();
>> + JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
>> 
>> The default ServerFactoryBean would know about all the JAXWS annotations (WebParam, WebService, etc….) and thus is dropping to various defaults which might not match what you are sending since you ARE using JAXWS on the client side.
>> 
>> 
>> Dan
>> 
>> 
>>  
>>> On May 1, 2020, at 1:01 PM, Alex Sviridov < ooo_saturn7@mail.ru.INVALID > wrote:
>>> 
>>> 
>>> By the way, I did a test project, so, if anyone could make it work
>>> I would be very thankful. To run it execute the following commands:
>>> git clone  https://github.com/PashaTurok/cxftest.git
>>> cd cxftest
>>> mvn clean install
>>> 
>>>> Пятница, 1 мая 2020, 13:55 +03:00 от Mark Presling < mark.presling@argonaut.nz >:
>>>> 
>>>> What if you make the name attribute match the param name? Ie, instead of:
>>>> 
>>>> @WebParam(name="value1")
>>>> 
>>>> try:
>>>> 
>>>> @WebParam(name="v1")
>>>> 
>>>> FYI, I’m not part of the project, just looking at what I’ve done in the
>>>> past.
>>>> 
>>>> Thanks,
>>>> Mark
>>>> 
>>>> On Fri, 1 May 2020 at 19:36, Alex Sviridov <  ooo_saturn7@mail.ru.invalid >
>>>> wrote:
>>>> 
>>>>> 
>>>>> Hi Mark,
>>>>> 
>>>>> Thank you very much for your answer. I tried to add @WebParam:
>>>>> 
>>>>> @WebService(name="CalculatorService",
>>>>> serviceName="CalculatorService",
>>>>> wsdlLocation="http://localhost:8080/webservices/calcService?wsdl")
>>>>> public class CalculatorService {
>>>>> 
>>>>> @WebMethod
>>>>> public double addNumbers(@WebParam(name="value1") double v1,
>>>>> @WebParam(name="value2") double v2) {
>>>>> return v1 + v2;
>>>>> }
>>>>> }
>>>>> 
>>>>> Here is port dumping:
>>>>> 
>>>>> T 127.0.0.1:53516 -> 127.0.0.1:8080 [AP]
>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/ "><soap:Body><ns2:addNumbers
>>>>> xmlns:ns2="  http://cfx.foo.com/ "><value1>1.2</value1><value2>1.2</value2></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>> 
>>>>> ##
>>>>> T 127.0.0.1:8080 -> 127.0.0.1:53516 [AP]
>>>>> HTTP/1.1 500 Server Error..Date: Fri, 01 May 2020 07:28:46
>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>> Jetty(
>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>> http://schemas.xmlsoap.org/soap/envelope/
>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>> aultcode><faultstring>null while invoking public double
>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>> null, null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>> 
>>>>> Anyway I opened an issue here
>>>>> https://issues.apache.org/jira/browse/CXF-8274
>>>>> 
>>>>> Best regards.
>>>>> 
>>>>>> Пятница, 1 мая 2020, 1:37 +03:00 от Mark Presling <
>>>>> mark.presling@argonaut.nz >:
>>>>>> 
>>>>>> Try adding @WebParam to the v1 and v2 parameters.
>>>>>> 
>>>>>> 
>>>>> https://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-AnnotatingtheSEI
>>>>>> 
>>>>>> On Fri, 1 May 2020 at 03:45, Alex Sviridov <  ooo_saturn7@mail.ru.invalid
>>>>>> 
>>>>>> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> Hi all,
>>>>>>> 
>>>>>>> Please help me to run the simplest example with CXF. After spending ten
>>>>>>> hours
>>>>>>> I still can pass any arguments to my methods.
>>>>>>> 
>>>>>>> This is my service:
>>>>>>> 
>>>>>>> @WebService(name="CalculatorService", serviceName="CalculatorService")
>>>>>>> public class CalculatorService {
>>>>>>> 
>>>>>>> @WebMethod
>>>>>>> public double addNumbers(double v1, double v2) {
>>>>>>> return v1 + v2;
>>>>>>> }
>>>>>>> }
>>>>>>> Upon it I generate using cxf plugin the following wsdl
>>>>>>> 
>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>> <wsdl:definitions name="CalculatorService" targetNamespace="
>>>>>>> http://cfx.foo.com/ " xmlns:wsdl="  http://schemas.xmlsoap.org/wsdl/ "
>>>>>>> xmlns:xsd="  http://www.w3.org/2001/XMLSchema " xmlns:tns="
>>>>>>> http://cfx.foo.com/ " xmlns:soap="
>>>>> http://schemas.xmlsoap.org/wsdl/soap/ ">
>>>>>>> <wsdl:types>
>>>>>>> <xs:schema xmlns:tns="  http://cfx.foo.com/ " xmlns:xs="
>>>>>>> http://www.w3.org/2001/XMLSchema " elementFormDefault="unqualified"
>>>>>>> targetNamespace="  http://cfx.foo.com/ " version="1.0">
>>>>>>> 
>>>>>>> <xs:element name="addNumbers" type="tns:addNumbers"/>
>>>>>>> 
>>>>>>> <xs:element name="addNumbersResponse" type="tns:addNumbersResponse"/>
>>>>>>> 
>>>>>>> <xs:complexType name="addNumbers">
>>>>>>> <xs:sequence>
>>>>>>> <xs:element name="arg0" type="xs:double"/>
>>>>>>> <xs:element name="arg1" type="xs:double"/>
>>>>>>> </xs:sequence>
>>>>>>> </xs:complexType>
>>>>>>> 
>>>>>>> <xs:complexType name="addNumbersResponse">
>>>>>>> <xs:sequence>
>>>>>>> <xs:element name="return" type="xs:double"/>
>>>>>>> </xs:sequence>
>>>>>>> </xs:complexType>
>>>>>>> 
>>>>>>> </xs:schema>
>>>>>>> </wsdl:types>
>>>>>>> <wsdl:message name="addNumbers">
>>>>>>> <wsdl:part name="parameters" element="tns:addNumbers">
>>>>>>> </wsdl:part>
>>>>>>> </wsdl:message>
>>>>>>> <wsdl:message name="addNumbersResponse">
>>>>>>> <wsdl:part name="parameters" element="tns:addNumbersResponse">
>>>>>>> </wsdl:part>
>>>>>>> </wsdl:message>
>>>>>>> <wsdl:portType name="CalculatorService">
>>>>>>> <wsdl:operation name="addNumbers">
>>>>>>> <wsdl:input name="addNumbers" message="tns:addNumbers">
>>>>>>> </wsdl:input>
>>>>>>> <wsdl:output name="addNumbersResponse"
>>>>>>> message="tns:addNumbersResponse">
>>>>>>> </wsdl:output>
>>>>>>> </wsdl:operation>
>>>>>>> </wsdl:portType>
>>>>>>> <wsdl:binding name="CalculatorServiceSoapBinding"
>>>>>>> type="tns:CalculatorService">
>>>>>>> <soap:binding style="document" transport="
>>>>>>> http://schemas.xmlsoap.org/soap/http "/>
>>>>>>> <wsdl:operation name="addNumbers">
>>>>>>> <soap:operation soapAction="" style="document"/>
>>>>>>> <wsdl:input name="addNumbers">
>>>>>>> <soap:body use="literal"/>
>>>>>>> </wsdl:input>
>>>>>>> <wsdl:output name="addNumbersResponse">
>>>>>>> <soap:body use="literal"/>
>>>>>>> </wsdl:output>
>>>>>>> </wsdl:operation>
>>>>>>> </wsdl:binding>
>>>>>>> <wsdl:service name="CalculatorService">
>>>>>>> <wsdl:port name="CalculatorServicePort"
>>>>>>> binding="tns:CalculatorServiceSoapBinding">
>>>>>>> <soap:address location="http://localhost:9090/CalculatorServicePort
>>>>>>> "/>
>>>>>>> </wsdl:port>
>>>>>>> </wsdl:service>
>>>>>>> </wsdl:definitions>
>>>>>>> 
>>>>>>> Upon wsdl I generate java code. When I call my generated services I see
>>>>>>> the following
>>>>>>> 
>>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>>> POST /webservices/calcService HTTP/1.1..Content-Type: text/xml;
>>>>>>> charset=UTF-8..Accept: */*..SOAPAction: ""..User-Agent: Apache-CXF/
>>>>> 3.3.6.
>>>>>>> .Cache-Control: no-cache..Pragma: no-cache..Host: 127.0.0.1:8080
>>>>> ..Connection:
>>>>>>> keep-alive..Content-Length: 218....
>>>>>>> ##
>>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/
>>>>> "><soap:Body><ns2:addNumbers
>>>>>>> xmlns:ns2="  http://cfx.foo.com/
>>>>> "><arg0>1.2</arg0><arg1>1.2</arg1></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>>>> 
>>>>>>> ##
>>>>>>> T 127.0.0.1:8080 -> 127.0.0.1:33602 [AP]
>>>>>>> HTTP/1.1 500 Server Error..Date: Thu, 30 Apr 2020 15:38:13
>>>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>>>> Jetty(
>>>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>>>> http://schemas.xmlsoap.org/soap/envelope/
>>>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>>>> aultcode><faultstring>null while invoking public double
>>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>>>> null,
>>>>>>> null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>>>> 
>>>>>>> #######
>>>>>>> 
>>>>>>> And the following stacktrace:
>>>>>>> 
>>>>>>> org.apache.cxf.interceptor.Fault: null while invoking public double
>>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params
>>>>> [null,
>>>>>>> null].
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>>>>>>> at
>>>>>>> 
>>>>> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>>>>>>> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>> 
>>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
>>>>>>> 
>>>>>>> I can’t understand why my arguments are ignored. Is there some
>>>>> dependency
>>>>>>> problems? Then why there is no any exceptions? Please, help me to solve
>>>>>>> this problem.
>>>>>>> 
>>>>>>> The question is also asked on SO here
>>>>>>> 
>>>>> https://stackoverflow.com/questions/61512699/cxf-ignores-method-arguments
>>>>>>> 
>>>>>>> --
>>>>>>> Alex Sviridov
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> 
>>>>>> Mark Presling
>>>>>> 
>>>>>> *Senior Developer / Technical Lead*
>>>>>> 
>>>>>> Argonaut Ltd
>>>>>> 
>>>>>> DDI: (04) 9016504
>>>>>> Mobile: 021549540
>>>>>> Do you use Outlook? Stop sending me winmail.dat
>>>>>> <
>>>>> https://www.lifewire.com/prevent-sending-winmail-dat-attachments-1173717 >
>>>>>> files!
>>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Alex Sviridov
>>>>> 
>>>> --
>>>> Mark Presling
>>>> 
>>>> Senior Developer / Technical Lead
>>>> 
>>>> Argonaut Ltd
>>>> 
>>>> DDI: (04) 9016504
>>>> Mobile: 021549540
>>>> 
>>> 
>>> 
>>> --
>>> Alex Sviridov
>>> 
>> --
>> Daniel Kulp
>> dkulp@apache.org <ma...@apache.org> -  http://dankulp.com/blog < http://dankulp.com/blog >
>> Talend Community Coder -  http://talend.com < http://coders.talend.com/ >
>>   
>  
>  
> --
> Alex Sviridov
>  

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

Re[2]: CXF absolutely ignores method arguments

Posted by Alex Sviridov <oo...@mail.ru.INVALID>.
Hi Dan,
 
Thank you very much for your answer. I changed ServerFactoryBean to
to JaxWsServerFactoryBean but after that my service is not created.
Last message I see is :
[qtp20853837-21] INFO org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean - Creating Service {http://webapp.mycompany.com/}CalculatorService from WSDL: http://localhost:8080/webservices/calcService?wsdl
 
And when I try to open  http://localhost:8080/webservices/calcService it doesnt answer.
 
Using debugger I found out that program hangs in org.apache.cxf.transport.http.URLConnectionHTTPConduit
at line 373 :
                return AccessController.doPrivileged(new PrivilegedExceptionAction<Integer>() {
                    @Override
                    public Integer run() throws IOException {
                        return connection.getResponseCode();
                    } });
 
Best regards Alex
  
>Понедельник, 4 мая 2020, 15:34 +03:00 от Daniel Kulp <dk...@apache.org>:
> 
>My gut feeling is that you need to flip:
>
>- ServerFactoryBean factory = new ServerFactoryBean();
>+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
>
>The default ServerFactoryBean would know about all the JAXWS annotations (WebParam, WebService, etc….) and thus is dropping to various defaults which might not match what you are sending since you ARE using JAXWS on the client side.
>
>
>Dan
>
>
> 
>> On May 1, 2020, at 1:01 PM, Alex Sviridov < ooo_saturn7@mail.ru.INVALID > wrote:
>>
>>
>> By the way, I did a test project, so, if anyone could make it work
>> I would be very thankful. To run it execute the following commands:
>> git clone  https://github.com/PashaTurok/cxftest.git
>> cd cxftest
>> mvn clean install
>>
>>> Пятница, 1 мая 2020, 13:55 +03:00 от Mark Presling < mark.presling@argonaut.nz >:
>>>
>>> What if you make the name attribute match the param name? Ie, instead of:
>>>
>>> @WebParam(name="value1")
>>>
>>> try:
>>>
>>> @WebParam(name="v1")
>>>
>>> FYI, I’m not part of the project, just looking at what I’ve done in the
>>> past.
>>>
>>> Thanks,
>>> Mark
>>>
>>> On Fri, 1 May 2020 at 19:36, Alex Sviridov <  ooo_saturn7@mail.ru.invalid >
>>> wrote:
>>>
>>>>
>>>> Hi Mark,
>>>>
>>>> Thank you very much for your answer. I tried to add @WebParam:
>>>>
>>>> @WebService(name="CalculatorService",
>>>> serviceName="CalculatorService",
>>>> wsdlLocation="http://localhost:8080/webservices/calcService?wsdl")
>>>> public class CalculatorService {
>>>>
>>>> @WebMethod
>>>> public double addNumbers(@WebParam(name="value1") double v1,
>>>> @WebParam(name="value2") double v2) {
>>>> return v1 + v2;
>>>> }
>>>> }
>>>>
>>>> Here is port dumping:
>>>>
>>>> T 127.0.0.1:53516 -> 127.0.0.1:8080 [AP]
>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/ "><soap:Body><ns2:addNumbers
>>>> xmlns:ns2="  http://cfx.foo.com/ "><value1>1.2</value1><value2>1.2</value2></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>
>>>> ##
>>>> T 127.0.0.1:8080 -> 127.0.0.1:53516 [AP]
>>>> HTTP/1.1 500 Server Error..Date: Fri, 01 May 2020 07:28:46
>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>> Jetty(
>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>  http://schemas.xmlsoap.org/soap/envelope/
>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>> aultcode><faultstring>null while invoking public double
>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>> null, null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>
>>>> Anyway I opened an issue here
>>>>  https://issues.apache.org/jira/browse/CXF-8274
>>>>
>>>> Best regards.
>>>>
>>>>> Пятница, 1 мая 2020, 1:37 +03:00 от Mark Presling <
>>>>  mark.presling@argonaut.nz >:
>>>>>
>>>>> Try adding @WebParam to the v1 and v2 parameters.
>>>>>
>>>>>
>>>>  https://cxf.apache.org/docs/developing-a-service.html#DevelopingaService-AnnotatingtheSEI
>>>>>
>>>>> On Fri, 1 May 2020 at 03:45, Alex Sviridov <  ooo_saturn7@mail.ru.invalid
>>>>>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> Please help me to run the simplest example with CXF. After spending ten
>>>>>> hours
>>>>>> I still can pass any arguments to my methods.
>>>>>>
>>>>>> This is my service:
>>>>>>
>>>>>> @WebService(name="CalculatorService", serviceName="CalculatorService")
>>>>>> public class CalculatorService {
>>>>>>
>>>>>> @WebMethod
>>>>>> public double addNumbers(double v1, double v2) {
>>>>>> return v1 + v2;
>>>>>> }
>>>>>> }
>>>>>> Upon it I generate using cxf plugin the following wsdl
>>>>>>
>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>> <wsdl:definitions name="CalculatorService" targetNamespace="
>>>>>>  http://cfx.foo.com/ " xmlns:wsdl="  http://schemas.xmlsoap.org/wsdl/ "
>>>>>> xmlns:xsd="  http://www.w3.org/2001/XMLSchema " xmlns:tns="
>>>>>>  http://cfx.foo.com/ " xmlns:soap="
>>>>  http://schemas.xmlsoap.org/wsdl/soap/ ">
>>>>>> <wsdl:types>
>>>>>> <xs:schema xmlns:tns="  http://cfx.foo.com/ " xmlns:xs="
>>>>>>  http://www.w3.org/2001/XMLSchema " elementFormDefault="unqualified"
>>>>>> targetNamespace="  http://cfx.foo.com/ " version="1.0">
>>>>>>
>>>>>> <xs:element name="addNumbers" type="tns:addNumbers"/>
>>>>>>
>>>>>> <xs:element name="addNumbersResponse" type="tns:addNumbersResponse"/>
>>>>>>
>>>>>> <xs:complexType name="addNumbers">
>>>>>> <xs:sequence>
>>>>>> <xs:element name="arg0" type="xs:double"/>
>>>>>> <xs:element name="arg1" type="xs:double"/>
>>>>>> </xs:sequence>
>>>>>> </xs:complexType>
>>>>>>
>>>>>> <xs:complexType name="addNumbersResponse">
>>>>>> <xs:sequence>
>>>>>> <xs:element name="return" type="xs:double"/>
>>>>>> </xs:sequence>
>>>>>> </xs:complexType>
>>>>>>
>>>>>> </xs:schema>
>>>>>> </wsdl:types>
>>>>>> <wsdl:message name="addNumbers">
>>>>>> <wsdl:part name="parameters" element="tns:addNumbers">
>>>>>> </wsdl:part>
>>>>>> </wsdl:message>
>>>>>> <wsdl:message name="addNumbersResponse">
>>>>>> <wsdl:part name="parameters" element="tns:addNumbersResponse">
>>>>>> </wsdl:part>
>>>>>> </wsdl:message>
>>>>>> <wsdl:portType name="CalculatorService">
>>>>>> <wsdl:operation name="addNumbers">
>>>>>> <wsdl:input name="addNumbers" message="tns:addNumbers">
>>>>>> </wsdl:input>
>>>>>> <wsdl:output name="addNumbersResponse"
>>>>>> message="tns:addNumbersResponse">
>>>>>> </wsdl:output>
>>>>>> </wsdl:operation>
>>>>>> </wsdl:portType>
>>>>>> <wsdl:binding name="CalculatorServiceSoapBinding"
>>>>>> type="tns:CalculatorService">
>>>>>> <soap:binding style="document" transport="
>>>>>>  http://schemas.xmlsoap.org/soap/http "/>
>>>>>> <wsdl:operation name="addNumbers">
>>>>>> <soap:operation soapAction="" style="document"/>
>>>>>> <wsdl:input name="addNumbers">
>>>>>> <soap:body use="literal"/>
>>>>>> </wsdl:input>
>>>>>> <wsdl:output name="addNumbersResponse">
>>>>>> <soap:body use="literal"/>
>>>>>> </wsdl:output>
>>>>>> </wsdl:operation>
>>>>>> </wsdl:binding>
>>>>>> <wsdl:service name="CalculatorService">
>>>>>> <wsdl:port name="CalculatorServicePort"
>>>>>> binding="tns:CalculatorServiceSoapBinding">
>>>>>> <soap:address location="http://localhost:9090/CalculatorServicePort
>>>>>> "/>
>>>>>> </wsdl:port>
>>>>>> </wsdl:service>
>>>>>> </wsdl:definitions>
>>>>>>
>>>>>> Upon wsdl I generate java code. When I call my generated services I see
>>>>>> the following
>>>>>>
>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>> POST /webservices/calcService HTTP/1.1..Content-Type: text/xml;
>>>>>> charset=UTF-8..Accept: */*..SOAPAction: ""..User-Agent: Apache-CXF/
>>>> 3.3.6.
>>>>>> .Cache-Control: no-cache..Pragma: no-cache..Host: 127.0.0.1:8080
>>>> ..Connection:
>>>>>> keep-alive..Content-Length: 218....
>>>>>> ##
>>>>>> T 127.0.0.1:33602 -> 127.0.0.1:8080 [AP]
>>>>>> <soap:Envelope xmlns:soap="  http://schemas.xmlsoap.org/soap/envelope/
>>>> "><soap:Body><ns2:addNumbers
>>>>>> xmlns:ns2="  http://cfx.foo.com/
>>>> "><arg0>1.2</arg0><arg1>1.2</arg1></ns2:addNumbers></soap:Body></soap:Envelope>
>>>>>>
>>>>>> ##
>>>>>> T 127.0.0.1:8080 -> 127.0.0.1:33602 [AP]
>>>>>> HTTP/1.1 500 Server Error..Date: Thu, 30 Apr 2020 15:38:13
>>>>>> GMT..Content-Type: text/xml;charset=utf-8..Content-Length: 322..Server:
>>>>>> Jetty(
>>>>>> 9.4.z-SNAPSHOT)....<soap:Envelope xmlns:soap="
>>>>>>  http://schemas.xmlsoap.org/soap/envelope/
>>>>>> "><soap:Body><soap:Fault><faultcode>soap:Server</f
>>>>>> aultcode><faultstring>null while invoking public double
>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params [
>>>>>> null,
>>>>>> null].</faultstring></soap:Fault></soap:Body></soap:Envelope>
>>>>>>
>>>>>> #######
>>>>>>
>>>>>> And the following stacktrace:
>>>>>>
>>>>>> org.apache.cxf.interceptor.Fault: null while invoking public double
>>>>>> com.foo.cfx.CalculatorService.addNumbers(double,double) with params
>>>> [null,
>>>>>> null].
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
>>>>>> at
>>>>>>
>>>> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
>>>>>> at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
>>>>>> at  org.apache.cxf.core@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
>>>>>> at  org.apache.cxf.transport.http@3.3.6
>>>>>>
>>>> /org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:220)
>>>>>>
>>>>>> I can’t understand why my arguments are ignored. Is there some
>>>> dependency
>>>>>> problems? Then why there is no any exceptions? Please, help me to solve
>>>>>> this problem.
>>>>>>
>>>>>> The question is also asked on SO here
>>>>>>
>>>>  https://stackoverflow.com/questions/61512699/cxf-ignores-method-arguments
>>>>>>
>>>>>> --
>>>>>> Alex Sviridov
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> Mark Presling
>>>>>
>>>>> *Senior Developer / Technical Lead*
>>>>>
>>>>> Argonaut Ltd
>>>>>
>>>>> DDI: (04) 9016504
>>>>> Mobile: 021549540
>>>>> Do you use Outlook? Stop sending me winmail.dat
>>>>> <
>>>>  https://www.lifewire.com/prevent-sending-winmail-dat-attachments-1173717 >
>>>>> files!
>>>>>
>>>>
>>>>
>>>> --
>>>> Alex Sviridov
>>>>
>>> --
>>> Mark Presling
>>>
>>> Senior Developer / Technical Lead
>>>
>>> Argonaut Ltd
>>>
>>> DDI: (04) 9016504
>>> Mobile: 021549540
>>>
>>
>>
>> --
>> Alex Sviridov
>>
>--
>Daniel Kulp
>dkulp@apache.org <ma...@apache.org> -  http://dankulp.com/blog < http://dankulp.com/blog >
>Talend Community Coder -  http://talend.com < http://coders.talend.com/ >
>  
 
 
--
Alex Sviridov