8 Replies Latest reply on Jan 18, 2010 11:37 PM by David Ward

    WSDL import problem with SOAPProxy action

    Leon Doud Newbie

      Hello,

      I'm running into a problem while trying to use the new (ESB 4.7) SOAPProxy action with a WSDL that imports a schema file using a relative path.

      The wsdl attribute of the SOAPProxy contains a http url, http://localhost:8080/services/service_name?wsdl. The imported schema url in the WSDL is ../schema/morestuff.xsd.

      The problem appears to be that when JBossWSDLReaderImpl tries to resolve the url for the imported schema file the path is relative to the root of the default server and not relative to http://localhost:8080/services.

      Here is the stack trace:

      Caused by: java.lang.IllegalArgumentException: Cannot resolve imported resource: file:/D:/tools/jboss-5.1.0.GA_esb4.7/server/..../morestuff.xsd
      at org.jboss.ws.tools.wsdl.WSDLLocatorImpl.getImportInputSource(WSDLLocatorImpl.java:139)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.parseImport(JBossWSDLReaderImpl.java:398)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.parseDefinitions(JBossWSDLReaderImpl.java:322)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2292)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2256)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2309)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2330)
      at org.jboss.ws.tools.wsdl.JBossWSDLReaderImpl.readWSDL(JBossWSDLReaderImpl.java:2362)
      at org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:128)
      at org.jboss.soa.esb.actions.soap.proxy.SOAPProxyWsdlLoader.loadDefinitions(SOAPProxyWsdlLoader.java:102)
      at org.jboss.soa.esb.actions.soap.proxy.SOAPProxy.(SOAPProxy.java:145)

      I'm trying to use SOAPProxy to replace the SOAPClient action that used to do something similiar. The SOAPClient didn't have this issue with the import.

      Any ideas?

      Thanks in advance,
      Leon

        • 1. Re: WSDL import problem with SOAPProxy action
          Hans Wolffenbuttel Expert

          Hi,

          Do you have an import in your xsd with a path and not referenced to the root? I have had a simmilar problem with imports in my xsd that had ../somedir/bla.xsd in stead of ../bla.xsd. If this is the case you could try to put all your xsd into the root of your .esb file and change de references to the root aswell.


          Regards,

          Hans

          • 2. Re: WSDL import problem with SOAPProxy action
            Leon Doud Newbie

            Hans,

            Thanks for the reply. The schema does not have any imports, but I see how your idea applies to import paths in general.

            The WSDL that is being read by the application is on a remote machine deployed by another application. I can't alter the imports. Also the schema files are not in the ESB file since they are part of the remote web service I'm trying to invoke.

            I expect the proper behavior for executing the import would be to use the same protocol that imported WSDL (http) and it should be relative to the path used to import the WSDL. Instead the import is using a different protocol (file) and is relative to the default server deploy directory. This appears to be the way the SOAPClient works.

            Leon

            • 3. Re: WSDL import problem with SOAPProxy action
              Leon Doud Newbie

              Just a little more information....

               

              I browsed the source code to see if there was a configuration option I was missing or misusing, and found what I think the problem is.

               

              The loadDefinitions method of SOAPProxyWsdlLoader calls the newLoader method, which in turn creates a HttpSOAPProxyWsdlLoader (a private inner class) class. The HttpSOAPProxyWsdlLoader copies the WSDL to a local temporary file, and creates the URL to the temporary file. The URL created for the WSDL now references a local file.

               

              So..... I believe the relative imports then try to resolve their URLs relative to the temporary file instead of the real URL of the WSDL. Since the imported schemas used by the WSDL are not copied locally, when the imports are executed they cannot be resolved relative to local temporary file.

              • 4. Re: WSDL import problem with SOAPProxy action
                David Ward Master

                Hi Leon,

                 

                Can you please give me a self-contained example that I can use to create a JIRA and debug this with?  If you can do it relatively quickly, that would be great.  There is the *chance* we might want to get this fixed in our Cummulative Patch branch, if you hurry.

                 

                Thanks,

                David

                 

                PS: I wrote the SOAPProxy action.

                • 5. Re: WSDL import problem with SOAPProxy action
                  Leon Doud Newbie

                  Hi David,

                   

                  Thanks for the response! I'm putting together a simple example right now.

                   

                  Leon

                  • 6. Re: WSDL import problem with SOAPProxy action
                    Leon Doud Newbie

                    David,

                     

                    I'm still working on it. JBoss WS is rewriting the import statement in my WSDL file when deploying the web service. The rewrite changes the import from from relative to absolute and I need a relative path for my import problem.

                     

                    Looks like I need to use something other than JBoss WS, like Axis, otherwise I can't make a WSDL with relative imports.

                     

                    A snipet from my web service class...

                     

                    @WebService(wsdlLocation="/wsdl/BarService.wsdl")
                    public class BarService
                    {

                    ...

                     

                    The import from my BarService.wsdl

                    <import location="../catalog/wsdl/checkAge.wsdl" namespace="http://checkAge"/>

                     

                    The rewritten import statement when I hit the deployed service (http://localhost:8080/BarService/BarService?wsdl)

                    <import location='http://localhost:8080/BarService/BarService?wsdl&amp;resource=../catalog/wsdl/checkAge.wsdl' namespace='http://checkAge'></import>

                    I'll keep working on it and post when I found a way to put relative imports into a WSDL without the rewrites happening.

                    Leon
                    • 7. Re: WSDL import problem with SOAPProxy action
                      David Ward Master

                      Leon,

                       

                      Just checking in.  FYI, I created a jira on this, if you want to "Watch" it:

                      https://jira.jboss.org/jira/browse/JBESB-3076

                       

                      David

                      • 8. Re: WSDL import problem with SOAPProxy action
                        David Ward Master

                        Leon,

                         

                        I've checked in a fix for https://jira.jboss.org/jira/browse/JBESB-3076 .  I also attached a test case to it.

                         

                        Best regards,

                        David