6 Replies Latest reply on Oct 8, 2007 5:03 PM by sumitsu

    Unmarshalling Exception with Web Service Array Input

    sumitsu

      Hi,

      I am currently attempting to deploy a web service to JBoss 4.2.1 (using Java 6.0 and JBossWS 2.0.1) where the single input is a custom object which contains (among other fields) an array of other custom objects. Deployment seems to work correctly, but I get this error when I try to invoke the service:

      14:16:44,997 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
      org.jboss.ws.WSException: org.jboss.ws.core.binding.BindingException: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException:
       Failed to parse source:
       Failed to resolve class name for customFields:
       No ClassLoaders found for: com.liaison.InboundWebService.messageProcessing.Array
       at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:250)
       at org.jboss.ws.core.soap.XMLContent.transitionTo(XMLContent.java:97)
       at org.jboss.ws.core.soap.DOMContent.transitionTo(DOMContent.java:77)
       at org.jboss.ws.core.soap.SOAPContentElement.transitionTo(SOAPContentElement.java:140)
       at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:171)
       at org.jboss.ws.core.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:263)
       at org.jboss.ws.core.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:115)
       at org.jboss.ws.core.EndpointInvocation.getRequestPayload(EndpointInvocation.java:135)
       at org.jboss.ws.core.server.DelegatingInvocation.getArgs(DelegatingInvocation.java:82)
       at org.jboss.wsf.container.jboss42.InvocationHandlerEJB21.getMBeanInvocation(InvocationHandlerEJB21.java:169)
       at org.jboss.wsf.container.jboss42.InvocationHandlerEJB21.invoke(InvocationHandlerEJB21.java:144)
       at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:220)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:408)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
       at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       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.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       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:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by:
      org.jboss.ws.core.binding.BindingException:
       org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException:
       Failed to parse source:
       Failed to resolve class name for customFields:
       No ClassLoaders found for: com.liaison.InboundWebService.messageProcessing.Array
       at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:111)
       at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:62)
       at org.jboss.ws.core.binding.DeserializerSupport.deserialize(DeserializerSupport.java:60)
       at org.jboss.ws.core.soap.XMLContent.unmarshallObjectContents(XMLContent.java:180)
       ... 35 more
      Caused by: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException:
       Failed to parse source:
       Failed to resolve class name for customFields:
       No ClassLoaders found for: com.liaison.InboundWebService.messageProcessing.Array
       at org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:65)
       at org.jboss.ws.core.jaxrpc.binding.JBossXBDeserializer.deserialize(JBossXBDeserializer.java:103)
       ... 38 more
      Caused by:
      org.jboss.xb.binding.JBossXBException:
       Failed to parse source:
       Failed to resolve class name for customFields:
       No ClassLoaders found for: com.liaison.InboundWebService.messageProcessing.Array
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:178)
       at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
       at org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:61)
       ... 39 more
      Caused by:
      org.jboss.xb.binding.JBossXBRuntimeException:
       Failed to resolve class name for customFields:
       No ClassLoaders found for: com.liaison.InboundWebService.messageProcessing.Array
       at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.loadClassForTerm(RtElementHandler.java:1038)
       at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.classForNonArrayItem(RtElementHandler.java:1367)
       at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.startElement(RtElementHandler.java:693)
       at org.jboss.xb.binding.sunday.unmarshalling.impl.runtime.RtElementHandler.startParticle(RtElementHandler.java:89)
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:504)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:323)
       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
       at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
       at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:174)
       ... 41 more
      


      I've tried this with JVMs 1.4.2, 5.0, 6.0, as well as with JBoss version 4.0.2 and 4.2.1 and with both WS4EE and JBossWS 1.2.1 and 2.0.1, and I get the same error every time. (The error from JBoss 4.0.2 + WS4EE is a bit different, but the gist of it is the same, that it can't deserialize the input for the array.)

      My WSDL, generated by wscompile, is as follows. I've removed a few sections which do not seem relevant to the issue:

      <?xml version="1.0" encoding="UTF-8" ?>
      <definitions name="LiaisonB2BWebServiceInterface"
       targetNamespace="InboundWebService"
       xmlns:tns="InboundWebService"
       xmlns="http://schemas.xmlsoap.org/wsdl/"
       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
       <types>
       <schema targetNamespace="InboundWebService"
       xmlns="http://www.w3.org/2001/XMLSchema"
       xmlns:tns="InboundWebService"
       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <complexType name="CustomField">
       <sequence>
       <element name="name" type="string" nillable="true" />
       <element name="value" type="string" nillable="true" />
       </sequence>
       </complexType>
       <complexType name="ServiceRequest">
       <sequence>
       <element name="customFields" type="tns:CustomField" nillable="true" minOccurs="0" maxOccurs="unbounded" />
       </sequence>
       </complexType>
       <complexType name="ServiceStatus">
       <sequence>
       <element name="code" type="string" nillable="true" />
       <element name="subject" type="string" nillable="true" />
       </sequence>
       </complexType>
       </schema>
       </types>
       <message name="MessageEndPoint_processMessage">
       <part name="ServiceRequest" type="tns:ServiceRequest" />
       </message>
       <message name="MessageEndPoint_processMessageResponse">
       <part name="result" type="tns:ServiceStatus" />
       </message>
       <portType name="MessageEndPoint">
       <operation name="processMessage" parameterOrder="ServiceRequest">
       <input message="tns:MessageEndPoint_processMessage" />
       <output message="tns:MessageEndPoint_processMessageResponse" />
       </operation>
       </portType>
       <binding name="MessageEndPointBinding" type="tns:MessageEndPoint">
       <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
       <operation name="processMessage">
       <soap:operation soapAction="" />
       <input>
       <soap:body use="literal" namespace="InboundWebService" />
       </input>
       <output>
       <soap:body use="literal" namespace="InboundWebService" />
       </output>
       </operation>
       </binding>
       <service name="WebServiceInterface">
       <port name="MessageEndPointPort" binding="tns:MessageEndPointBinding">
       <soap:address location="REPLACE_WITH_ACTUAL_URL" />
       </port>
       </service>
      </definitions>
      


      Has anyone else experienced this problem? I have not been able to find many references to the Exception I'm getting. Please let me know if so; thanks.

        • 1. Re: Unmarshalling Exception with Web Service Array Input
          asoldano

          Did you try with JAX-WS, using jbossws wsprovide instead of wscompile?
          Can you post your SEI / impl here?
          Thanks

          • 2. Re: Unmarshalling Exception with Web Service Array Input
            sumitsu

            Thanks for the response. My endpoint interface looks like this:

            package com.business.WebService.messageProcessing;
            
            public interface MessageEndPoint extends Remote
            {
             public ServiceStatus processMessage(ServiceRequest sReq) throws RemoteException;
            }
            


            and the implementation class (the part relevant to the web service) looks like:

            package com.business.WebService.messageProcessing;
            
            public class MessageBean implements SessionBean {
            
             private static final String RESPONSECODE_OK = "OK";
            
             private SessionContext sessionCtxt;
            
             private ServiceStatus buildResponseOK(String str1, String str2, String str3) {
             ServiceStatus ss = new ServiceStatus();
            
             ss.setCode(RESPONSECODE_OK);
             ss.setSubject(str3);
            
             return ss;
             }
            
             public ServiceStatus processMessage(ServiceRequest sReq) throws RemoteException {
             CustomField[] custFields;
            
             custFields = sReq.getCustomFields();
            
             ... business logic ...
            
             return buildResponseOK("abc", "def", "ghi");
             }
            
             public void ejbCreate() throws EJBException, RemoteException { }
             public void ejbRemove() throws EJBException, RemoteException { }
             public void ejbActivate() throws EJBException, RemoteException { }
             public void ejbPassivate() throws EJBException, RemoteException { }
             public void setSessionContext(SessionContext sessionCtxt) throws EJBException, RemoteException {
             this.sessionCtxt = sessionCtxt;
             }
            
             public MessageBean() {
             }
            }
            


            I'm using a 2.0-spec EJB as my endpoint, and when I try to run wsprovide, it complains about an annotation @WebService not being present:

            org.jboss.ws.WSException: Cannot obtain @WebService annotation from: com.liaison.InboundWebService.messageProcessing.MessageEndPoint
            


            Does JAX-WS require an EJB 3.0 endpoind, or iss there a way to make it work with 2.0 EJBs?

            Thanks again.

            • 3. Re: Unmarshalling Exception with Web Service Array Input
              asoldano

              JAX-WS requires a POJO or an EJB3 SLSB to be annotated with @WebService. If you need to stick with EJB 2.1 you're only choice is JAX-RPC http://jbws.dyndns.org/mediawiki/index.php?title=JAX-WS_User_Guide#EJB3_Stateless_Session_Bean_.28SLSB.29
              Anyway you could have an EJB3 session bean ws layer exposing your ejb2 methods...

              • 4. Re: Unmarshalling Exception with Web Service Array Input
                sumitsu

                I'd prefer to retain the 2.1 SLSB if I can... is there a reason that Array-type inputs should not work under JAX-RPC with the server/JBossWS config I described? Please let me know if you see anything obviously wrong with my WSDL/code/artifacts... I could not find many other references to this Exception in the forum.

                If it helps, here is an extract from my mapping.xml file, also (currently) generated by wscompile:

                <?xml version="1.0" encoding="UTF-8" standalone="no" ?>
                <java-wsdl-mapping xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 version="1.1" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
                 <package-mapping>
                 <package-type>com.business.WebService.messageProcessing</package-type>
                 <namespaceURI>InboundWebService</namespaceURI>
                 </package-mapping>
                 <package-mapping>
                 <package-type>com.business.WebService.messageProcessing</package-type>
                 <namespaceURI>InboundWebService</namespaceURI>
                 </package-mapping>
                 <java-xml-type-mapping>
                 <java-type>com.business.WebService.dto.ServiceStatus</java-type>
                 <root-type-qname xmlns:typeNS="InboundWebService">typeNS:ServiceStatus</root-type-qname>
                 <qname-scope>complexType</qname-scope>
                 <variable-mapping>
                 <java-variable-name>code</java-variable-name>
                 <xml-element-name>code</xml-element-name>
                 </variable-mapping>
                 <variable-mapping>
                 <java-variable-name>subject</java-variable-name>
                 <xml-element-name>subject</xml-element-name>
                 </variable-mapping>
                 </java-xml-type-mapping>
                 <java-xml-type-mapping>
                 <java-type>com.business.WebService.dto.CustomField</java-type>
                 <root-type-qname xmlns:typeNS="InboundWebService">typeNS:CustomField</root-type-qname>
                 <qname-scope>complexType</qname-scope>
                 <variable-mapping>
                 <java-variable-name>name</java-variable-name>
                 <xml-element-name>name</xml-element-name>
                 </variable-mapping>
                 <variable-mapping>
                 <java-variable-name>value</java-variable-name>
                 <xml-element-name>value</xml-element-name>
                 </variable-mapping>
                 </java-xml-type-mapping>
                 <java-xml-type-mapping>
                 <java-type>com.business.WebService.dto.ServiceRequest</java-type>
                 <root-type-qname xmlns:typeNS="InboundWebService">typeNS:ServiceRequest</root-type-qname>
                 <qname-scope>complexType</qname-scope>
                 <variable-mapping>
                 <java-variable-name>customFields</java-variable-name>
                 <xml-element-name>customFields</xml-element-name>
                 </variable-mapping>
                 </java-xml-type-mapping>
                 <service-interface-mapping>
                 <service-interface>com.business.WebService.messageProcessing.LiaisonB2BWebServiceInterface</service-interface>
                 <wsdl-service-name xmlns:serviceNS="InboundWebService">serviceNS:LiaisonB2BWebServiceInterface</wsdl-service-name>
                 <port-mapping>
                 <port-name>MessageEndPointPort</port-name>
                 <java-port-name>MessageEndPointPort</java-port-name>
                 </port-mapping>
                 </service-interface-mapping>
                 <service-endpoint-interface-mapping>
                 <service-endpoint-interface>com.business.WebService.messageProcessing.MessageEndPoint</service-endpoint-interface>
                 <wsdl-port-type xmlns:portTypeNS="InboundWebService">portTypeNS:MessageEndPoint</wsdl-port-type>
                 <wsdl-binding xmlns:bindingNS="InboundWebService">bindingNS:MessageEndPointBinding</wsdl-binding>
                 <service-endpoint-method-mapping>
                 <java-method-name>processMessage</java-method-name>
                 <wsdl-operation>processMessage</wsdl-operation>
                 <method-param-parts-mapping>
                 <param-position>0</param-position>
                 <param-type>com.business.WebService.dto.ServiceRequest</param-type>
                 <wsdl-message-mapping>
                 <wsdl-message xmlns:wsdlMsgNS="InboundWebService">wsdlMsgNS:MessageEndPoint_processMessage</wsdl-message>
                 <wsdl-message-part-name>ServiceRequest</wsdl-message-part-name>
                 <parameter-mode>IN</parameter-mode>
                 </wsdl-message-mapping>
                 </method-param-parts-mapping>
                 <wsdl-return-value-mapping>
                 <method-return-value>com.business.WebService.dto.ServiceStatus</method-return-value>
                 <wsdl-message xmlns:wsdlMsgNS="InboundWebService">wsdlMsgNS:MessageEndPoint_processMessageResponse</wsdl-message>
                 <wsdl-message-part-name>result</wsdl-message-part-name>
                 </wsdl-return-value-mapping>
                 </service-endpoint-method-mapping>
                 </service-endpoint-interface-mapping>
                </java-wsdl-mapping>
                


                Thanks again.

                • 5. Re: Unmarshalling Exception with Web Service Array Input
                  asoldano

                  OK, you might evaluate using a little workaround, i.e. having a jaxws ejb3 endpoint in front of your ejb2 and delegating to it.

                  Btw I don't see anything obviously wrong with your wsdl/mapping/file; you might try using jbossws wstool to generate jax-rpc artifacts and compare them with the ones you get from wscompile. In case you still have problems and upgrading to jaxws (even using the suggested workaround) is not an option, you could create a jira issue attaching a small application affected by this problem.
                  Anyway please consider that actually jbossws team main focus is on the jax-ws issues.

                  • 6. Re: Unmarshalling Exception with Web Service Array Input
                    sumitsu

                    I tried using wstools to generate the WSDL, and although there were some differences, notably in that wstools split the schema in two and imported one schema into the other, the stack trace upon invocation did not change at all. I did notice that wstools, unlike wscompile, did not create LiteralSerializers and request/response struct classes, but it may just be that I don't have the settings on wstools to keep source artifacts enabled; I'm not sure.

                    What I would really like to know is where it is coming up with the com.liaison.InboundWebService.messageProcessing.Array class reference for which the "No ClassLoaders found" exception is being thrown -- I don't recall ever seeing a wscompile/wstools artifact by that name, nor can I find any such references in any of the generated files. Do you know where that comes from, or why it expects that class to exist? I would think that if I could find that out, it might help find the root cause of the problem.

                    Thanks again for your help.