Invalid Element exception with Complex Types in JBoss 4.0.3
jbabuscio Apr 18, 2006 7:38 PMI had posted something similar with other WSDL files in the past and have yet to solve the problem. This has been bothering me for about a week now and I can't seem to get over this hump. I have taken all the examples and help people have given me and narrowed my WSDL to a very simple case doing exactly what I need it to do.
I am using JBoss 4.0.3 with the WS4EE Axis Stack. I downloaded the new version of JBoss but couldn't get that to work either. I am invoking the webservice via a JUnit test which is in the same class loader. I am created a Generic Soap Message with 2 String elements and sending it through the methods.
Here is my stack trace:
19:20:09,522 ERROR [RPCInvocation] org.xml.sax.SAXException: Invalid element in com.jb.notificationproducer.Subscribe - Co nsumerReference org.xml.sax.SAXException: Invalid element in com.jb.notificationproducer.Subscribe - ConsumerReference at org.jboss.axis.encoding.ser.BeanDeserializer.onStartChild(BeanDeserializer.java:432) at org.jboss.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1168) at org.jboss.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244) at org.jboss.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1389) at org.jboss.axis.message.RPCElement.deserialize(RPCElement.java:262) at org.jboss.axis.message.RPCElement.getParams(RPCElement.java:396) at org.jboss.axis.providers.java.RPCInvocation.prepareFromRequestEnvelope(RPCInvocation.java:235) at org.jboss.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:103) at org.jboss.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358) at org.jboss.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73) at org.jboss.axis.SimpleChain.doVisiting(SimpleChain.java:160) at org.jboss.axis.SimpleChain.invoke(SimpleChain.java:123) at org.jboss.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560) at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:200) at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:89) at org.jboss.axis.transport.http.AxisServlet.doPost(AxisServlet.java:911) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.jboss.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370) at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.hpti.servlet.http.session.SessionTrackerFilter.doFilter(SessionTrackerFilter.java:29) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.hpti.servlet.http.RefreshFilter.doFilter(RefreshFilter.java:37) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at com.hpti.security.servlet.RestrictedResourceFilter.doFilter(RestrictedResourceFilter.java:35) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39) at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:534)
Here are is my WSDL file:
<?xml version="1.0"?> <definitions name="MyDefinition" targetNamespace="http://abc.com/my/wsdl/namespace" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://abc.com/my/wsdl/namespace" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> <types> <schema elementFormDefault="qualified" targetNamespace="http://abc.com/my/wsdl/namespace" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <!-- These are the embedded complex types within a subscribe message --> <xsd:complexType name="TopicExpressionType" mixed="true"> <xsd:sequence> <xsd:any minOccurs="0" maxOccurs="1" processContents="lax"/> </xsd:sequence> <xsd:attribute name="Dialect" type="xsd:anyURI"/> </xsd:complexType> <xsd:complexType name="AttributedURI"> <xsd:simpleContent> <xsd:extension base="xsd:anyURI"> <!--xsd:anyAttribute namespace="##other" processContents="lax"/--> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="ReferencePropertiesType"> <xsd:sequence> <xsd:any processContents="lax" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="AttributedQName"> <xsd:simpleContent> <xsd:extension base="xsd:QName"> <!--xsd:anyAttribute namespace="##other" processContents="lax"/--> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="ServiceNameType"> <xsd:simpleContent> <xsd:extension base="xsd:QName"> <xsd:attribute name="PortName" type="xsd:NCName"/> <!--xsd:anyAttribute namespace="##other" processContents="lax"/--> </xsd:extension> </xsd:simpleContent> </xsd:complexType> <xsd:complexType name="EndpointReferenceType"> <xsd:sequence> <xsd:element name="Address" type="tns:AttributedURI"/> <xsd:element name="ReferenceProperties" type="tns:ReferencePropertiesType" minOccurs="0"/> <xsd:element name="PortType" type="tns:AttributedQName" minOccurs="0"/> <xsd:element name="ServiceName" type="tns:ServiceNameType" minOccurs="0"/> <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation> If "Policy" elements from namespace "http://schemas.xmlsoap.org/ws/2002/12/policy#policy" are used, they must appear first (before any extensibility elements). </xsd:documentation> </xsd:annotation> </xsd:any> </xsd:sequence> </xsd:complexType> <xsd:element name="Subscribe"> <xsd:complexType> <xsd:sequence> <xsd:element name="ConsumerReference" type="tns:EndpointReferenceType" minOccurs="1" maxOccurs="1"/> <xsd:element name="TopicExpression" type="tns:TopicExpressionType" minOccurs="1" maxOccurs="1"/> <xsd:element name="UseNotify" type="xsd:boolean" default="true" minOccurs="0" maxOccurs="1"/> <xsd:element name="SubscriptionPolicy" type="xsd:anyType" minOccurs="0" maxOccurs="1"/> <xsd:element name="InitialTerminationTime" type="xsd:dateTime" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SubscribeResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="SubscriptionReference" type="tns:EndpointReferenceType" minOccurs="0" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="GetCurrentMessage"> <xsd:complexType> <xsd:sequence> <xsd:element name="Topic" type="tns:TopicExpressionType"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="GetCurrentMessageResponse"> <xsd:complexType> <xsd:sequence> <xsd:any/> </xsd:sequence> </xsd:complexType> </xsd:element> </schema> </types> <message name="SubscribeRequest"> <part name="SubscrbeRequest" element="tns:Subscribe"/> </message> <message name="SubscribeResponse"> <part name="SubscribeResponse" element="tns:SubscribeResponse"/> </message> <message name="GetCurrentMessageRequest"> <part name="GetCurrentMessageRequest" element="tns:GetCurrentMessage"/> </message> <message name="GetCurrentMessageResponse"> <part name="GetCurrentMessageResponse" element="tns:GetCurrentMessageResponse"/> </message> <portType name="NotificationProducerPortType" type="tns:NotificationProducerPortType"> <operation name="Subscribe"> <input message="tns:SubscribeRequest" /> <output message="tns:SubscribeResponse" /> </operation> <operation name="GetCurrentMessage"> <input message="tns:GetCurrentMessageRequest" /> <output message="tns:GetCurrentMessageResponse" /> </operation> </portType> <binding name="NotificationProducerSoapHttpBinding" type="tns:NotificationProducerPortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Subscribe"> <soap:operation style="document"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="GetCurrentMessage"> <soap:operation style="document"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="NotificationProducerService"> <port name="NotificationProducerPort" binding="tns:NotificationProducerSoapHttpBinding"> <soap:address location="https://localhost/NotificationProducer" /> </port> </service> </definitions>
Here is the generated .wsdd file that JBoss creates. I noticed the duplication of the Subscribe element mapping. I can't figure this out either.
<deployment xmlns='http://xml.apache.org/axis/wsdd/' xmlns:java='http://xml.apache.org/axis/wsdd/providers/java' xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'> <service name='jb.ear/jb.war#NotificationProducer/NotificationProducerPort' style='document' use='literal' provider='Handler'> <parameter name='webserviceID' value='jb.ear/jb.war#NotificationProducer/NotificationProducerPort' /> <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderJSE' /> <operation name='getCurrentMessage' qname='ns1:GetCurrentMessage' returnQName='ns1:GetCurrentMessageResponse' returnType='ns1:GetCurrentMessageResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' > <parameter name='GetCurrentMessageRequest' qname='ns1:GetCurrentMessage' mode='IN' type='ns1:GetCurrentMessage' xmlns:ns1='http://abc.com/my/wsdl/namespace' /> </operation> <operation name='subscribe' qname='ns1:Subscribe' returnQName='ns1:SubscribeResponse' returnType='ns1:SubscribeResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' > <parameter name='SubscrbeRequest' qname='ns1:Subscribe' mode='IN' type='ns1:Subscribe' xmlns:ns1='http://abc.com/my/wsdl/namespace' /> </operation> <typeMapping qname='ns1:>GetCurrentMessage' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.GetCurrentMessage' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='topic' xmlName='Topic'/> <elementOrder> <element name='topic'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:>GetCurrentMessageResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.GetCurrentMessageResponse' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='_any' xmlName='null'/> </typeDesc> </typeMapping> <typeMapping qname='ns1:>Subscribe' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.Subscribe' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='consumerReference' xmlName='ConsumerReference'/> <elementDesc fieldName='topicExpression' xmlName='TopicExpression'/> <elementDesc fieldName='useNotify' xmlName='UseNotify'/> <elementDesc fieldName='subscriptionPolicy' xmlName='SubscriptionPolicy'/> <elementDesc fieldName='initialTerminationTime' xmlName='InitialTerminationTime'/> <elementOrder> <element name='consumerReference'/> <element name='topicExpression'/> <element name='useNotify'/> <element name='subscriptionPolicy'/> <element name='initialTerminationTime'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:>SubscribeResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.SubscribeResponse' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='subscriptionReference' xmlName='SubscriptionReference'/> <elementOrder> <element name='subscriptionReference'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:AttributedQName' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.AttributedQName' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> </typeDesc> </typeMapping> <typeMapping qname='ns1:AttributedURI' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.AttributedURI' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> </typeDesc> </typeMapping> <typeMapping qname='ns1:EndpointReferenceType' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.EndpointReferenceType' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='address' xmlName='Address'/> <elementDesc fieldName='referenceProperties' xmlName='ReferenceProperties'/> <elementDesc fieldName='portType' xmlName='PortType'/> <elementDesc fieldName='serviceName' xmlName='ServiceName'/> <elementDesc fieldName='_any' xmlName='null'/> <elementOrder> <element name='address'/> <element name='referenceProperties'/> <element name='portType'/> <element name='serviceName'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:GetCurrentMessage' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.GetCurrentMessage' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='topic' xmlName='Topic'/> <elementOrder> <element name='topic'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:GetCurrentMessageResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.GetCurrentMessageResponse' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='_any' xmlName='null'/> </typeDesc> </typeMapping> <typeMapping qname='ns1:ReferencePropertiesType' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.ReferencePropertiesType' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='_any' xmlName='null'/> </typeDesc> </typeMapping> <typeMapping qname='ns1:ServiceNameType' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.ServiceNameType' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='portName' xmlName='PortName' asAttr='true'/> </typeDesc> </typeMapping> <typeMapping qname='ns1:Subscribe' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.Subscribe' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='consumerReference' xmlName='ConsumerReference'/> <elementDesc fieldName='topicExpression' xmlName='TopicExpression'/> <elementDesc fieldName='useNotify' xmlName='UseNotify'/> <elementDesc fieldName='subscriptionPolicy' xmlName='SubscriptionPolicy'/> <elementDesc fieldName='initialTerminationTime' xmlName='InitialTerminationTime'/> <elementOrder> <element name='consumerReference'/> <element name='topicExpression'/> <element name='useNotify'/> <element name='subscriptionPolicy'/> <element name='initialTerminationTime'/> </elementOrder> </typeDesc> </typeMapping> <typeMapping qname='ns1:SubscribeResponse' xmlns:ns1='http://abc.com/my/wsdl/namespace' type='java:com.jb.notificationproducer.SubscribeResponse' serializer='org.jboss.webservice.encoding.ser.MetaDataBeanSerializerFactory' deserializer='org.jboss.webservice.encoding.ser.MetaDataBeanDeserializerFactory' encodingStyle=''> <typeDesc> <elementDesc fieldName='subscriptionReference' xmlName='SubscriptionReference'/> <elementOrder> <element name='subscriptionReference'/> </elementOrder> </typeDesc> </typeMapping> </service> </deployment>
The SOAP message that comes out of this
<?xml version="1.0" encoding="UTF-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \tab xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://abc.com/my/wsdl/namespace"> <env:Body> <ns0:Subscribe> <ns0:ConsumerReference> <ns0:Address>https://localhost/NotificationProducer</ns0:Address> <element xmlns="https:/localhost/NotificationProducer">Number 1</element> <element xmlns="https:/localhost/NotificationProducer">Number 2</element> </ns0:ConsumerReference> <element xmlns="https:/localhost/NotificationProducer">Number 1</element> <ns0:UseNotify>true</ns0:UseNotify> </ns0:Subscribe> </env:Body> </env:Envelope>
For this current project, I cannot switch to another version of JBoss. I have generated all the code using JWSDP 1.5.
If anybody sees anything and could help, I would be greatful.
Thank you.