0 Replies Latest reply on Sep 24, 2007 2:05 PM by Adrian Dimulescu

    mapping java.net.URL

    Adrian Dimulescu Newbie

      Hello,

      On JBoss 4.0.5, I want to expose a webservice that returns objects containing fields of type java.net.URL (note : NOT java.net.URI). I see in the documentation that java.net.URI is mapped by default to xsd:anyURI, not so with java.net.URL.

      I have used wstools.sh to generate jaxrpc-mapping.xml. java.net.URL is mapped there as a complex type :

      <java-xml-type-mapping>
       <java-type>java.net.URL</java-type>
       <root-type-qname xmlns:typeNS='http://fr.bnf.entrychain/types'>typeNS:URL</root-type-qname>
       <qname-scope>complexType</qname-scope>
       <variable-mapping>
       <java-variable-name>authority</java-variable-name>
       <xml-element-name>authority</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>content</java-variable-name>
       <xml-element-name>content</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>defaultPort</java-variable-name>
       <xml-element-name>defaultPort</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>file</java-variable-name>
       <xml-element-name>file</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>host</java-variable-name>
       <xml-element-name>host</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>path</java-variable-name>
       <xml-element-name>path</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>port</java-variable-name>
       <xml-element-name>port</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>protocol</java-variable-name>
       <xml-element-name>protocol</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>query</java-variable-name>
       <xml-element-name>query</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>ref</java-variable-name>
       <xml-element-name>ref</xml-element-name>
       </variable-mapping>
       <variable-mapping>
       <java-variable-name>userInfo</java-variable-name>
       <xml-element-name>userInfo</xml-element-name>
       </variable-mapping>
       </java-xml-type-mapping>


      The generated mapping file is huge, describing object mappings down to java.lang.Object.

      I would of course like to have java.net.URL transparently mapped to either xsd:anyURI or xsd:string.

      As an example, when calling an endpoint that contains the method :

      java.net.URL getWorkArea();


      I get the stacktrace at the end. I obviously serialize things that are not really serializable, despite the fact that it's only a URL.

      I am a bit lost in documentation. Could anybody kindly show me a way of mapping java.net.URL to some simple type ?

      Thank you.


      2007-09-24 16:04:44,944 ERROR doc_ http-0.0.0.0-8080-2 [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/entrychain-services-ejb-NUM_07].[ConfigurationService]] Servlet.service() for servlet ConfigurationService threw exception
      javax.xml.rpc.JAXRPCException: org.jboss.xb.binding.JBossXBRuntimeException: Failed to get value of the property 'classes' defined in class java.io.FileInputStream from instance class java.io.FileInputStream
       at org.jboss.ws.soap.SOAPContentElement.write(SOAPContentElement.java:986)
       at org.jboss.ws.soap.SAAJElementWriter.writeElement(SAAJElementWriter.java:171)
       at org.jboss.ws.soap.SAAJElementWriter.writeElement(SAAJElementWriter.java:184)
       at org.jboss.ws.soap.SAAJElementWriter.writeElement(SAAJElementWriter.java:184)
       at org.jboss.ws.soap.SAAJElementWriter.writeElement(SAAJElementWriter.java:184)
       at org.jboss.ws.soap.SAAJElementWriter.printInternal(SAAJElementWriter.java:163)
       at org.jboss.ws.soap.SAAJElementWriter.print(SAAJElementWriter.java:142)
       at org.jboss.ws.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:266)
       at org.jboss.ws.server.ServiceEndpointManager.sendResponse(ServiceEndpointManager.java:409)
       at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:372)
       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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       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.xb.binding.JBossXBRuntimeException: Failed to get value of the property 'classes' defined in class java.io.FileInputStream from instance class java.io.FileInputStream
       at org.jboss.xb.binding.introspection.FieldInfo.getValue(FieldInfo.java:200)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getJavaValue(MarshallerImpl.java:1220)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getChildren(MarshallerImpl.java:1206)
      
      ...
      
      
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Failed to get value of the property 'content' defined in file:/d:/tmp/work from instance file:/d:/tmp/work
       at org.jboss.xb.binding.introspection.FieldInfo.getValue(FieldInfo.java:200)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getJavaValue(MarshallerImpl.java:1220)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getChildren(MarshallerImpl.java:1206)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.getElementValue(MarshallerImpl.java:1136)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(MarshallerImpl.java:716)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroupSequence(MarshallerImpl.java:920)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalModelGroup(MarshallerImpl.java:860)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalParticle(MarshallerImpl.java:641)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalComplexType(MarshallerImpl.java:608)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementType(MarshallerImpl.java:419)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElement(MarshallerImpl.java:331)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshalElementOccurence(MarshallerImpl.java:311)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshallInternal(MarshallerImpl.java:210)
       at org.jboss.xb.binding.sunday.marshalling.MarshallerImpl.marshal(MarshallerImpl.java:168)
       at org.jboss.ws.jaxb.JBossXBMarshallerImpl.marshal(JBossXBMarshallerImpl.java:146)
       at org.jboss.ws.jaxrpc.encoding.JAXBSerializer.serialize(JAXBSerializer.java:107)
       at org.jboss.ws.soap.SOAPContentElement.getXMLFragment(SOAPContentElement.java:157)
       at org.jboss.ws.soap.SOAPContentElement.expandToDOM(SOAPContentElement.java:817)
       at org.jboss.ws.soap.SOAPContentElement.handleMTOMTransitions(SOAPContentElement.java:1015)
       at org.jboss.ws.soap.SOAPContentElement.write(SOAPContentElement.java:968)
       ... 32 more