[wsas-java-dev] [wsas commit] r24 - wsas/java/trunk/modules/core/src/org/wso2/wsas/util

svn at wso2.com svn at wso2.com
Thu Nov 30 05:32:13 PST 2006


Author: azeez
Date: Thu Nov 30 05:32:12 2006
New Revision: 24

Modified:
   wsas/java/trunk/modules/core/src/org/wso2/wsas/util/HttpGetRequestProcessor.java
Log:
fix for WSAS-81

Modified: wsas/java/trunk/modules/core/src/org/wso2/wsas/util/HttpGetRequestProcessor.java
==============================================================================
--- wsas/java/trunk/modules/core/src/org/wso2/wsas/util/HttpGetRequestProcessor.java	(original)
+++ wsas/java/trunk/modules/core/src/org/wso2/wsas/util/HttpGetRequestProcessor.java	Thu Nov 30 05:32:12 2006
@@ -243,12 +243,15 @@
             String servicePath = serviceContextPath.substring(index + 1,
                                                               serviceContextPath.length());
             if (wsdlType == 0) {
-                ByteArrayOutputStream byteArryaOutStream = new ByteArrayOutputStream();
-
-                axisService.printWSDL(byteArryaOutStream, ip, servicePath);
-                writeSchema(byteArryaOutStream, outputStream, contextRoot,
-                            "annotated-wsdl.xsl");
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
 
+                axisService.printWSDL(baos, ip, servicePath);
+                if (axisService.isWsdlFound() || axisService.isUseUserWSDL()) {
+                    writeDocument(baos, outputStream,
+                                  contextRoot, "annotated-wsdl.xsl");
+                } else {
+                    writeDocument(baos, outputStream, contextRoot, null);
+                }
             } else if (wsdlType == 1) {
                 axisService.printWSDL2(outputStream, ip, servicePath);
             } else {
@@ -482,26 +485,29 @@
                                String contextRoot) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         schema.write(baos);
-        writeSchema(baos, outputStream, contextRoot, "annotated-xsd.xsl");
+        writeDocument(baos, outputStream, contextRoot, "annotated-xsd.xsl");
     }
 
-    private void writeSchema(ByteArrayOutputStream byteArryaOutStream,
-                             OutputStream out, String contextRoot, String annotatedXsl) {
+    private void writeDocument(ByteArrayOutputStream byteArryaOutStream,
+                               OutputStream out, String contextRoot, String annotatedXsl) {
         XMLStreamWriter writer;
 
         try {
             XMLStreamReader reader =
                     XMLInputFactory.newInstance().
-                            createXMLStreamReader(new ByteArrayInputStream(byteArryaOutStream.toByteArray()));
+                            createXMLStreamReader(new ByteArrayInputStream(byteArryaOutStream.
+                                    toByteArray()));
             StAXOMBuilder builder = new StAXOMBuilder(reader);
             OMElement schemaDocument = builder.getDocumentElement();
 
             writer = XMLOutputFactory.newInstance().
                     createXMLStreamWriter(out);
-            writer.writeProcessingInstruction("xml-stylesheet",
-                                              "type=\"text/xsl\" href=\"" +
-                                              contextRoot +
-                                              "/styles/" + annotatedXsl + "\"");
+            if (annotatedXsl != null) {
+                writer.writeProcessingInstruction("xml-stylesheet",
+                                                  "type=\"text/xsl\" href=\"" +
+                                                  contextRoot +
+                                                  "/styles/" + annotatedXsl + "\"");
+            }
 
             schemaDocument.serialize(writer);
             writer.flush();




More information about the Wsas-java-dev mailing list