0 Replies Latest reply on Feb 25, 2009 2:56 AM by toma25

    Webservice problem with base64 data when upgrading to JBoss

      Hi,
      This is a long one du to config files...
      I'm running a upgrade from JBoss 4.0.5 to 4.2.3
      The system I work with have a legacy webservice. It is based on J2EE webservices 1.1.
      It has a SLSB (EJB2) as endpoint.
      The WSDL file points out a schema (XSD-file) file for the definition of the parameters to the webservice.
      And there is a mapping file which maps to the schema.

      The problem:
      For starters, the service works in JBoss 4.0.5.
      In 4.2.3 it works perfectly fine for except for a attachment element, the base64 data doesn't convert properly into a byte array. Changing it to string works fine, so there is no problem with typos, it just won't convert into a byte array.
      Has anyone had a similar problem when upgrading from 4.0.5 to 4.2.3?

      If i remove an attachments from the call, it works fine, but if I have one, if fails with:

      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 target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1f1804d({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
       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.SOAPContentElement.transitionTo(SOAPContentElement.java:141)
       at org.jboss.ws.core.soap.SOAPBodyElementDoc.transitionTo(SOAPBodyElementDoc.java:85)
       at org.jboss.ws.core.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:173)
       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:221)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:466)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:284)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:201)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:134)
       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:182)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
       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.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393)
       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:619)
      Caused by: org.jboss.ws.core.binding.BindingException: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException: Failed to parse source:
      Failed to resolve target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369863({http://foo/newsws/t
      ypes}attachment, type={http://foo/newsws/types}AttachmentElementType)
       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)
       ... 36 more
      Caused by: org.jboss.ws.core.jaxrpc.binding.jbossxb.UnmarshalException: Failed to parse source: Failed to resolve target property type on or
      g.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
       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)
       ... 39 more
      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to resolve target property type on org.jboss.xb.binding.sun
      day.unmarshalling.ElementBinding@1369863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}Attach
      mentElementType)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:179)
       at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:126)
       at org.jboss.ws.core.jaxrpc.binding.jbossxb.JBossXBUnmarshallerImpl.unmarshal(JBossXBUnmarshallerImpl.java:61)
       ... 40 more
      Caused by: org.jboss.ws.WSException: Failed to resolve target property type on org.jboss.xb.binding.sunday.unmarshalling.ElementBinding@1369
      863({http://foo/newsws/types}attachment, type={http://foo/newsws/types}AttachmentElementType)
       at org.jboss.ws.extensions.xop.jaxrpc.JBossXBContentAdapter.beforeSetParent(JBossXBContentAdapter.java:115)
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.endElement(SundayContentHandler.java:1005)
       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.endElement(SundayContentHandler.java:246)
       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.endElement(SaxJBossXBParser.java:296)
       at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
       at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(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:175)
       ... 42 more



      this is the webservices.xml

      <webservice-description>
       <webservice-description-name>FooService</webservice-description-name>
       <wsdl-file>META-INF/wsdl/FooService.wsdl</wsdl-file>
       <jaxrpc-mapping-file>META-INF/FooService-mapping.xml</jaxrpc-mapping-file>
       <port-component>
       <port-component-name>FooService</port-component-name>
       <wsdl-port>FooServicePort</wsdl-port>
       <service-endpoint-interface>com.foo.FooServiceEndpoint</service-endpoint-interface>
       <service-impl-bean>
       <ejb-link>FooServiceBean</ejb-link>
      
       </service-impl-bean>
       </port-component>
       </webservice-description>


      From the foo.xsd


      <xs:complexType name="AttachmentElementType">
       <xs:annotation>
       <xs:documentation>Attachment data. When submitting, contains the attachment itself.</xs:documentation>
       </xs:annotation>
       <xs:simpleContent>
       <xs:extension base="xs:base64Binary">
       <xs:attribute name="filename" use="required">
       <xs:annotation>
       <xs:documentation>The filename of the attachment</xs:documentation>
       </xs:annotation>
       </xs:attribute>
       <xs:attribute name="href" type="xs:anyURI" use="optional">
       <xs:annotation>
       <xs:documentation>The URL from which the attachment can be downloaded. Not used when submitting news.</xs:documentation>
       </xs:annotation>
       </xs:attribute>
       <xs:attribute name="mimeType" type="xs:string" use="required">
       <xs:annotation>
       <xs:documentation>The MIME type of the attached file</xs:documentation>
       </xs:annotation>
       </xs:attribute>
       </xs:extension>
       </xs:simpleContent>
       </xs:complexType>


      From FooService-mapping.xml

      <java-xml-type-mapping>
       <java-type>foo.MessageElementType</java-type>
       <root-type-qname xmlns:typeNS='http://foo/newsws/types'>typeNS:MessageElementType</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>category</java-variable-name>
       <xml-element-name>category</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>type</java-variable-name>
       <xml-element-name>type</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>headline</java-variable-name>
       <xml-element-name>headline</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>body</java-variable-name>
       <xml-element-name>body</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>attachment</java-variable-name>
       <xml-element-name>attachment</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>field</java-variable-name>
       <xml-element-name>field</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>


      And Attachment.java looks like this:

      public class AttachmentElementType
       {
      
       protected java.lang.String filename;
      
       protected java.net.URI href;
      
       protected java.lang.String mimeType;
      
       protected byte[] _value;
       public AttachmentElementType(){}
      
       public AttachmentElementType(java.lang.String filename, java.net.URI href, java.lang.String mimeType, byte[] _value){
       this.filename=filename;
       this.href=href;
       this.mimeType=mimeType;
       this._value=_value;
       }
       public java.lang.String getFilename() { return filename ;}
      
       public void setFilename(java.lang.String filename){ this.filename=filename; }
      
       public java.net.URI getHref() { return href ;}
      
       public void setHref(java.net.URI href){ this.href=href; }
      
       public java.lang.String getMimeType() { return mimeType ;}
      
       public void setMimeType(java.lang.String mimeType){ this.mimeType=mimeType; }
      
       public byte[] get_value() { return _value ;}
      
       public void set_value(byte[] _value){ this._value=_value; }
      
       }