[jboss-user] [JBoss Web Services Users] - Re: OutOfMemory exception when loading xml schemas in WSDL

wellerk do-not-reply at jboss.com
Thu Oct 1 19:21:52 EDT 2009


Still had issues with deploying complex hl7 webservice.  Here is a patch to WSDL11Reader (version 3.1.1) that solved my HL7V3 issues:


  | --- WSDL11Reader.java	2009-09-25 13:06:36.847867600 -0400
  | +++ WSDL11Reader.java.new	2009-10-01 18:46:58.741045900 -0400
  | @@ -145,6 +145,8 @@
  |  
  |     // Temporary files used by this reader.
  |     private List<File> tempFiles = new ArrayList<File>();
  | +   private Map<String, String> publocation = new HashMap<String, String>();
  | +   private List<String> published = new ArrayList<String>();
  |  
  |     // SWA handling
  |     private Map<QName, List<String>> skippedSWAParts = new HashMap<QName, List<String>>();
  | @@ -423,7 +425,6 @@
  |              String localname = domElementClone.getLocalName();
  |              try
  |              {
  | -               List<URL> published = new LinkedList<URL>();
  |                 if ("import".equals(localname))
  |                 {
  |                    processSchemaImport(destTypes, wsdlLoc, domElementClone, published);
  | @@ -436,8 +437,8 @@
  |                 {
  |                    throw new IllegalArgumentException("Unsuported schema element: " + localname);
  |                 }
  | -               published.clear();
  | -               published = null;
  | +//               published.clear();
  | +//               published = null;
  |              }
  |              catch (IOException e)
  |              {
  | @@ -529,7 +530,7 @@
  |        }
  |     }
  |  
  | -   private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl, List<URL> published) throws IOException, WSDLException
  | +   private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl, List<String> published) throws IOException, WSDLException
  |     {
  |        if (wsdlLoc == null)
  |           throw new IllegalArgumentException("Cannot process import, parent location not set");
  | @@ -542,16 +543,25 @@
  |  
  |        URL locationURL = getLocationURL(wsdlLoc, location);
  |        Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
  | -      if (!published.contains(locationURL))
  | +      if (!published.contains(locationURL.toExternalForm()))
  |        {
  | -         published.add(locationURL);
  | +         published.add(locationURL.toExternalForm());
  |           URL newloc = processSchemaInclude(types, locationURL, rootElement,  published);
  | -         if (newloc != null)
  | +         if (newloc != null) {
  |              importEl.setAttribute("schemaLocation", newloc.toExternalForm());
  | +            publocation.put(locationURL.toExternalForm(), newloc.toExternalForm());
  | +         }
  | +      }
  | +      else {
  | +          if (publocation.containsKey(locationURL.toExternalForm())) {
  | +              if (publocation.get(locationURL.toExternalForm()) != null) {
  | +                 importEl.setAttribute("schemaLocation", (String)publocation.get(locationURL));          
  | +              }
  | +          }
  |        }
  |     }
  |  
  | -   private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl, List<URL> published) throws IOException, WSDLException
  | +   private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl, List<String> published) throws IOException, WSDLException
  |     {
  |        if (wsdlLoc == null)
  |           throw new IllegalArgumentException("Cannot process iclude, parent location not set");
  | @@ -580,12 +590,21 @@
  |  
  |           URL locationURL = getLocationURL(wsdlLoc, location);
  |           Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
  | -         if (!published.contains(locationURL))
  | +         if (!published.contains(locationURL.toExternalForm()))
  |           {
  | -            published.add(locationURL);
  | +            published.add(locationURL.toExternalForm());
  |              URL newloc = processSchemaInclude(types, locationURL, rootElement, published);
  | -            if (newloc != null)
  | +            if (newloc != null) {
  |                 includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
  | +                publocation.put(locationURL.toExternalForm(),newloc.toExternalForm());
  | +            }
  | +         }
  | +         else {
  | +             if (publocation.containsKey(locationURL.toExternalForm())) {
  | +                 if (publocation.get(locationURL.toExternalForm()) != null) {
  | +                    includeEl.setAttribute("schemaLocation", (String)publocation.get(locationURL));
  | +                 }
  | +             }
  |           }
  |        }
  |  
  | 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4258296#4258296

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4258296



More information about the jboss-user mailing list