Package org.jboss.ws.tools

Examples of org.jboss.ws.tools.WSDLToJava$WrappedArray


   }  

   /** Test a simple SEI that uses primitives */
   public void testSimpleCase() throws Exception
   {
      WSDLToJava wsdlJava = new WSDLToJava();
      File wsdlFile = getResourceFile("tools/jbws-161/wscompile/simple/wsdl/HelloWsService.wsdl");
      wsdlJava.setTypeMapping(new LiteralTypeMapping());
      WSDLDefinitions wsdl = wsdlJava.convertWSDL2Java(wsdlFile.toURL());
      wsdlJava.generateSEI(wsdl, createResourceFile("tools/jbws-160/jbossws/simple/sei"));

      //Create the Service File
      //Generate the Service Interface
      ServiceCreator sc = new ServiceCreator();
      sc.setPackageName("org.jboss.types");
View Full Code Here


   private void generateSEI(WSDLDefinitions wsdl)
   {
      File seidir = createResourceFile("tools");
      seidir.mkdirs();
      WSDLToJavaIntf wsdljava = new WSDLToJava();

      //Generate the SEI
      try
      {
         wsdljava.setTypeMapping(new LiteralTypeMapping());
         wsdljava.generateSEI(wsdl, seidir);
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
View Full Code Here

   }

   /** Test a custom SEI that uses custom types */
   public void testCustomCase() throws Exception
   {
      WSDLToJava wsdlJava = new WSDLToJava();
      File wsdlFile = getResourceFile("tools/jbws-161/wscompile/custom/wsdl/HelloCustomService.wsdl");
      wsdlJava.setTypeMapping(new LiteralTypeMapping());
      WSDLDefinitions wsdl = wsdlJava.convertWSDL2Java(wsdlFile.toURL());
      wsdlJava.setTypeMapping(new LiteralTypeMapping());
      wsdlJava.generateSEI(wsdl, createResourceFile("tools/jbws-160/jbossws/custom/sei"));

      //Create the Service File
      //Generate the Service Interface
      ServiceCreator sc = new ServiceCreator();
      sc.setPackageName("org.jboss.types");
View Full Code Here

   private void generateSEI(WSDLDefinitions wsdl)
   {
      String seidir = "tools";

      WSDLToJavaIntf wsdljava = new WSDLToJava();

      //Generate the SEI
      try
      {
         wsdljava.setTypeMapping(new LiteralTypeMapping());
         wsdljava.generateSEI(wsdl, createResourceFile(seidir));
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
View Full Code Here

      String filename = "StandardJavaTypesService_DOC_11.wsdl";
      File wsdlFile = getResourceFile("tools/wsdlfixture/" + filename);
      WSDLTypes types = null;
      try
      {
         WSDLToJavaIntf wsdljava = new WSDLToJava();
         wsdljava.setTypeMapping(new LiteralTypeMapping());
         WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());
         types = wsdl.getWsdlTypes();
      }
      catch (IOException e)
      {
         e.printStackTrace();
View Full Code Here

      String filename = "StandardJavaTypesService_DOC_11.wsdl";
      File wsdlFile = getResourceFile("tools/wsdlfixture/" + filename);
      WSDLTypes types = null;
      try
      {
         WSDLToJavaIntf wsdljava = new WSDLToJava();
         wsdljava.setTypeMapping(new LiteralTypeMapping());
         WSDLDefinitions wsdl = wsdljava.convertWSDL2Java(wsdlFile.toURL());
         types = wsdl.getWsdlTypes();
      }
      catch (IOException e)
      {
         e.printStackTrace();
View Full Code Here

   public void handleWSDLToJavaGeneration(Configuration config, String outDir)
   {
      WSDLToJavaConfig w2jc = config.getWSDLToJavaConfig(false);
      GlobalConfig glc = config.getGlobalConfig(false);

      WSDLToJava wsdlToJava = new WSDLToJava();
      wsdlToJava.setTypeMapping(new LiteralTypeMapping());
      wsdlToJava.setGenerateSerializableTypes(w2jc.serializableTypes);

      WSDLDefinitions wsdl = null;
      try
      {
         URL wsdlURL = null;
         try
         {
            wsdlURL = new URL(w2jc.wsdlLocation);
         }
         catch (MalformedURLException e)
         {
            // ignore
         }

         if (wsdlURL == null)
         {
            File wsdlFile = new File(w2jc.wsdlLocation);
            if (wsdlFile.exists())
            {
               wsdlURL = wsdlFile.toURL();
            }
         }

         if (wsdlURL == null)
         {
            ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
            wsdlURL = ctxLoader.getResource(w2jc.wsdlLocation);
         }

         if (wsdlURL == null)
            throw new IllegalArgumentException("Cannot load wsdl: " + w2jc.wsdlLocation);

         wsdl = wsdlToJava.convertWSDL2Java(wsdlURL);
         if (glc != null)
            wsdlToJava.setNamespacePackageMap(glc.packageNamespaceMap);

         wsdlToJava.setParameterStyle(w2jc.parameterStyle);
         wsdlToJava.generateSEI(wsdl, new File(outDir));

         //Generate the Service File
         this.generateServiceFile(getPackageName(wsdl, glc), wsdl, outDir);

         //Generate the Mapping File
         if (w2jc.mappingFileNeeded)
         {
            MappingFileGenerator mgf = new MappingFileGenerator(wsdl, new LiteralTypeMapping());
            if (glc != null && glc.packageNamespaceMap != null)
               mgf.setNamespacePackageMap(glc.packageNamespaceMap);       
            mgf.setServiceName(wsdl.getServices()[0].getName().getLocalPart());
            mgf.setParameterStyle(w2jc.parameterStyle);

            JavaWsdlMapping jwm = mgf.generate();
            Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + w2jc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
            writer.write(Constants.XML_HEADER);
            writer.write(DOMWriter.printNode(DOMUtils.parse(jwm.serialize()), true));
            writer.close();
         }

         //Generate the webservices.xml file
         if (w2jc.wsxmlFileNeeded)
         {
            String seiName = "mypackage.MyServiceEndpointInterface";
            String serviceName = "MyServiceName";

            if (wsdl.getServices().length == 1)
               serviceName = wsdl.getServices()[0].getName().getLocalPart();

            if (wsdl.getInterfaces().length == 1)
            {
               String seiPackage = getPackageName(wsdl, glc);
               seiName = seiPackage + "." + wsdlToJava.getServiceEndpointInterfaceName(wsdl.getInterfaces()[0]);
            }

            WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl();
            wscr.setTargetNamespace(wsdl.getTargetNamespace());
            wscr.setSeiName(seiName);
View Full Code Here

   public void handleWSDLToJavaGeneration(Configuration config, String outDir)
   {
      WSDLToJavaConfig w2jc = config.getWSDLToJavaConfig(false);
      GlobalConfig glc = config.getGlobalConfig(false);

      WSDLToJava wsdlToJava = new WSDLToJava();
      wsdlToJava.setTypeMapping(new LiteralTypeMapping());

      WSDLDefinitions wsdl = null;
      try
      {
         URL wsdlURL = null;
         try
         {
            wsdlURL = new URL(w2jc.wsdlLocation);
         }
         catch (MalformedURLException e)
         {
            // ignore
         }

         if (wsdlURL == null)
         {
            File wsdlFile = new File(w2jc.wsdlLocation);
            if (wsdlFile.exists())
            {
               wsdlURL = wsdlFile.toURL();
            }
         }

         if (wsdlURL == null)
         {
            ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
            wsdlURL = ctxLoader.getResource(w2jc.wsdlLocation);
         }

         if (wsdlURL == null)
            throw new IllegalArgumentException("Cannot load wsdl: " + w2jc.wsdlLocation);

         wsdl = wsdlToJava.convertWSDL2Java(wsdlURL);
         if (glc != null)
            wsdlToJava.setNamespacePackageMap(glc.packageNamespaceMap);

         wsdlToJava.setParameterStyle(w2jc.parameterStyle);
         wsdlToJava.generateSEI(wsdl, new File(outDir));

         //Generate the Service File
         this.generateServiceFile(getPackageName(wsdl, glc), wsdl, outDir);

         //Generate the Mapping File
         if (w2jc.mappingFileNeeded)
         {
            MappingFileGenerator mgf = new MappingFileGenerator(wsdl, new LiteralTypeMapping());
            if (glc != null && glc.packageNamespaceMap != null)
               mgf.setNamespacePackageMap(glc.packageNamespaceMap);       
            mgf.setServiceName(wsdl.getServices()[0].getName().getLocalPart());
            mgf.setParameterStyle(w2jc.parameterStyle);

            JavaWsdlMapping jwm = mgf.generate();
            Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + w2jc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
            writer.write(Constants.XML_HEADER);
            writer.write(DOMWriter.printNode(DOMUtils.parse(jwm.serialize()), true));
            writer.close();
         }

         //Generate the webservices.xml file
         if (w2jc.wsxmlFileNeeded)
         {
            String seiName = "mypackage.MyServiceEndpointInterface";
            String serviceName = "MyServiceName";

            if (wsdl.getServices().length == 1)
               serviceName = wsdl.getServices()[0].getName().getLocalPart();

            if (wsdl.getInterfaces().length == 1)
            {
               String seiPackage = getPackageName(wsdl, glc);
               seiName = seiPackage + "." + wsdlToJava.getServiceEndpointInterfaceName(wsdl.getInterfaces()[0]);
            }

            WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl();
            wscr.setTargetNamespace(wsdl.getTargetNamespace());
            wscr.setSeiName(seiName);
View Full Code Here

/*     */   public void handleWSDLToJavaGeneration(Configuration config, String outDir)
/*     */   {
/* 260 */     Configuration.WSDLToJavaConfig w2jc = config.getWSDLToJavaConfig(false);
/* 261 */     Configuration.GlobalConfig glc = config.getGlobalConfig(false);
/*     */
/* 263 */     WSDLToJava wsdlToJava = new WSDLToJava();
/* 264 */     wsdlToJava.setTypeMapping(new LiteralTypeMapping());
/*     */
/* 266 */     WSDLDefinitions wsdl = null;
/*     */     try
/*     */     {
/* 269 */       URL wsdlURL = null;
/*     */       try
/*     */       {
/* 272 */         wsdlURL = new URL(w2jc.wsdlLocation);
/*     */       }
/*     */       catch (MalformedURLException e)
/*     */       {
/*     */       }
/*     */
/* 279 */       if (wsdlURL == null)
/*     */       {
/* 281 */         File wsdlFile = new File(w2jc.wsdlLocation);
/* 282 */         if (wsdlFile.exists())
/*     */         {
/* 284 */           wsdlURL = wsdlFile.toURL();
/*     */         }
/*     */       }
/*     */
/* 288 */       if (wsdlURL == null)
/*     */       {
/* 290 */         ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
/* 291 */         wsdlURL = ctxLoader.getResource(w2jc.wsdlLocation);
/*     */       }
/*     */
/* 294 */       if (wsdlURL == null) {
/* 295 */         throw new IllegalArgumentException("Cannot load wsdl: " + w2jc.wsdlLocation);
/*     */       }
/* 297 */       wsdl = wsdlToJava.convertWSDL2Java(wsdlURL);
/* 298 */       if (glc != null) {
/* 299 */         wsdlToJava.setNamespacePackageMap(glc.packageNamespaceMap);
/*     */       }
/* 301 */       wsdlToJava.setParameterStyle(w2jc.parameterStyle);
/* 302 */       wsdlToJava.generateSEI(wsdl, new File(outDir));
/*     */
/* 305 */       generateServiceFile(getPackageName(wsdl, glc), wsdl, outDir);
/*     */
/* 308 */       if (w2jc.mappingFileNeeded)
/*     */       {
/* 310 */         MappingFileGenerator mgf = new MappingFileGenerator(wsdl, new LiteralTypeMapping());
/* 311 */         mgf.setPackageName(getPackageName(wsdl, glc));
/* 312 */         mgf.setServiceName(wsdl.getServices()[0].getName().getLocalPart());
/* 313 */         mgf.setParameterStyle(w2jc.parameterStyle);
/*     */
/* 315 */         JavaWsdlMapping jwm = mgf.generate();
/* 316 */         Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + w2jc.mappingFileName), "UTF-8");
/* 317 */         writer.write("<?xml version='1.0' encoding='UTF-8'?>");
/* 318 */         writer.write(DOMWriter.printNode(DOMUtils.parse(jwm.serialize()), true));
/* 319 */         writer.close();
/*     */       }
/*     */
/* 323 */       if (w2jc.wsxmlFileNeeded)
/*     */       {
/* 325 */         String seiName = "mypackage.MyServiceEndpointInterface";
/* 326 */         String serviceName = "MyServiceName";
/*     */
/* 328 */         if (wsdl.getServices().length == 1) {
/* 329 */           serviceName = wsdl.getServices()[0].getName().getLocalPart();
/*     */         }
/* 331 */         if (wsdl.getInterfaces().length == 1)
/*     */         {
/* 333 */           String seiPackage = getPackageName(wsdl, glc);
/* 334 */           seiName = seiPackage + "." + wsdlToJava.getServiceEndpointInterfaceName(wsdl.getInterfaces()[0]);
/*     */         }
/*     */
/* 337 */         WebservicesXMLCreator wscr = new WebservicesXMLCreatorImpl();
/* 338 */         wscr.setTargetNamespace(wsdl.getTargetNamespace());
/* 339 */         wscr.setSeiName(seiName);
View Full Code Here

TOP

Related Classes of org.jboss.ws.tools.WSDLToJava$WrappedArray

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.