7 Replies Latest reply on Oct 12, 2006 6:43 PM by thomas.diesler

    Handling anyType

    mauro.mellino

      Hi,

      I have a problem invoking an RPC style service. It used to work on jbossws-1.0.2.GA but now fails on 1.0.3.GA

      My wsdl defines a complex type as:

      <complexType name="ParameterValue">
      <sequence>
      <element name="name" type="string"/>
      <element name="object" nillable="true" type="anyType"/>
      </sequence>
      </complexType>


      and fails with
      org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: The prefix "xsi" for attribute "xsi:type" associated with an element type "object" is not bound. @ *unknown*[1,93]
      at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:100)
      at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:235)
      ... 29 more

      and the incoming soap message is:
      <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
      <soapenv:Header>
      <username soapenv:actor='http://inforsense.com/login' soapenv:mustUnderstand='0' xmlns=''>admin</username>
      <password soapenv:actor='http://inforsense.com/login' soapenv:mustUnderstand='0' xmlns=''>admin</password>
      </soapenv:Header><soapenv:Body>
      <executeService xmlns='http://com.inforsense'>
      <String_1 xmlns=''>/test.group/ServerAPI.folder/Service.project</String_1>
      <String_2 xmlns=''>ServiceOutput</String_2>
      <arrayOfParameterValue_3 xmlns=''/>
      <arrayOfParameterValue_4 xmlns=''>
       <value>
       <name>Sample Size</name>
       <object xsi:type='xsd:int'>3</object>
      </value>
      </arrayOfParameterValue_4>
      </executeService></soapenv:Body></soapenv:Envelope>



      can anyone suggest what has gone wrong or how to fix it?
      Many thanks

        • 1. Re: Handling anyType
          smievoll

          Not much help from me, but I just wan't to confirm that we have two different teams running seperate on installations that got this after upgrading to 1.0.3 on JBAS 4.0.4. We see it with both axis and .net clients. Only difference is that our problem has been with nil values.

          2006-09-07 14:12:44,638 ERROR [http-0.0.0.0-4300-2] [org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper] SOAP request exception
          javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: The prefix "xsi" for attribute "xsi:nil" associated with an element type "ns1:agreementCode" is not bound. @ *unknown*[1,219]
          at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:303)
          at org.jboss.ws.binding.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:233)
          at org.jboss.ws.binding.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:103)
          at org.jboss.ws.binding.EndpointInvocation.getRequestPayload(EndpointInvocation.java:117)
          at org.jboss.ws.integration.jboss.ServiceEndpointInvokerEJB3.invokeServiceEndpoint(ServiceEndpointInvokerEJB3.java:115)
          at org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:115)
          at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:209)
          at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:355)
          at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:115)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
          at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:76)
          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 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
          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.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
          at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
          at org.apache.catalina.valves.FastCommonAccessLogValve.invoke(FastCommonAccessLogValve.java:495)
          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:869)
          at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
          at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
          at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
          at java.lang.Thread.run(Thread.java:595)
          Caused by: org.jboss.ws.binding.BindingException: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: The prefix "xsi" for attribute "xsi:nil" associated with an element type "ns1:agreementCode" is not bound. @ *unknown*[1,219]
          at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:100)
          at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:235)
          ... 30 more
          Caused by: org.jboss.ws.jaxb.UnmarshalException: Failed to parse source: The prefix "xsi" for attribute "xsi:nil" associated with an element type "ns1:agreementCode" is not bound. @ *unknown*[1,219]
          at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:67)
          at org.jboss.ws.jaxrpc.encoding.JAXBDeserializer.deserialize(JAXBDeserializer.java:92)
          ... 31 more
          Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: The prefix "xsi" for attribute "xsi:nil" associated with an element type "ns1:agreementCode" is not bound. @ *unknown*[1,219]
          at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:156)
          at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
          at org.jboss.ws.jaxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:63)
          ... 32 more
          Caused by: org.xml.sax.SAXException: The prefix "xsi" for attribute "xsi:nil" associated with an element type "ns1:agreementCode" is not bound. @ *unknown*[1,219]
          at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$MetaDataErrorHandler.fatalError(SaxJBossXBParser.java:332)
          at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
          at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
          at org.apache.xerces.impl.XMLErrorReporter.reportError(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:152)
          ... 34 more

          • 2. Re: Handling anyType
            thomas.diesler
            • 3. Re: Handling anyType
              centecbertl

              Hi,

              unfortunately I ran into the very same problem when using any of my
              web-services providing methods consuming "<complexType ..." arguments with nillable elements of any type.

              My Environment: JBoss 4.0.4.GA (EJB3-RC8 patch and update to JBossWS 1.0.3 applied/) which takes any web-mehtod argument with nillable elements!

              The problem was introduced with the update to jbossws 1.0.3 (jbossws 1.0.2 had no problem with the very same server and client code)

              Before I start digging into the code or porting my services to a different web-service provider I would like to ask whethere there is any workaround/patch which could be applied until jbossws-1.1.0 for which the fix is scheduled is out?

              - downgrading to jbossws 1.0.2 is not an option due to other problems which were actually fixed with jbossws 1.0.3
              - waiting until Oct. 31 (jbossws 1.1.0 release?) is also no option.

              Many Thanks,
              Bertl

              • 4. Re: Handling anyType
                centecbertl

                Hi again,

                the following patch (against jbossws 1.0.3) is a buggy! hotfix - better call it "hack :-)" which works for me and maybe also for somebody else getting blocked with the problem discussed here:

                Description and Known issues:

                1. This "hotfix" was done in a hurry without analysing the architecture and implementeaion of jbossws. It just adds without any checking the xmlns:xsi namespace to every single soap element which might go to
                the Deserializer.

                2. It is not checked whether the xmlns:xsi attribute is already there or worse pointing to a different name space already! - Clients providing a different xmlns:xsi uril will get bugged out!


                Index: src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java
                ===================================================================
                --- src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java (revision 942)
                +++ src/main/java/org/jboss/ws/soap/DOMEnvelopeBuilder.java (working copy)
                @@ -266,6 +266,7 @@
                
                 private static void redeclareNamespace(Element element)
                 {
                + element.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
                 if(element.getPrefix()== null)
                 element.setAttribute("xmlns", element.getNamespaceURI());
                 else
                
                


                Use with care and have fun,
                Bertl


                • 5. Re: Handling anyType
                  thomas.diesler

                  Thanks for that hack - this its a useful post.

                  The bug will be fixed in 1.0.4 (31-Oct-2006)

                  • 6. Re: Handling anyType

                    I to am affected by this problem. Where can I find instructions on how to get the src and build it.

                    • 7. Re: Handling anyType
                      thomas.diesler

                       

                      svn co https://svn.jboss.org/repos/jbossws/tags/jbossws-1.0.3.SP1
                      


                      http://repository.jboss.com/jboss/jbossws/1.0.3.SP1