Examples of JavaToWSDL


Examples of org.jboss.ws.tools.JavaToWSDL

    */
   public void testMultiXSD() throws Exception
   {
      String seiName = "org.jboss.test.ws.tools.assertions.sei.MultiXSDInvalidInterface";
      Class seiClass = loadClass(seiName);
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setTargetNamespace("http://org.jboss.ws/types");
      jwsdl.setServiceName(WSDLUtils.getInstance().getJustClassName(seiClass) + "Service");
      try
      {
         jwsdl.generate(loadClass(seiName));
         fail("Test should have failed");
      }
      catch (WSException is)
      {
         //pass
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

    * @throws Exception
    */
   private void assertWSDL11Test(Class seiClass) throws Exception
   {
      String seiName = seiClass.getName();
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setTargetNamespace("http://org.jboss.ws/types");
      jwsdl.setServiceName(WSDLUtils.getInstance().getJustClassName(seiClass) + "Service");
      try
      {
         jwsdl.generate(loadClass(seiName));
         fail("Test should have failed");
      }
      catch (IllegalArgumentException iae)
      {
         //pass
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

   }

   protected WSDLDefinitions generateWSDL(Class seiClass, String serviceName, String wsdlPath, String targetNamespace, String typeNamespace, Style style, Map featureMap)
         throws IOException
   {
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName(serviceName);
      jwsdl.setTargetNamespace(targetNamespace);
      jwsdl.setTypeNamespace(typeNamespace);
      jwsdl.setStyle(style);
      //Add the features
      Iterator keys = featureMap.keySet().iterator();
      while (keys.hasNext())
      {
         String key = (String)keys.next();
         Boolean value = (Boolean)featureMap.get(key);
         jwsdl.addFeature(key, value.booleanValue());
      }
      WSDLDefinitions wsdl = jwsdl.generate(seiClass);
      typeMapping = jwsdl.getTypeMapping();
      return wsdl;
   }
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

      File wsdlDir = createResourceFile("./tools/wsdl-out");
      wsdlDir.mkdirs();
     
      String sname = WSDLUtils.getInstance().getJustClassName(seiClass) + "Service";
      String wsdlPath = wsdlDir + "/" + sname + ".wsdl";
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName(sname);
      jwsdl.setTargetNamespace("http://org.jboss.ws");
      jwsdl.addFeature(WSToolsConstants.WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS, true);
      jwsdl.setStyle(Style.RPC);
      WSDLDefinitions wsdl = jwsdl.generate(seiClass);

      Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), Constants.DEFAULT_XML_CHARSET);
      new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
      fw.close();
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

      }
   }

   public void testStandardHoldersJavaToWsdl() throws Exception
   {
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName("HolderService");
      jwsdl.setTargetNamespace("http://jboss.org/test");
      jwsdl.addFeature(WSToolsConstants.WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS, true);
      jwsdl.setStyle(Style.RPC);
      WSDLDefinitions wsdl = jwsdl.generate(HoldersServiceInterface.class);

      //Generate the wsdl
      File wsdlDir = createResourceFile("tools/");
      wsdlDir.mkdirs();
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

   {
      Class seiClass = TrivialService.class;
      String wsdlDir = createResourceFile("tools/").getAbsolutePath();
      String sname = "SampleService";
      String wsdlPath = wsdlDir+ "/" + sname + ".wsdl";
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName(sname);
      jwsdl.setTargetNamespace("http://org.jboss.ws/samples");
      jwsdl.setTypeNamespace("http://org.jboss.ws/samples/types");
      jwsdl.setStyle(Style.DOCUMENT);
      jwsdl.addFeature(WSToolsConstants.WSTOOLS_FEATURE_RESTRICT_TO_TARGET_NS, true);
      WSDLDefinitions wsdl = jwsdl.generate(seiClass);

      Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), Constants.DEFAULT_XML_CHARSET);
      new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
      fw.close();
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

    * @throws IOException
    */
   public void handleJavaToWSDLGeneration(Configuration config, String outDir) throws IOException
   {
      JavaToWSDLConfig j2wc = config.getJavaToWSDLConfig(false);
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName(j2wc.serviceName);
      jwsdl.setTargetNamespace(j2wc.targetNamespace);
      jwsdl.setTypeNamespace(j2wc.typeNamespace);
      jwsdl.setOperationMap(j2wc.operations);

      if ("document".equals(j2wc.wsdlStyle))
         jwsdl.setStyle(Style.DOCUMENT);
      else if ("rpc".equals(j2wc.wsdlStyle))
         jwsdl.setStyle(Style.RPC);
      else throw new WSException("Unrecognized Style:" + j2wc.wsdlStyle);

      if ("wrapped".equals(j2wc.parameterStyle))
         jwsdl.setParameterStyle(ParameterStyle.WRAPPED);
      else if ("bare".equals(j2wc.parameterStyle))
         jwsdl.setParameterStyle(ParameterStyle.BARE);
      else throw new WSException("Unrecognized Parameter Style:" + j2wc.parameterStyle);

      Class endpointClass = loadClass(j2wc.endpointName);

      if (endpointClass == null)
         throw new WSException("Endpoint " + j2wc.endpointName + " cannot be loaded");

      //Take care of passing global config details
      GlobalConfig gcfg = config.getGlobalConfig(false);
      if (gcfg != null)
      {
         if (gcfg.packageNamespaceMap != null)
            jwsdl.setPackageNamespaceMap(gcfg.packageNamespaceMap);
      }
      WSDLDefinitions wsdl = jwsdl.generate(endpointClass);
      //Create the WSDL Directory
      createDir(outDir + "/wsdl");
      String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName + ".wsdl";
      //Generate the WSDL
      Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), Constants.DEFAULT_XML_CHARSET);
      new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
      fw.close();

      //Generate the Mapping File
      if (j2wc.mappingFileNeeded)
      {
         UnifiedMetaData unifiedMetaData = jwsdl.getUnifiedMetaData();
         JavaWsdlMapping mapping = jwsdl.getJavaWsdlMapping();

         createWrapperTypes(j2wc, outDir, unifiedMetaData, mapping, endpointClass);
         Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + j2wc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
         writer.write(Constants.XML_HEADER);
         writer.write(DOMWriter.printNode(DOMUtils.parse(mapping.serialize()), true));
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

    * @throws IOException
    */
   public void handleJavaToWSDLGeneration(Configuration config, String outDir) throws IOException
   {
      JavaToWSDLConfig j2wc = config.getJavaToWSDLConfig(false);
      JavaToWSDL jwsdl = new JavaToWSDL(Constants.NS_WSDL11);
      jwsdl.setServiceName(j2wc.serviceName);
      jwsdl.setTargetNamespace(j2wc.targetNamespace);
      jwsdl.setTypeNamespace(j2wc.typeNamespace);
      jwsdl.setOperationMap(j2wc.operations);

      if ("document".equals(j2wc.wsdlStyle))
         jwsdl.setStyle(Style.DOCUMENT);
      else if ("rpc".equals(j2wc.wsdlStyle))
         jwsdl.setStyle(Style.RPC);
      else throw new WSException("Unrecognized Style:" + j2wc.wsdlStyle);

      if ("wrapped".equals(j2wc.parameterStyle))
         jwsdl.setParameterStyle(ParameterStyle.WRAPPED);
      else if ("bare".equals(j2wc.parameterStyle))
         jwsdl.setParameterStyle(ParameterStyle.BARE);
      else throw new WSException("Unrecognized Parameter Style:" + j2wc.parameterStyle);

      Class endpointClass = loadClass(j2wc.endpointName);

      if (endpointClass == null)
         throw new WSException("Endpoint " + j2wc.endpointName + " cannot be loaded");

      //Take care of passing global config details
      GlobalConfig gcfg = config.getGlobalConfig(false);
      if (gcfg != null)
      {
         if (gcfg.packageNamespaceMap != null)
            jwsdl.setPackageNamespaceMap(gcfg.packageNamespaceMap);
      }
      WSDLDefinitions wsdl = jwsdl.generate(endpointClass);
      //Create the WSDL Directory
      createDir(outDir + "/wsdl");
      String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName + ".wsdl";
      //Generate the WSDL
      Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), Constants.DEFAULT_XML_CHARSET);
      new WSDLWriter(wsdl).write(fw, Constants.DEFAULT_XML_CHARSET);
      fw.close();

      //Generate the Mapping File
      if (j2wc.mappingFileNeeded)
      {
         UnifiedMetaData unifiedMetaData = jwsdl.getUnifiedMetaData();
         JavaWsdlMapping mapping = jwsdl.getJavaWsdlMapping();

         createWrapperTypes(j2wc, outDir, unifiedMetaData, mapping, endpointClass);
         Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + j2wc.mappingFileName), Constants.DEFAULT_XML_CHARSET);
         writer.write(Constants.XML_HEADER);
         writer.write(DOMWriter.printNode(DOMUtils.parse(mapping.serialize()), true));
View Full Code Here

Examples of org.jboss.ws.tools.JavaToWSDL

/*     */
/*     */   public void handleJavaToWSDLGeneration(Configuration config, String outDir)
/*     */     throws IOException
/*     */   {
/*  90 */     Configuration.JavaToWSDLConfig j2wc = config.getJavaToWSDLConfig(false);
/*  91 */     JavaToWSDL jwsdl = new JavaToWSDL("http://schemas.xmlsoap.org/wsdl/");
/*  92 */     jwsdl.setServiceName(j2wc.serviceName);
/*  93 */     jwsdl.setTargetNamespace(j2wc.targetNamespace);
/*  94 */     jwsdl.setTypeNamespace(j2wc.typeNamespace);
/*  95 */     jwsdl.setOperationMap(j2wc.operations);
/*     */
/*  97 */     if ("document".equals(j2wc.wsdlStyle))
/*  98 */       jwsdl.setStyle(Style.DOCUMENT);
/*  99 */     else if ("rpc".equals(j2wc.wsdlStyle))
/* 100 */       jwsdl.setStyle(Style.RPC);
/* 101 */     else throw new WSException("Unrecognized Style:" + j2wc.wsdlStyle);
/*     */
/* 103 */     if ("wrapped".equals(j2wc.parameterStyle))
/* 104 */       jwsdl.setParameterStyle(SOAPBinding.ParameterStyle.WRAPPED);
/* 105 */     else if ("bare".equals(j2wc.parameterStyle))
/* 106 */       jwsdl.setParameterStyle(SOAPBinding.ParameterStyle.BARE);
/* 107 */     else throw new WSException("Unrecognized Parameter Style:" + j2wc.parameterStyle);
/*     */
/* 109 */     Class endpointClass = loadClass(j2wc.endpointName);
/*     */
/* 111 */     if (endpointClass == null) {
/* 112 */       throw new WSException("Endpoint " + j2wc.endpointName + " cannot be loaded");
/*     */     }
/*     */
/* 115 */     Configuration.GlobalConfig gcfg = config.getGlobalConfig(false);
/* 116 */     if (gcfg != null)
/*     */     {
/* 118 */       if (gcfg.packageNamespaceMap != null)
/* 119 */         jwsdl.setPackageNamespaceMap(gcfg.packageNamespaceMap);
/*     */     }
/* 121 */     WSDLDefinitions wsdl = jwsdl.generate(endpointClass);
/*     */
/* 123 */     createDir(outDir + "/wsdl");
/* 124 */     String wsdlPath = outDir + "/wsdl/" + j2wc.serviceName + ".wsdl";
/*     */
/* 126 */     Writer fw = IOUtils.getCharsetFileWriter(new File(wsdlPath), "UTF-8");
/* 127 */     new WSDLWriter(wsdl).write(fw, "UTF-8");
/* 128 */     fw.close();
/*     */
/* 131 */     if (j2wc.mappingFileNeeded)
/*     */     {
/* 133 */       UnifiedMetaData unifiedMetaData = jwsdl.getUnifiedMetaData();
/* 134 */       JavaWsdlMapping mapping = jwsdl.getJavaWsdlMapping();
/*     */
/* 136 */       createWrapperTypes(j2wc, outDir, unifiedMetaData, mapping, endpointClass);
/* 137 */       Writer writer = IOUtils.getCharsetFileWriter(new File(outDir + "/" + j2wc.mappingFileName), "UTF-8");
/* 138 */       writer.write("<?xml version='1.0' encoding='UTF-8'?>");
/* 139 */       writer.write(DOMWriter.printNode(DOMUtils.parse(mapping.serialize()), true));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.