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 
[email protected]/org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:166)
    at 
[email protected]/org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:140)
    at 
[email protected]/org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
    at 
[email protected]/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 
[email protected]/org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
    at 
[email protected]/org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
    at 
[email protected]/org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
    at 
[email protected]/org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at 
[email protected]/org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
    at 
[email protected]/org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
    at 
[email protected]/org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234)
    at 
[email protected]/org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208)
    at 
[email protected]/org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160)
    at 
[email protected]/org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:225)
    at 
[email protected]/org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:301)
    at 
[email protected]/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

Reply via email to