[JBossWS] - Document/Literal (Bare) and more parameters in WebMethod
by cardel
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>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153240#4153240
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153240
16 years, 7 months
[JBossWS] - Peculiar in Jboss 4.2.1
by islpe
I am working on a webservice for a customer that will deliver
patient data to a government office. I have received a complete set of schema files (lots of 'include schemaLocation') and a test xml.I have used Altova to verify that the text xml file indeed conforms to the schema files.
My plan is to store the xml document that is sent to the government office as well as the xml document received in an Oracle database. So I am nacturally interested in marshalling and unmarshalling of Java objects. I have used wsconsume to produce the objects necessary to use and that went allright. I can see that the actual webservice call is done like this:
Emessage retObj = webservice.report(Emessage);
where Emessage is the top document for both the request and return object. I can see from the code above that any marshalling/unmarshalling must be done below this call, but sinde I need to store XML documents I would use marshalling to create the string to store and unmarshalling to
recreate the xml document. My exercise was therefore to do the following using JAXB components inside Jboss-4.2.1
unmarshal test.xml to xml document
-> marshal xml document to xml file
- > compare xml file with original test xml
using the objects that were created with wsconsume. However, the result of the unmarshal only gives the top document Emessage, and a single child, exactly what is contained in the schema Emessage.xsd,
that is the top schema file.
Now if I do the exercise above with the JAXB components in Suns JWSDP 2.0, creating a new set of java objects using xjc, the exercise works well.
How can I get Jboss to unmarshal an xml document that is described by multiple schemas and where thejava objects are created by wsconsume ?
Lasse Petersen
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4153060#4153060
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4153060
16 years, 7 months
[JBossWS] - SOAP response not parsing into Java objects
by dnhanson
Good morning all.
I am running JBossWs 3.0.1 (about 95% sure of the version) on JBoss App Server 4.2.2 on the service side. The JDK over there is 1.6.0_03.
When I send a request to my service using SOAPui, I get back the expected XML in the SOAP message. When I send a request using the client stubs I generated using wsconsume, the outgoing and incoming messages look good, and the proper objects get created by the XML parser (this service returns a custom object), but all fields are populated to their default values (null for strings, 0 for ints).
When I turn Wireshark on, all the data is definitely there to create the objects and populate them. The XML within the envelope appears to be well-formed. I don't get any exceptions until the bad objects percolate through my code. I assume that this is a jaxb problem, but I'm honestly at a loss as to how to fix it. Does anyone have any ideas?
I'll keep looking for answers and will post what I did wrong if I find it. If anyone else has seen this or thinks they have and want more information, please let me know.
And thanks for the help, all who read this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4152994#4152994
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4152994
16 years, 7 months