Hi All.  I am a new CXF user.  I have defined a simple Java-first web service
using CXF 2.7.0 with the following SEI:package wstests;import
javax.jws.WebMethod;import javax.jws.WebParam;import
javax.jws.WebService;import javax.jws.soap.SOAPBinding;import
javax.jws.soap.SOAPBinding.ParameterStyle;import
javax.jws.soap.SOAPBinding.Style;import
javax.jws.soap.SOAPBinding.Use;import javax.xml.ws.Holder; //Service
Endpoint Interface@WebService(targetNamespace = "http://wstests/";, name =
"WSProvider")public interface WSProvider {              @WebMethod      
@SOAPBinding(style =
Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED) 
void doRequestResponse(                 @WebParam(name="stringIn", mode =
WebParam.Mode.IN) String stringIn,                      
@WebParam(name="booleanIn", mode =
WebParam.Mode.IN) Boolean booleanIn,                    
@WebParam(name="integerIn", mode =
WebParam.Mode.IN) Integer integerIn,                    @WebParam(name = 
"stringOut", mode =
WebParam.Mode.OUT) Holder stringOut,                    @WebParam(name = 
"booleanOut", mode =
WebParam.Mode.OUT) Holder booleanOut,            @WebParam(name =
"integerOut", mode = WebParam.Mode.OUT) Holder integerOut            ); 
@WebMethod      @SOAPBinding(style = Style.DOCUMENT, use=Use.LITERAL,
parameterStyle=ParameterStyle.WRAPPED)          void doOneWay(          
@WebParam(name="stringIn", mode = WebParam.Mode.IN) String stringIn,            
@WebParam(name="integerIn", mode = WebParam.Mode.IN) Integer integerIn,         
@WebParam(name="booleanIn", mode = WebParam.Mode.IN) Boolean booleanIn          
);}and the following implementation:package wstests;import
javax.jws.WebService;import javax.xml.ws.BindingType;import
javax.xml.ws.Holder;@BindingType(value=javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)@WebService(
serviceName = "WSProviderImplService",  portName = "WSProviderImplPort",
targetNamespace = "http://wstests/";,    wsdlLocation =
"http://localhost:8080/ws/services/WSProviderImplPort?wsdl";,
endpointInterface = "wstests.WSProvider")public class WSProviderImpl
implements WSProvider { @Override       public void doRequestResponse(          
        String
stringIn,                       Boolean booleanIn,                      Integer 
integerIn,                      Holder stringOut,               
Holder booleanOut,                      Holder integerOut)      {               
try {           
System.out.println("Received invocation of doRequestResponse operation with
the following request parameters:");                    
System.out.println(stringIn);           
System.out.println(integerIn);                  stringOut.value = stringIn + " 
;-)";            
integerOut.value = integerIn * 7;                       booleanOut.value =
Boolean.valueOf(true);                  if (booleanIn) {                        
        booleanOut.value =
Boolean.valueOf(false);                 }                       
System.out.println("and generated the
following response parameters:");                       
System.out.println(stringOut.value);            
System.out.println(integerOut.value);           
System.out.println(booleanOut.value);           } catch (Exception e) {         
System.err.println(e.getMessage());             }       }       @Override       
public void
doOneWay(String stringIn, Integer integerIn, Boolean booleanIn                  
) {             try {           
System.out.println("Received invocation of doOneWay operation with the
following parameters:");                        System.out.println(stringIn);   
        
System.out.println(integerIn);                  System.out.println(booleanIn);  
        } catch
(Exception e) {                 System.err.println(e.getMessage());             
}                       }}The WSDL
generated from the above is:<?xml version="1.0" encoding="UTF-8"?>              
                                                                                
                                                                                
                                                                                
                                                                                
     
I am able to deploy the service to Tomcat 7.0 and invoke it successfully
using SoapUI.  I am writing a client application using
JaxWsDynamicClientFactory to invoke the doRequestResponse operation.  I am
able to invoke the web service operation and receive what looks like the
correct response message from the service according to the Tomcat log:ID:
2Address: http://localhost:8080/ws/services/WSProviderImplPortEncoding:
UTF-8Http-Method: POSTContent-Type: text/xml; charset=UTF-8Headers:
{Accept=[*/*], Authorization=[Basic ZGVtbzp3ZWxjb21lMTIz],
cache-control=[no-cache], connection=[keep-alive], Content-Length=[265],
content-type=[text/xml; charset=UTF-8], host=[localhost:8080],
pragma=[no-cache], SOAPAction=[""], user-agent=[Apache CXF 2.7.0]}Payload:
stringfalse500--------------------------------------Received invocation of
doRequestResponse operation with the following request
parameters:string500and generated the following response parameters:string
;-)3500trueDec 09, 2012 12:29:32 PM
org.apache.cxf.services.WSProviderImplService.WSProviderImplPort.WSProviderINFO:
Outbound Message---------------------------ID: 2Encoding: UTF-8Content-Type:
text/xmlHeaders: {}Payload: string
;-)true3500--------------------------------------My client application
successfully retrieves response parameters if there are one or two input and
one or two output parameters to the doRequestResponse method.  But when I
add the third parameter, I receive the following exceptions:12-09-2012
12:29:33.042 WARN [Thread-2] (LogUtils.doLog) Interceptor for
{http://wstests/}WSProviderImplService#{http://wstests/}doRequestResponse
has thrown exception, unwinding nowjava.lang.IndexOutOfBoundsException:
Index: 1, Size: 1       at java.util.ArrayList.rangeCheck(ArrayList.java:604)   
at
java.util.ArrayList.get(ArrayList.java:382)     at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1591)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1489)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1308)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)        
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)  at
org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:355)...12-09-2012
12:29:33.044 ERROR [Thread-2] (SoapTransport.store)
java.lang.IndexOutOfBoundsException: Index: 1, Size:
1java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at
java.util.ArrayList.rangeCheck(ArrayList.java:604)      at
java.util.ArrayList.get(ArrayList.java:382)     at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1591)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1489)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1308)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)        
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)  at
org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:355)...12-09-2012
12:29:33.045 ERROR [Thread-2] (MarshallFromEsp.subscribe)
java.lang.IndexOutOfBoundsException: Index: 1, Size:
1java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at
java.util.ArrayList.rangeCheck(ArrayList.java:604)      at
java.util.ArrayList.get(ArrayList.java:382)     at
org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:801)    at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1591)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1489)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1308)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:623)        
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:531)     at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:464)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:367)  at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:320)  at
org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:355)...In
all cases, I invoke the service from the client application withresult =
client.invokeWrapped(WS_OPERATION_NAME, inputPartObject);where
WS_OPERATION_NAME has namespace http://wstests/ and localPart of
doRequestResponse and where inputPartObject is an instance of the
wstests.DoRequestResponse class generated dynamically by CXF.In looking at
other threads citing the above exceptions, it seems like the issue has to do
with the Holder Interceptors not creating inHolders and outHolders lists of
the appropriate size. Stepping through the CXF 2.7.0 source in the debugger,
I see that the inHolders and outHolders always contain a single element set
to null corresponding to the inputPartObject.  My questions:(1) Am I doing
some thing (or things) incorrectly, that the number of elements in the
inHolders List does not match the number of output parameters for the
operation?  (2) Why would the client return the correct output parameters
when there were one or two output parameters, and only generate an exception
when there are three or more output parameters?Thanks for any assistance or
pointers you can suggest!



--
View this message in context: 
http://cxf.547215.n5.nabble.com/Holders-in-Response-Error-tp5719938.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to