[ 
http://jira.codehaus.org/browse/XFIRE-902?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_89307
 ] 

Jeroen Verellen commented on XFIRE-902:
---------------------------------------

I tried to enable jaxb validation using the <service><properties/></service> 
construction. Because I could not get this working I wrote a simple handler 
which enables jaxb validation. It doesn't do much:

        public void invoke(MessageContext ctx) {
                ctx.setProperty(JaxbType.ENABLE_VALIDATION, "true");
        }


The jaxbvalidationFaultHandler is a bit more complex. I added it because I got 
"could not unmarshal type" instead of the xsd validation exception. It looks 
like this:

        public void invoke(MessageContext context) throws Exception {
                AbstractMessage msg = context.getCurrentMessage();
                // check if the current msg is a fault
                if (msg.getBody() instanceof XFireFault) {
                        XFireFault fault = removeUnmarshalFault((XFireFault) 
msg.getBody());
                        msg.setBody(fault);
                }
        }

        public static XFireFault removeUnmarshalFault(XFireFault fault) {
                // check if the cause of the fault is a saxparseex
                if (fault.getCause() == null)
                        return fault;
                if (fault.getCause() instanceof SAXParseException) {
                        return XFireFault.createFault(fault.getCause());
                }
                if (fault.getCause() instanceof MarshalException) {
                        MarshalException ex = (MarshalException) 
fault.getCause();
                        if (ex.getLinkedException() instanceof 
SAXParseException) {
                                return 
XFireFault.createFault(ex.getLinkedException());
                        }
                }
                return fault;
        }



> ResolverWSDLLocator cannot find external xsd
> --------------------------------------------
>
>                 Key: XFIRE-902
>                 URL: http://jira.codehaus.org/browse/XFIRE-902
>             Project: XFire
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.4
>         Environment: tomcat 5.5, sun jvm 1.5.0_10
>            Reporter: Jeroen Verellen
>         Assigned To: Dan Diephouse
>            Priority: Minor
>         Attachments: ObjectServiceFactory.txt, Resolver.txt, 
> ResolverWSDLLocator.txt, ResourceWSDL.txt
>
>
> I have a wsdl document which uses external xsd elements via an import 
> statement.
> My service configuration looks like:
> <service>
>               <name>MCMDemandV1</name>
>               <serviceBean>#mcmDemandServiceV1</serviceBean>
>               <serviceFactory>#jaxbServiceFactory</serviceFactory>
>               <schemas>
>                       <schema>xsd/common/RequestReplyTemplateV1.xsd</schema>
>                       <schema>xsd/mcm/DemandV1.xsd</schema>
>               </schemas>
>               <wsdlURL>classpath:wsdl/mcm/DemandV1.wsdl</wsdlURL>
>               <inHandlers>
>                       <handler
>                               
> handlerClass="be.securex.ws.xfire.JaxbValidationEnablingHandler" />
>               </inHandlers>
>               <faultHandlers>
>                       <handler
>                               
> handlerClass="be.securex.ws.xfire.JaxbValidationFaultHandler" />
>               </faultHandlers>
>       </service>
> When I do not set the wsdl url the server starts and xsd validation works, but
> the wsdl generation does not give a WS-I compliant wsdl.
> When I start up the server with the wsdlurl I get the following:
> Retrieving document at 'null'.
> Retrieving schema at '../../xsd/mcm/DemandV1.xsd'.
> 2007-02-26 13:34:04,953 [main] WARN 
> org.codehaus.xfire.wsdl11.ResolverWSDLLocator - Source:
> ../../xsd/mcm/DemandV1.xsd failed to find input source with exception: 
> java.io.IOException: Could not find resource '../../xsd/mcm/DemandV1.xsd
>       at org.codehaus.xfire.util.Resolver.<init>(Resolver.java:53)
>       at
> org.codehaus.xfire.wsdl11.ResolverWSDLLocator.getImportInputSource
> (ResolverWSDLLocator.java:72)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
>       ...
> And a bit further:
> 2007-02-26 13:34:04,984 [main] ERROR
> org.codehaus.xfire.transport.http.XFireServlet - Error initializing 
> XFireServlet.
> org.springframework.beans.factory.BeanCreationException: Error creating bean
> with name 'org.codehaus.xfire.spring.ServiceBean' defined in class path 
> resource
> [META-INF/xfire/services.xml]: Initialization of bean failed; nested exception
> is org.codehaus.xfire.XFireRuntimeException: Could not load WSDL.. Nested
> exception is
> javax.wsdl.WSDLException: WSDLException (at
> /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: Unable to
> locate with a locator the schema referenced at '../../xsd/mcm/DemandV1.xsd'
> relative to document base 'null'
> org.codehaus.xfire.XFireRuntimeException: Could not load WSDL.. Nested 
> exception
> is javax.wsdl.WSDLException: WSDLException (at
> /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR: Unable to
> locate with a locator the schema referenced at '../../xsd/mcm/DemandV1.xsd'
> relative to document base 'null'
> WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema):
> faultCode=OTHER_ERROR: Unable to locate with a locator the schema referenced 
> at
> '../../xsd/mcm/DemandV1.xsd' relative to document base 'null': 
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseSchema(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseTypes(Unknown Source)
>       at com.ibm.wsdl.xml.WSDLReaderImpl.parseDefinitions(Unknown Source)
>       ...
> I changed some code so that the wsdl is allowed to point to external xsd 
> files. Patches are attached.
> regards,
> jeroen

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to