1 Reply Latest reply on May 26, 2008 4:44 AM by Karel Jelinek

    Document/Literal (Bare) and more parameters in WebMethod

    Karel Jelinek Newbie

      I am using Document/Literal web service and I build it like example service in user guide.

      So I have this web service:

      @WebService(name = "BareEndpoint", serviceName = "BareService")
      @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
      public class BareEndpointBean implements BareEndpoint
      {
      
       @WebMethod
       public BareResponse persistUser(User user, FtpQuotaLimit ftpQuotaLimit)
       { .
       .
       .
       }
      }
      


      and I have these classes that acts as WebMethod parameters

      @XmlAccessorType(XmlAccessType.PROPERTY)
      @XmlType(name = "User")
      @XmlRootElement(name="UserPO")
      @Entity
      @Table(name = "users")
      public class User implements Serializable {
       some properties here, classic entity bean
      }
      
      @XmlAccessorType(XmlAccessType.PROPERTY)
      @XmlType(name = "FtpQuotaLimit")
      @XmlRootElement(name="FtpQuotaLimitPO")
      @Entity
      @Table(name = "ftpquotalimits")
      public class FtpQuotaLimit implements Serializable, Cloneable {
       some properties here, classic entity bean
      }
      


      But I will get exception, when I try to call persistUser method with 2 parameters:
      javax.xml.ws.WebServiceException: org.jboss.ws.core.binding.BindingException: javaType hcp.User is not assignable from: hcp.config.FtpQuotaLimit
       at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:404)
       at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:314)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:172)
       at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:152)
       at $Proxy122.persistUser(Unknown Source)
       at hcp.config.DataTransfer.activateUser(DataTransfer.java:102)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
       at hcp.config.DataTransfer_$$_javassist_4.activateUser(DataTransfer_$$_javassist_4.java)
       at hcp.UserHome.activate(UserHome.java:324)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:40)
       at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
       at hcp.UserHome_$$_javassist_3.activate(UserHome_$$_javassist_3.java)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
       at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:274)
       at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
       at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
       at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
       at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
       at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
       at org.jboss.seam.navigation.Pages.callAction(Pages.java:636)
       at org.jboss.seam.navigation.Pages.preRender(Pages.java:289)
       at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:549)
       at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:460)
       at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
       at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:256)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:362)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:488)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.ws.core.binding.BindingException: javaType hcp.User is not assignable from: hcp.config.FtpQuotaLimit
       at org.jboss.ws.core.CommonSOAPBinding.addParameterToMessage(CommonSOAPBinding.java:769)
       at org.jboss.ws.core.CommonSOAPBinding.bindRequestMessage(CommonSOAPBinding.java:227)
       at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:291)
       at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:302)
       ... 107 more
      


      Everything works when I call this method only with one parameter, so these methods are ok:
      @WebMethod
       public BareResponse persistUser(User user)
      
      @WebMethod
       public BareResponse persistUser(FtpQuotaLimit ftpQuotaLimit)
      


      But I need to send more than one parameter in this method..

      Do You have some ideas? thanks

      WSDL generated from method with 2 parameters:

      <?xml version="1.0" encoding="UTF-8"?>
      <definitions name='BareService' targetNamespace='http://service.hcp/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://service.hcp/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
       <types>
       <xs:schema targetNamespace='http://service.hcp/' version='1.0' xmlns:tns='http://service.hcp/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
       <xs:element name='FtpQuotaLimitPO' type='tns:FtpQuotaLimit'/>
       <xs:element name='Response' type='tns:BareResponse'/>
       <xs:element name='UserPO' type='tns:User'/>
       <xs:element name='persistUser' nillable='true' type='xs:anyType'/>
       <xs:element name='persistUserResponse' nillable='true' type='tns:BareResponse'/>
       <xs:complexType name='User'>
       <xs:sequence>
       <xs:element minOccurs='0' name='activated' type='xs:boolean'/>
       <xs:element minOccurs='0' name='city' type='xs:string'/>
       <xs:element minOccurs='0' name='company' type='xs:string'/>
       <xs:element minOccurs='0' name='cp' type='xs:int'/>
       <xs:element minOccurs='0' name='dic' type='xs:string'/>
       <xs:element minOccurs='0' name='email' type='xs:string'/>
       <xs:element minOccurs='0' name='firstName' type='xs:string'/>
       <xs:element minOccurs='0' name='ico' type='xs:string'/>
       <xs:element minOccurs='0' name='ip' type='xs:string'/>
       <xs:element minOccurs='0' name='lastName' type='xs:string'/>
       <xs:element minOccurs='0' name='password' type='xs:string'/>
       <xs:element minOccurs='0' name='psc' type='xs:int'/>
       <xs:element minOccurs='0' name='registrationDate' type='xs:dateTime'/>
       <xs:element minOccurs='0' name='reseller' type='xs:string'/>
       <xs:element minOccurs='0' name='role' type='xs:string'/>
       <xs:element minOccurs='0' name='salt' type='xs:string'/>
       <xs:element minOccurs='0' name='street' type='xs:string'/>
       <xs:element minOccurs='0' name='username' type='xs:string'/>
       </xs:sequence>
       </xs:complexType>
       <xs:complexType name='FtpQuotaLimit'>
       <xs:sequence>
       <xs:element minOccurs='0' name='bytes_in_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='bytes_out_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='bytes_xfer_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='files_in_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='files_out_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='files_xfer_avail' type='xs:int'/>
       <xs:element minOccurs='0' name='limit_type' type='xs:string'/>
       <xs:element minOccurs='0' name='name' type='xs:string'/>
       <xs:element minOccurs='0' name='per_session' type='xs:string'/>
       <xs:element minOccurs='0' name='quota_type' type='xs:string'/>
       </xs:sequence>
       </xs:complexType>
       <xs:complexType name='BareResponse'>
       <xs:sequence>
       <xs:element minOccurs='0' name='responseString' type='xs:string'/>
       <xs:element name='responseNumber' type='xs:int'/>
       <xs:element name='successful' type='xs:boolean'/>
       </xs:sequence>
       </xs:complexType>
       </xs:schema>
       </types>
       <message name='BareEndpoint_persistUser'>
       <part element='tns:persistUser' name='persistUser'/>
       </message>
       <message name='BareEndpoint_persistUserResponse'>
       <part element='tns:persistUserResponse' name='persistUserResponse'/>
       </message>
       <portType name='BareEndpoint'>
       <operation name='persistUser' parameterOrder='persistUser'>
       <input message='tns:BareEndpoint_persistUser'/>
       <output message='tns:BareEndpoint_persistUserResponse'/>
       </operation>
       </portType>
       <binding name='BareEndpointBinding' type='tns:BareEndpoint'>
       <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
       <operation name='persistUser'>
       <soap:operation soapAction=''/>
       <input>
       <soap:body use='literal'/>
       </input>
       <output>
       <soap:body use='literal'/>
       </output>
       </operation>
       </binding>
       <service name='BareService'>
       <port binding='tns:BareEndpointBinding' name='BareEndpointPort'>
       <soap:address location='http://127.0.0.1:8080/hcp/ws/bareservice'/>
       </port>
       </service>
      </definitions>