You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/03/31 06:16:45 UTC

svn commit: r390321 [1/2] - in /webservices/axis2/trunk/java/modules: codegen/ codegen/test-resources/ codegen/test/org/apache/axis2/wsdl/ core/src/org/apache/axis2/deployment/ core/src/org/apache/axis2/deployment/util/ core/src/org/apache/axis2/descri...

Author: deepal
Date: Thu Mar 30 20:16:42 2006
New Revision: 390321

URL: http://svn.apache.org/viewcvs?rev=390321&view=rev
Log:
-WSDL2 AxisService can read and write (?wsdl preserve the original wsdl info)
- adding namespace map into AxisService
- message can have name

Added:
    webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLConstants.java
      - copied, changed from r389982, webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Constants.java
Removed:
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Constants.java
Modified:
    webservices/axis2/trunk/java/modules/codegen/project.xml
    webservices/axis2/trunk/java/modules/codegen/test-resources/dime-doc.wsdl
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/WSDL2AxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2OMBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLTask.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/SchemaGenerator.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOption.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLCommandLineOptionParser.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
    webservices/axis2/trunk/java/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/TypeTable.java

Modified: webservices/axis2/trunk/java/modules/codegen/project.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/project.xml?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/project.xml (original)
+++ webservices/axis2/trunk/java/modules/codegen/project.xml Thu Mar 30 20:16:42 2006
@@ -32,6 +32,11 @@
             <version>${axiom.version}</version>
         </dependency>
         <dependency>
+            <groupId>axis2</groupId>
+            <artifactId>axis2-java2wsdl</artifactId>
+            <version>${pom.currentVersion}</version>
+        </dependency>
+        <dependency>
             <groupId>ws-commons</groupId>
             <artifactId>axiom-impl</artifactId>
             <version>${axiom.version}</version>

Modified: webservices/axis2/trunk/java/modules/codegen/test-resources/dime-doc.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test-resources/dime-doc.wsdl?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test-resources/dime-doc.wsdl (original)
+++ webservices/axis2/trunk/java/modules/codegen/test-resources/dime-doc.wsdl Thu Mar 30 20:16:42 2006
@@ -1,216 +1,266 @@
 <?xml version="1.0" encoding="utf-8"?>
-<wsdl:definitions name="SOAPBuilders" xmlns="http://soapinterop.org/attachments/wsdl" xmlns:types="http://soapinterop.org/attachments/xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:dime="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/" xmlns:content="http://schemas.xmlsoap.org/ws/2002/04/content-type/" xmlns:ref="http://schemas.xmlsoap.org/ws/2002/04/reference/" targetNamespace="http://soapinterop.org/attachments/wsdl">
-	<wsdl:types>
-		<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://soapinterop.org/attachments/xsd" elementFormDefault="qualified" attributeFormDefault="qualified">
-			<import namespace="http://schemas.xmlsoap.org/ws/2002/04/reference/"/>
-			<import namespace="http://schemas.xmlsoap.org/ws/2002/04/content-type/"/>
-			<complexType name="ReferencedBinary">
-				<simpleContent>
-					<restriction base="xsd:base64Binary">
-						<annotation>
-							<appinfo>
-								<content:mediaType value="application/octetstream"/>
-							</appinfo>
-						</annotation>
-						<attribute ref="ref:location" use="optional"/>
-					</restriction>
-				</simpleContent>
-			</complexType>
-			<complexType name="ReferencedText">
-				<simpleContent>
-					<restriction base="xsd:base64Binary">
-						<annotation>
-							<appinfo>
-								<content:mediaType value="text/plain"/>
-							</appinfo>
-						</annotation>
-						<attribute ref="ref:location" use="optional"/>
-					</restriction>
-				</simpleContent>
-			</complexType>
-			<element name="EchoAttachment" type="types:EchoAttachment"/>
-			<element name="EchoAttachmentResponse" type="types:EchoAttachmentResponse"/>
-			<complexType name="EchoAttachment">
-				<sequence>
-					<element name="In" type="types:ReferencedBinary"/>
-				</sequence>
-			</complexType>
-			<complexType name="EchoAttachmentResponse">
-				<sequence>
-					<element name="Out" type="types:ReferencedBinary"/>
-				</sequence>
-			</complexType>
-			<element name="EchoAttachments" type="types:Attachments"/>
-			<element name="EchoAttachmentsResponse" type="types:Attachments"/>
-			<complexType name="Attachments">
-				<sequence>
-					<element name="Item" minOccurs="0" maxOccurs="unbounded" type="types:ReferencedBinary"/>
-				</sequence>
-			</complexType>
-			<element name="EchoAttachmentAsBase64" type="types:EchoAttachment"/>
-			<element name="EchoAttachmentAsBase64Response" type="types:base64Out"/>
-			<element name="EchoBase64AsAttachment" type="types:base64In"/>
-			<element name="EchoBase64AsAttachmentResponse" type="types:EchoAttachmentResponse"/>
-			<complexType name="base64In">
-				<sequence>
-					<element name="In" type="xsd:base64Binary"/>
-				</sequence>
-			</complexType>
-			<complexType name="base64Out">
-				<sequence>
-					<element name="Out" type="xsd:base64Binary"/>
-				</sequence>
-			</complexType>
-			<element name="EchoUnrefAttachments" type="types:emptyType"/>
-			<element name="EchoUnrefAttachmentsResponse" type="types:emptyType"/>
-			<complexType name="emptyType">
-				<sequence/>
-			</complexType>
-			<element name="EchoAttachmentAsString" type="types:EchoAttachmentAsString"/>
-			<element name="EchoAttachmentAsStringResponse" type="types:EchoAttachmentAsStringResponse"/>
-			<complexType name="EchoAttachmentAsString">
-				<sequence>
-					<element name="In" type="types:ReferencedText"/>
-				</sequence>
-			</complexType>
-			<complexType name="EchoAttachmentAsStringResponse">
-				<sequence>
-					<element name="Out" type="xsd:string"/>
-				</sequence>
-			</complexType>
-		</schema>
-	</wsdl:types>
-	<wsdl:message name="EchoAttachmentIn">
-		<wsdl:part name="In" element="types:EchoAttachment"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentOut">
-		<wsdl:part name="Out" element="types:EchoAttachmentResponse"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentsIn">
-		<wsdl:part name="In" element="types:EchoAttachments"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentsOut">
-		<wsdl:part name="Out" element="types:EchoAttachmentsResponse"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentAsBase64In">
-		<wsdl:part name="In" element="types:EchoAttachmentAsBase64"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentAsBase64Out">
-		<wsdl:part name="Out" element="types:EchoAttachmentAsBase64Response"/>
-	</wsdl:message>
-	<wsdl:message name="EchoBase64AsAttachmentIn">
-		<wsdl:part name="In" element="types:EchoBase64AsAttachment"/>
-	</wsdl:message>
-	<wsdl:message name="EchoBase64AsAttachmentOut">
-		<wsdl:part name="Out" element="types:EchoBase64AsAttachmentResponse"/>
-	</wsdl:message>
-	<wsdl:message name="EchoUnrefAttachmentsIn">
-		<wsdl:part name="In" element="types:EchoUnrefAttachments"/>
-	</wsdl:message>
-	<wsdl:message name="EchoUnrefAttachmentsOut">
-		<wsdl:part name="Out" element="types:EchoUnrefAttachmentsResponse"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentAsStringIn">
-		<wsdl:part name="In" element="types:EchoAttachmentAsString"/>
-	</wsdl:message>
-	<wsdl:message name="EchoAttachmentAsStringOut">
-		<wsdl:part name="Out" element="types:EchoAttachmentAsStringResponse"/>
-	</wsdl:message>
-	<wsdl:portType name="AttachmentsPortType">
-		<wsdl:operation name="EchoAttachment">
-			<wsdl:input name="EchoAttachmentInput" message="EchoAttachmentIn"/>
-			<wsdl:output name="EchoAttachmentOutput" message="EchoAttachmentOut"/>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachments">
-			<wsdl:input name="EchoAttachmentsInput" message="EchoAttachmentsIn"/>
-			<wsdl:output name="EchoAttachmentsOutput" message="EchoAttachmentsOut"/>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachmentAsBase64">
-			<wsdl:input name="EchoAttachmentAsBase64Input" message="EchoAttachmentAsBase64In"/>
-			<wsdl:output name="EchoAttachmentAsBase64Output" message="EchoAttachmentAsBase64Out"/>
-		</wsdl:operation>
-		<wsdl:operation name="EchoBase64AsAttachment">
-			<wsdl:input name="EchoBase64AsAttachmentInput" message="EchoBase64AsAttachmentIn"/>
-			<wsdl:output name="EchoBase64AsAttachmentOutput" message="EchoBase64AsAttachmentOut"/>
-		</wsdl:operation>
-		<wsdl:operation name="EchoUnrefAttachments">
-			<wsdl:input name="EchoUnrefAttachmentsInput" message="EchoUnrefAttachmentsIn"/>
-			<wsdl:output name="EchoUnrefAttachmentsOutput" message="EchoUnrefAttachmentsOut"/>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachmentAsString">
-			<wsdl:input name="EchoAttachmentAsStringInput" message="EchoAttachmentAsStringIn"/>
-			<wsdl:output name="EchoAttachmentAsStringOutput" message="EchoAttachmentAsStringOut"/>
-		</wsdl:operation>
-	</wsdl:portType>
-	<wsdl:binding name="AttachmentsBinding" type="AttachmentsPortType">
-		<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
-		<wsdl:operation name="EchoAttachment">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoAttachmentInput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoAttachmentOutput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachments">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoAttachmentsInput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoAttachmentsOutput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachmentAsBase64">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoAttachmentAsBase64Input">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoAttachmentAsBase64Output">
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-		<wsdl:operation name="EchoBase64AsAttachment">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoBase64AsAttachmentInput">
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoBase64AsAttachmentOutput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-		<wsdl:operation name="EchoUnrefAttachments">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoUnrefAttachmentsInput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoUnrefAttachmentsOutput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-		<wsdl:operation name="EchoAttachmentAsString">
-			<soap:operation soapAction="http://soapinterop.org/attachments/"/>
-			<wsdl:input name="EchoAttachmentAsStringInput">
-				<dime:message layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout" wsdl:required="true"/>
-				<soap:body use="literal"/>
-			</wsdl:input>
-			<wsdl:output name="EchoAttachmentAsStringOutput">
-				<soap:body use="literal"/>
-			</wsdl:output>
-		</wsdl:operation>
-	</wsdl:binding>
+<wsdl:definitions name="SOAPBuilders"
+                  xmlns="http://soapinterop.org/attachments/wsdl"
+                  xmlns:types="http://soapinterop.org/attachments/xsd"
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+                  xmlns:dime="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
+                  xmlns:content="http://schemas.xmlsoap.org/ws/2002/04/content-type/"
+                  xmlns:ref="http://schemas.xmlsoap.org/ws/2002/04/reference/"
+                  targetNamespace="http://soapinterop.org/attachments/wsdl">
+    <wsdl:types>
+        <schema xmlns="http://www.w3.org/2001/XMLSchema"
+                targetNamespace="http://soapinterop.org/attachments/xsd"
+                elementFormDefault="qualified" attributeFormDefault="qualified">
+            <import namespace="http://schemas.xmlsoap.org/ws/2002/04/reference/"/>
+            <import namespace="http://schemas.xmlsoap.org/ws/2002/04/content-type/"/>
+            <complexType name="ReferencedBinary">
+                <simpleContent>
+                    <restriction base="xsd:base64Binary">
+                        <annotation>
+                            <appinfo>
+                                <content:mediaType
+                                        value="application/octetstream"/>
+                            </appinfo>
+                        </annotation>
+                        <attribute ref="ref:location" use="optional"/>
+                    </restriction>
+                </simpleContent>
+            </complexType>
+            <complexType name="ReferencedText">
+                <simpleContent>
+                    <restriction base="xsd:base64Binary">
+                        <annotation>
+                            <appinfo>
+                                <content:mediaType value="text/plain"/>
+                            </appinfo>
+                        </annotation>
+                        <attribute ref="ref:location" use="optional"/>
+                    </restriction>
+                </simpleContent>
+            </complexType>
+            <element name="EchoAttachment" type="types:EchoAttachment"/>
+            <element name="EchoAttachmentResponse"
+                     type="types:EchoAttachmentResponse"/>
+            <complexType name="EchoAttachment">
+                <sequence>
+                    <element name="In" type="types:ReferencedBinary"/>
+                </sequence>
+            </complexType>
+            <complexType name="EchoAttachmentResponse">
+                <sequence>
+                    <element name="Out" type="types:ReferencedBinary"/>
+                </sequence>
+            </complexType>
+            <element name="EchoAttachments" type="types:Attachments"/>
+            <element name="EchoAttachmentsResponse" type="types:Attachments"/>
+            <complexType name="Attachments">
+                <sequence>
+                    <element name="Item" minOccurs="0" maxOccurs="unbounded"
+                             type="types:ReferencedBinary"/>
+                </sequence>
+            </complexType>
+            <element name="EchoAttachmentAsBase64" type="types:EchoAttachment"/>
+            <element name="EchoAttachmentAsBase64Response"
+                     type="types:base64Out"/>
+            <element name="EchoBase64AsAttachment" type="types:base64In"/>
+            <element name="EchoBase64AsAttachmentResponse"
+                     type="types:EchoAttachmentResponse"/>
+            <complexType name="base64In">
+                <sequence>
+                    <element name="In" type="xsd:base64Binary"/>
+                </sequence>
+            </complexType>
+            <complexType name="base64Out">
+                <sequence>
+                    <element name="Out" type="xsd:base64Binary"/>
+                </sequence>
+            </complexType>
+            <element name="EchoUnrefAttachments" type="types:emptyType"/>
+            <element name="EchoUnrefAttachmentsResponse"
+                     type="types:emptyType"/>
+            <complexType name="emptyType">
+                <sequence/>
+            </complexType>
+            <element name="EchoAttachmentAsString"
+                     type="types:EchoAttachmentAsString"/>
+            <element name="EchoAttachmentAsStringResponse"
+                     type="types:EchoAttachmentAsStringResponse"/>
+            <complexType name="EchoAttachmentAsString">
+                <sequence>
+                    <element name="In" type="types:ReferencedText"/>
+                </sequence>
+            </complexType>
+            <complexType name="EchoAttachmentAsStringResponse">
+                <sequence>
+                    <element name="Out" type="xsd:string"/>
+                </sequence>
+            </complexType>
+        </schema>
+    </wsdl:types>
+    <wsdl:message name="EchoAttachmentIn">
+        <wsdl:part name="In" element="types:EchoAttachment"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentOut">
+        <wsdl:part name="Out" element="types:EchoAttachmentResponse"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentsIn">
+        <wsdl:part name="In" element="types:EchoAttachments"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentsOut">
+        <wsdl:part name="Out" element="types:EchoAttachmentsResponse"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentAsBase64In">
+        <wsdl:part name="In" element="types:EchoAttachmentAsBase64"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentAsBase64Out">
+        <wsdl:part name="Out" element="types:EchoAttachmentAsBase64Response"/>
+    </wsdl:message>
+    <wsdl:message name="EchoBase64AsAttachmentIn">
+        <wsdl:part name="In" element="types:EchoBase64AsAttachment"/>
+    </wsdl:message>
+    <wsdl:message name="EchoBase64AsAttachmentOut">
+        <wsdl:part name="Out" element="types:EchoBase64AsAttachmentResponse"/>
+    </wsdl:message>
+    <wsdl:message name="EchoUnrefAttachmentsIn">
+        <wsdl:part name="In" element="types:EchoUnrefAttachments"/>
+    </wsdl:message>
+    <wsdl:message name="EchoUnrefAttachmentsOut">
+        <wsdl:part name="Out" element="types:EchoUnrefAttachmentsResponse"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentAsStringIn">
+        <wsdl:part name="In" element="types:EchoAttachmentAsString"/>
+    </wsdl:message>
+    <wsdl:message name="EchoAttachmentAsStringOut">
+        <wsdl:part name="Out" element="types:EchoAttachmentAsStringResponse"/>
+    </wsdl:message>
+    <wsdl:portType name="AttachmentsPortType">
+        <wsdl:operation name="EchoAttachment">
+            <wsdl:input name="EchoAttachmentInput" message="EchoAttachmentIn"/>
+            <wsdl:output name="EchoAttachmentOutput"
+                         message="EchoAttachmentOut"/>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachments">
+            <wsdl:input name="EchoAttachmentsInput"
+                        message="EchoAttachmentsIn"/>
+            <wsdl:output name="EchoAttachmentsOutput"
+                         message="EchoAttachmentsOut"/>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachmentAsBase64">
+            <wsdl:input name="EchoAttachmentAsBase64Input"
+                        message="EchoAttachmentAsBase64In"/>
+            <wsdl:output name="EchoAttachmentAsBase64Output"
+                         message="EchoAttachmentAsBase64Out"/>
+        </wsdl:operation>
+        <wsdl:operation name="EchoBase64AsAttachment">
+            <wsdl:input name="EchoBase64AsAttachmentInput"
+                        message="EchoBase64AsAttachmentIn"/>
+            <wsdl:output name="EchoBase64AsAttachmentOutput"
+                         message="EchoBase64AsAttachmentOut"/>
+        </wsdl:operation>
+        <wsdl:operation name="EchoUnrefAttachments">
+            <wsdl:input name="EchoUnrefAttachmentsInput"
+                        message="EchoUnrefAttachmentsIn"/>
+            <wsdl:output name="EchoUnrefAttachmentsOutput"
+                         message="EchoUnrefAttachmentsOut"/>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachmentAsString">
+            <wsdl:input name="EchoAttachmentAsStringInput"
+                        message="EchoAttachmentAsStringIn"/>
+            <wsdl:output name="EchoAttachmentAsStringOutput"
+                         message="EchoAttachmentAsStringOut"/>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="AttachmentsBinding" type="AttachmentsPortType">
+        <soap:binding style="document"
+                      transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="EchoAttachment">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoAttachmentInput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoAttachmentOutput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachments">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoAttachmentsInput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoAttachmentsOutput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachmentAsBase64">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoAttachmentAsBase64Input">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoAttachmentAsBase64Output">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="EchoBase64AsAttachment">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoBase64AsAttachmentInput">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoBase64AsAttachmentOutput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="EchoUnrefAttachments">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoUnrefAttachmentsInput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoUnrefAttachmentsOutput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/open-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+        <wsdl:operation name="EchoAttachmentAsString">
+            <soap:operation soapAction="http://soapinterop.org/attachments/"/>
+            <wsdl:input name="EchoAttachmentAsStringInput">
+                <dime:message
+                        layout="http://schemas.xmlsoap.org/ws/2002/04/dime/closed-layout"
+                        wsdl:required="true"/>
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="EchoAttachmentAsStringOutput">
+                <soap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
     <wsdl:service name="DimeDOCInterop">
-	    <wsdl:port name="DimeDOCSoapPort" binding="AttachmentsBinding">
-            <soap:address location="http://localhost:8080/axis/services/DimeDOCSoapPort"/>
+        <wsdl:port name="DimeDOCSoapPort" binding="AttachmentsBinding">
+            <soap:address
+                    location="http://localhost:8080/axis/services/DimeDOCSoapPort"/>
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>

Added: webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java?rev=390321&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/test/org/apache/axis2/wsdl/WSDLServiceBuilderTest.java Thu Mar 30 20:16:42 2006
@@ -0,0 +1,88 @@
+package org.apache.axis2.wsdl;
+
+import junit.framework.TestCase;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.WSDL2AxisServiceBuilder;
+import org.apache.axis2.engine.ListenerManager;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+*
+*/
+
+public class WSDLServiceBuilderTest extends TestCase {
+
+    private ConfigurationContext configContext;
+    ListenerManager lm;
+
+    protected void setUp() throws Exception {
+        configContext = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
+        lm = new ListenerManager();
+        lm.init(configContext);
+        lm.start();
+    }
+
+    protected void tearDown() throws AxisFault {
+        lm.stop();
+    }
+
+    public void testWSDLClient() throws Exception {
+        File testResourceFile = new File("target/test-classes");
+        File outLocation = new File("target/test-resources");
+        outLocation.mkdirs();
+        if (testResourceFile.exists()) {
+            File files [] = testResourceFile.listFiles();
+            for (int i = 0; i < files.length; i++) {
+                File file1 = files[i];
+                if (file1.isFile() && file1.getName().endsWith(".wsdl")) {
+                    if (file1.getName().equals("ping-modified.wsdl") ||
+                            file1.getName().equals("ping-unbound.wsdl") ||
+                            file1.getName().equals("wsat.wsdl") ||
+                            file1.getName().equals("no-service.wsdl")) {
+                        continue;
+                    }
+                    try {
+                        WSDL2AxisServiceBuilder builder = new WSDL2AxisServiceBuilder(new FileInputStream(file1), null, null);
+                        AxisService service = builder.populateService();
+                        System.out.println("Testinf file: " + file1.getName());
+                        configContext.getAxisConfiguration().addService(service);
+                        System.out.println("");
+                        OutputStream out = new FileOutputStream(new File(outLocation, file1.getName()));
+                        service.printWSDL(out, "http://google.com/axis2/services");
+                        out.flush();
+                        out.close();
+//                        URL wsdlURL = new URL("http://localhost:" + 6060 +
+//                                "/axis2/services/" + service.getName() + "?wsdl");
+//                        builder = new WSDL2AxisServiceBuilder(wsdlURL.openStream(), null, null);
+//                        service = builder.populateService();
+                        configContext.getAxisConfiguration().removeService(service.getName());
+                    } catch (Exception e) {
+                        System.out.println("Error in WSDL : " + file1.getName());
+                        throw e;
+                    }
+
+                }
+            }
+        }
+    }
+}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Thu Mar 30 20:16:42 2006
@@ -23,17 +23,11 @@
 import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.util.PhasesInfo;
 import org.apache.axis2.deployment.util.Utils;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.description.ModuleConfiguration;
-import org.apache.axis2.description.ParameterInclude;
-import org.apache.axis2.description.PolicyInclude;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.MessageReceiver;
 import org.apache.axis2.i18n.Messages;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
@@ -70,25 +64,6 @@
             // Processing service level parameters
             Iterator itr = service_element.getChildrenWithName(new QName(TAG_PARAMETER));
             processParameters(itr, service, service.getParent());
-
-            // Generating schema for the service if the imple class is JAVA
-            if (!service.isWsdlfound()) {
-                //trying to generate WSDL for the service using JAM  and Java refelection
-                try {
-                    Utils.fillAxisService(service, axisConfig);
-                } catch (Exception e) {
-                    /**
-                     * I have log here if some error occours , since service impl
-                     * class can alos be non-java class , so in that case
-                     * it is not posible to generate scheam, so no pint of throwing that
-                     * error ,  I know we have to handle this , untill that I have
-                     * to log this
-                     * TODO : Pls fix this , you are doing worng this here : Deepal
-                     */
-                    log.error(Messages.getMessage("errorinscheamgen", e.getMessage()),e);
-                }
-            }
-
             // process service description
             OMElement descriptionElement =
                     service_element.getFirstChildWithName(new QName(TAG_DESCRIPTION));
@@ -119,6 +94,8 @@
                 if (nameSpeceVale != null && !"".equals(nameSpeceVale)) {
                     service.setTargetNamespace(nameSpeceVale);
                 }
+            } else {
+                service.setTargetNamespace(Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE);
             }
             //Setting schema namespece if any
             OMElement scheamElement = service_element.getFirstChildWithName(new QName(SCHEMA));
@@ -132,6 +109,25 @@
                     }
                 }
             }
+
+            // Generating schema for the service if the imple class is JAVA
+            if (!service.isWsdlfound()) {
+                //trying to generate WSDL for the service using JAM  and Java refelection
+                try {
+                    Utils.fillAxisService(service, axisConfig);
+                } catch (Exception e) {
+                    /**
+                     * I have log here if some error occours , since service impl
+                     * class can alos be non-java class , so in that case
+                     * it is not posible to generate scheam, so no pint of throwing that
+                     * error ,  I know we have to handle this , untill that I have
+                     * to log this
+                     * TODO : Pls fix this , you are doing worng this here : Deepal
+                     */
+                    log.error(Messages.getMessage("errorinscheamgen", e.getMessage()), e);
+                }
+            }
+
             //<schema targetNamespace="http://x.y.z"/>
             // setting the PolicyInclude
             // processing <wsp:Policy> .. </..> elements

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/util/Utils.java Thu Mar 30 20:16:42 2006
@@ -6,19 +6,14 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.deployment.DeploymentException;
-import org.apache.axis2.description.AxisMessage;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisOperationFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Flow;
-import org.apache.axis2.description.HandlerDescription;
-import org.apache.axis2.description.Parameter;
+import org.apache.axis2.description.*;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.engine.Handler;
 import org.apache.axis2.engine.MessageReceiver;
-import org.apache.wsdl.WSDLConstants;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 import org.apache.ws.java2wsdl.SchemaGenerator;
 import org.apache.ws.java2wsdl.utils.TypeTable;
+import org.apache.wsdl.WSDLConstants;
 import org.codehaus.jam.JMethod;
 
 import javax.xml.namespace.QName;
@@ -27,6 +22,8 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
@@ -156,7 +153,7 @@
     public static void fillAxisService(AxisService axisService,
                                        AxisConfiguration axisConfig) throws Exception {
         Parameter implInfoParam = axisService.getParameter(Constants.SERVICE_CLASS);
-        if(implInfoParam == null) {
+        if (implInfoParam == null) {
             // Nothing to do.
             return;
         }
@@ -170,6 +167,14 @@
         JMethod [] method = schemaGenerator.getMethods();
         TypeTable table = schemaGenerator.getTypeTable();
         PhasesInfo pinfo = axisConfig.getPhasesInfo();
+        // adding name spaces
+        Map map = new HashMap();
+        map.put(Java2WSDLConstants.AXIS2_NAMESPACE_PREFIX,
+                Java2WSDLConstants.AXIS2_XSD);
+        map.put(Java2WSDLConstants.DEFAULT_SCHEMA_NAMESPACE_PREFIX,
+                Java2WSDLConstants.URI_2001_SCHEMA_XSD);
+        axisService.setNameSpacesMap(map);
+
 
         for (int i = 0; i < method.length; i++) {
             JMethod jmethod = method[i];
@@ -186,13 +191,15 @@
                 AxisMessage inMessage = operation.getMessage(
                         WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inMessage != null) {
+                    inMessage.setName(opName);
                     inMessage.setElementQName(table.getComplexSchemaType(jmethod.getSimpleName()));
                 }
                 if (!jmethod.getReturnType().isVoidType()) {
                     AxisMessage outMessage = operation.getMessage(
                             WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                     outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
-                            SchemaGenerator.METHOD_RESPONSE_WRAPPER));
+                            Java2WSDLConstants.RESPONSE));
+                    outMessage.setName(opName + Java2WSDLConstants.RESPONSE);
                 }
             } else {
                 operation = getAxisOperationforJmethod(jmethod, table);
@@ -207,12 +214,12 @@
                 pinfo.setOperationPhases(operation);
                 axisService.addOperation(operation);
             }
-
+            operation.setSoapAction("urn:" + opName);
         }
     }
 
     public static AxisOperation getAxisOperationforJmethod(JMethod jmethod,
-                                                            TypeTable table) throws AxisFault {
+                                                           TypeTable table) throws AxisFault {
         AxisOperation operation;
         String opName = jmethod.getSimpleName();
         if ("init".equals(opName)) {
@@ -225,7 +232,7 @@
             AxisMessage outMessage = operation.getMessage(
                     WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
             outMessage.setElementQName(table.getQNamefortheType(jmethod.getSimpleName() +
-                    SchemaGenerator.METHOD_RESPONSE_WRAPPER));
+                    Java2WSDLConstants.RESPONSE));
         }
 
         operation.setName(new QName(opName));

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisMessage.java Thu Mar 30 20:16:42 2006
@@ -32,6 +32,7 @@
  */
 public class AxisMessage extends AxisDescription {
     private ArrayList handlerChain;
+    private String name;
 
     //to keep data in WSDL message refference and to keep the Java2WSDL data
     // such as SchemaElementName , direction etc.
@@ -105,5 +106,13 @@
             }
         }
         return null;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisOperation.java Thu Mar 30 20:16:42 2006
@@ -54,6 +54,8 @@
 
     private ArrayList wsamappingList;
 
+    private String soapAction;
+
     public AxisOperation() {
         mepURI = MEP_URI_IN_OUT;
         modulerefs = new ArrayList();
@@ -503,5 +505,13 @@
 
     public void setFaultMessages(AxisMessage faultMessage) {
         faultMessages.add(faultMessage);
+    }
+
+    public String getSoapAction() {
+        return soapAction;
+    }
+
+    public void setSoapAction(String soapAction) {
+        this.soapAction = soapAction;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Thu Mar 30 20:16:42 2006
@@ -39,6 +39,7 @@
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 import org.apache.ws.java2wsdl.utils.TypeTable;
 import org.apache.wsdl.WSDLConstants;
 import org.codehaus.jam.JMethod;
@@ -64,6 +65,7 @@
  */
 public class AxisService extends AxisDescription {
 
+    private int nsCount = 0;
     private Definition definition = null;
     private Log log = LogFactory.getLog(getClass());
     private String fileName = "";
@@ -105,12 +107,12 @@
     private boolean active = true;
 
     //to keep the service target name space
-    private String targetNamespace = SchemaGenerator.TARGET_NAMESPACE;
-    private String targetNamespacePrefix = SchemaGenerator.TARGET_NAMESPACE_PREFIX;
+    private String targetNamespace = Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE;
+    private String targetNamespacePrefix = Java2WSDLConstants.TARGETNAMESPACE_PREFIX;
 
     // to store the target namespace for the schema
-    private String schematargetNamespace = SchemaGenerator.SCHEMA_TARGET_NAMESPACE;
-    private String schematargetNamespacePrefix = SchemaGenerator.SCHEMA_NAMESPACE_PRFIX;
+    private String schematargetNamespace = Java2WSDLConstants.AXIS2_XSD;
+    private String schematargetNamespacePrefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX;
 
     private boolean enableAllTransport = true;
     private String [] exposeTransports;
@@ -232,8 +234,12 @@
             axisOperation.setMessageReceiver(
                     loadDefaultMessageReceiver(axisOperation.getMessageExchangePattern(), this));
         }
+        if (axisOperation.getSoapAction() == null) {
+            axisOperation.setSoapAction("urn:" + axisOperation.getName().getLocalPart());
+        }
         addChild(axisOperation);
         operationsAliasesMap.put(axisOperation.getName().getLocalPart(), axisOperation);
+        operationsAliasesMap.put(axisOperation.getSoapAction(), axisOperation);
     }
 
 
@@ -350,18 +356,31 @@
 
     public void printSchema(OutputStream out) throws AxisFault {
         for (int i = 0; i < schemaList.size(); i++) {
-            XmlSchema schema = (XmlSchema) schemaList.get(i);
+            XmlSchema schema = addNameSpaces(i);
             schema.write(out);
         }
     }
 
-     public void printSchema(Writer writer) throws AxisFault {
+    public void printSchema(Writer writer) throws AxisFault {
         for (int i = 0; i < schemaList.size(); i++) {
-            XmlSchema schema = (XmlSchema) schemaList.get(i);
+            XmlSchema schema = addNameSpaces(i);
             schema.write(writer);
         }
     }
 
+    private XmlSchema addNameSpaces(int i) {
+        XmlSchema schema = (XmlSchema) schemaList.get(i);
+        Iterator keys = nameSpacesMap.keySet().iterator();
+        Hashtable prefixTable = schema.getPrefixToNamespaceMap();
+        while (keys.hasNext()) {
+            String key = (String) keys.next();
+            if (prefixTable.get(key) == null) {
+                prefixTable.put(key, nameSpacesMap.get(key));
+            }
+        }
+        return schema;
+    }
+
     public void printPolicy(OutputStream out) throws AxisFault {
         PolicyUtil.writePolicy(getPolicyInclude(), out);
     }
@@ -732,7 +751,7 @@
 
     public void setSchema(XmlSchema schema) {
         schemaList.add(schema);
-        //todo : need to support multiple schemas
+        addScheamNameSpace(schema.getTargetNamespace());
     }
 
     public boolean isWsdlfound() {
@@ -1140,5 +1159,25 @@
 
     public void setNameSpacesMap(Map nameSpacesMap) {
         this.nameSpacesMap = nameSpacesMap;
+    }
+
+    private void addScheamNameSpace(String tragetNameSpace) {
+        boolean found = false;
+        if (nameSpacesMap != null && nameSpacesMap.size() > 0) {
+            Iterator itr = nameSpacesMap.values().iterator();
+            while (itr.hasNext()) {
+                String value = (String) itr.next();
+                if (value.equals(tragetNameSpace)) {
+                    found = true;
+                }
+            }
+        }
+        if (nameSpacesMap == null) {
+            nameSpacesMap = new HashMap();
+        }
+        if (!found) {
+            nameSpacesMap.put("ns" + nsCount, tragetNameSpace);
+            nsCount ++;
+        }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java Thu Mar 30 20:16:42 2006
@@ -1,19 +1,23 @@
 package org.apache.axis2.description;
 
+import com.ibm.wsdl.util.xml.DOM2Writer;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.wsdl.WSDLConstants;
+import org.apache.wsdl.WSDLExtensibilityElement;
+import org.apache.wsdl.extensions.*;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamReader;
 import java.io.ByteArrayInputStream;
 import java.io.StringWriter;
+import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.Map;
 /*
 * Copyright 2004,2005 The Apache Software Foundation.
 *
@@ -32,7 +36,7 @@
 *
 */
 
-public class AxisService2OM implements org.apache.ws.java2wsdl.Constants {
+public class AxisService2OM implements org.apache.ws.java2wsdl.Java2WSDLConstants {
 
     private AxisService axisService;
 
@@ -68,21 +72,33 @@
         wsdl = fac.createOMNamespace(WSDL_NAMESPACE,
                 DEFAULT_WSDL_NAMESPACE_PREFIX);
         OMElement ele = fac.createOMElement("definitions", wsdl);
-        ele.declareNamespace(AXIS2_XSD, "ns1");
-        ele.declareNamespace(SCHEMA_NAME_SPACE, DEFAULT_SCHEMA_NAMESPACE_PREFIX);
+        Map nameSpaceMap = axisService.getNameSpacesMap();
+        Iterator keys = nameSpaceMap.keySet().iterator();
+        while (keys.hasNext()) {
+            String key = (String) keys.next();
+            ele.declareNamespace((String) nameSpaceMap.get(key), key);
+        }
         soap = ele.declareNamespace(DEFAULT_SOAP_NAMESPACE, DEFAULT_SOAP_NAMESPACE_PREFIX);
-        tns = ele.declareNamespace(DEFAULT_TARGET_NAMESPACE, TARGETNAMESPACE_PREFIX);
-        ele.addAttribute("targetNamespace", DEFAULT_TARGET_NAMESPACE, null);
+        String prefix = getPrefix(axisService.getTargetNamespace());
+        if(prefix==null||"".equals(prefix)){
+            prefix = DEFAULT_TARGET_NAMESPACE_PREFIX;
+            axisService.getNameSpacesMap().put(prefix,axisService.getTargetNamespace());
+        }
+        tns = ele.declareNamespace(axisService.getTargetNamespace(), prefix);
+
+
+        ele.addAttribute("targetNamespace", axisService.getTargetNamespace(), null);
         OMElement wsdlTypes = fac.createOMElement("types", wsdl);
         StringWriter writer = new StringWriter();
         axisService.printSchema(writer);
-        XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new
+        XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+        XMLStreamReader xmlReader = xmlInputFactory.createXMLStreamReader(new
                 ByteArrayInputStream(writer.toString().getBytes()));
 
         StAXOMBuilder staxOMBuilder = new
                 StAXOMBuilder(fac, xmlReader);
-        wsdlTypes.addChild(staxOMBuilder.getDocumentElement());
         ele.addChild(wsdlTypes);
+        wsdlTypes.addChild(staxOMBuilder.getDocumentElement());
         generateMessages(fac, ele);
         generatePortType(fac, ele);
         generateBinding(fac, ele);
@@ -106,17 +122,8 @@
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
-                    QName scheamElementName = inaxisMessage.getElementQName();
-                    OMElement requestMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
-                    requestMessge.addAttribute(ATTRIBUTE_NAME, scheamElementName.getLocalPart()
-                            + MESSAGE_SUFFIX, null);
-                    defintions.addChild(requestMessge);
-                    OMElement requestPart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
-                    requestMessge.addChild(requestPart);
-                    requestPart.addAttribute(ATTRIBUTE_NAME, "part1", null);
-                    requestPart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
-                            scheamElementName.getPrefix() + ":" + scheamElementName.getLocalPart()
-                                    , null);
+                    writeMessage(inaxisMessage, fac, defintions);
+                    generateHeaderMessages(inaxisMessage, fac, defintions);
                 }
             }
 
@@ -129,26 +136,67 @@
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
-                    QName scheamElementName = outAxisMessage.getElementQName();
-                    OMElement responseMessge = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
-                    responseMessge.addAttribute(ATTRIBUTE_NAME,
-                            scheamElementName.getLocalPart() + MESSAGE_SUFFIX, null);
-                    defintions.addChild(responseMessge);
-                    OMElement responsePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
-                    responseMessge.addChild(responsePart);
-                    responsePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
-                    responsePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
-                            scheamElementName.getPrefix() + ":" + scheamElementName.getLocalPart() , null);
+                    writeMessage(outAxisMessage, fac, defintions);
+                    generateHeaderMessages(outAxisMessage, fac, defintions);
                 }
             }
+
+            // generate fault Messages
+            ArrayList faultyMessages = axisOperation.getFaultMessages();
+            if (faultyMessages != null) {
+                for (int i = 0; i < faultyMessages.size(); i++) {
+                    AxisMessage axisMessage = (AxisMessage) faultyMessages.get(i);
+                    writeMessage(axisMessage, fac, defintions);
+                    generateHeaderMessages(axisMessage, fac, defintions);
+                }
+            }
+        }
+    }
+
+    private void generateHeaderMessages(AxisMessage axismessage, OMFactory fac, OMElement defintions) {
+        ArrayList extList = axismessage.getWsdlExtElements();
+        for (int i = 0; i < extList.size(); i++) {
+            AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                    (AxisExtensiblityElementWrapper) extList.get(i);
+            WSDLExtensibilityElement wsldExteElement = axisExtensiblityElementWrapper.getExtensibilityElement();
+            if (wsldExteElement instanceof SOAPHeader) {
+                SOAPHeader header = (SOAPHeader) wsldExteElement;
+                OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
+                messageElement.addAttribute(ATTRIBUTE_NAME, header.getMessage().getLocalPart()
+                        , null);
+                defintions.addChild(messageElement);
+                OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
+                messageElement.addChild(messagePart);
+                messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
+                messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+                        getPrefix(header.getElement().getNamespaceURI()) + ":" + header.getElement().getLocalPart()
+                        , null);
+            }
         }
     }
 
+    private void writeMessage(AxisMessage axismessage, OMFactory fac, OMElement defintions) {
+        QName scheamElementName = axismessage.getElementQName();
+        OMElement messageElement = fac.createOMElement(MESSAGE_LOCAL_NAME, wsdl);
+        messageElement.addAttribute(ATTRIBUTE_NAME, axismessage.getName()
+                + MESSAGE_SUFFIX, null);
+        defintions.addChild(messageElement);
+        if (scheamElementName != null) {
+            OMElement messagePart = fac.createOMElement(PART_ATTRIBUTE_NAME, wsdl);
+            messageElement.addChild(messagePart);
+            messagePart.addAttribute(ATTRIBUTE_NAME, "part1", null);
+            messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
+                    getPrefix(scheamElementName.getNamespaceURI()) + ":" + scheamElementName.getLocalPart()
+                    , null);
+        }
+
+    }
+
     /**
      * Generate the porttypes
      */
     private void generatePortType(OMFactory fac,
-                                  OMElement defintions) {
+                                  OMElement defintions) throws Exception {
         OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
         defintions.addChild(portType);
         portType.addAttribute(ATTRIBUTE_NAME, axisService.getName() + PORT_TYPE_SUFFIX, null);
@@ -158,9 +206,7 @@
             AxisOperation axisOperation = (AxisOperation) operations.next();
             if (axisOperation.isControlOperation()) {
                 continue;
-
             }
-
             String operationName = axisOperation.getName().getLocalPart();
             OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
             portType.addChild(operation);
@@ -176,11 +222,11 @@
                 AxisMessage inaxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
                 if (inaxisMessage != null) {
-                    QName scheamElementName = inaxisMessage.getElementQName();
                     OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
                     input.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":"
-                            + scheamElementName.getLocalPart() + MESSAGE_SUFFIX, null);
+                            + inaxisMessage.getName() + MESSAGE_SUFFIX, null);
                     operation.addChild(input);
+                    writePortTypePartsExtensibleElements(inaxisMessage, fac, input);
                 }
             }
 
@@ -193,11 +239,44 @@
                 AxisMessage outAxisMessage = axisOperation
                         .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
                 if (outAxisMessage != null) {
-                    QName scheamElementName = outAxisMessage.getElementQName();
                     OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
                     output.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":"
-                            + scheamElementName.getLocalPart() + MESSAGE_SUFFIX, null);
+                            + outAxisMessage.getName() + MESSAGE_SUFFIX, null);
                     operation.addChild(output);
+                    writePortTypePartsExtensibleElements(outAxisMessage, fac, output);
+                }
+            }
+
+            // generate fault Messages
+            ArrayList faultyMessages = axisOperation.getFaultMessages();
+            if (faultyMessages != null) {
+                for (int i = 0; i < faultyMessages.size(); i++) {
+                    AxisMessage faultyMessge = (AxisMessage) faultyMessages.get(i);
+                    OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                    fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix() + ":"
+                            + faultyMessge.getName() + MESSAGE_SUFFIX, null);
+                    fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(), null);
+                    operation.addChild(fault);
+                    writePortTypePartsExtensibleElements(faultyMessge, fac, fault);
+                }
+            }
+        }
+    }
+
+    private void writePortTypePartsExtensibleElements(AxisMessage faultyMessge,
+                                                      OMFactory fac,
+                                                      OMElement output) throws Exception {
+        ArrayList extElementList = faultyMessge.getWsdlExtElements();
+        if (extElementList != null) {
+            Iterator elements = extElementList.iterator();
+            while (elements.hasNext()) {
+                AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                        (AxisExtensiblityElementWrapper) elements.next();
+                if (axisExtensiblityElementWrapper.getType() ==
+                        AxisExtensiblityElementWrapper.PORT_TYPE) {
+                    WSDLExtensibilityElement wsdlextElement =
+                            axisExtensiblityElementWrapper.getExtensibilityElement();
+                    writeExtensibilityElement(wsdlextElement, fac, output);
                 }
             }
         }
@@ -207,7 +286,7 @@
      * Generate the service
      */
     public void generateService(OMFactory fac,
-                                OMElement defintions) {
+                                OMElement defintions) throws Exception {
         OMElement service = fac.createOMElement(SERVICE_LOCAL_NAME, wsdl);
         defintions.addChild(service);
         service.addAttribute(ATTRIBUTE_NAME, axisService.getName(), null);
@@ -220,6 +299,24 @@
                     axisService.getName() + BINDING_NAME_SUFFIX, null);
             addExtensionElemnet(fac, port, SOAP_ADDRESS, LOCATION,
                     urlString);
+
+
+            ArrayList extElementList = axisService.getWsdlExtElements();
+            if (extElementList != null) {
+                Iterator elements = extElementList.iterator();
+                while (elements.hasNext()) {
+                    AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                            (AxisExtensiblityElementWrapper) elements.next();
+                    if (axisExtensiblityElementWrapper.getType() ==
+                            AxisExtensiblityElementWrapper.PORT) {
+                        WSDLExtensibilityElement wsdlextElement =
+                                axisExtensiblityElementWrapper.getExtensibilityElement();
+                        if (!(wsdlextElement instanceof SOAPAddress)) {
+                            writeExtensibilityElement(wsdlextElement, fac, port);
+                        }
+                    }
+                }
+            }
         }
 
 
@@ -229,15 +326,18 @@
      * Generate the bindings
      */
     private void generateBinding(OMFactory fac,
-                                 OMElement defintions) {
+                                 OMElement defintions) throws Exception {
         OMElement binding = fac.createOMElement(BINDING_LOCAL_NAME, wsdl);
         defintions.addChild(binding);
         binding.addAttribute(ATTRIBUTE_NAME, axisService.getName() + BINDING_NAME_SUFFIX, null);
         binding.addAttribute("type", tns.getPrefix() + ":" + axisService.getName() + PORT_TYPE_SUFFIX, null);
 
+        //Adding ext elements
+        writeBindingExtensibleElements(fac, binding);
         addExtensionElemnet(fac, binding, BINDING_LOCAL_NAME,
                 TRANSPORT, TRANSPORT_URI,
                 STYLE, style);
+
         Iterator operations = axisService.getOperations();
         while (operations.hasNext()) {
             AxisOperation axisOperation = (AxisOperation) operations.next();
@@ -248,19 +348,122 @@
             OMElement operation = fac.createOMElement(OPERATION_LOCAL_NAME, wsdl);
             binding.addChild(operation);
             addExtensionElemnet(fac, operation, OPERATION_LOCAL_NAME,
-                    SOAP_ACTION, opeartionName,
+                    SOAP_ACTION, axisOperation.getSoapAction(),
                     STYLE, style);
-            operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null);
+            //writing ext elements
+            writeOperationExtensibleElements(axisOperation, fac, operation);
+
+            String MEP = axisOperation.getMessageExchangePattern();
+
+            if (WSDLConstants.MEP_URI_IN_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+                    WSDLConstants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+                    WSDLConstants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_IN_OUT.equals(MEP)) {
+                AxisMessage inaxisMessage = axisOperation
+                        .getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
+                if (inaxisMessage != null) {
+                    operation.addAttribute(ATTRIBUTE_NAME, opeartionName, null);
+                    OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
+                    addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use, "namespace",
+                            targetNamespace);
+                    operation.addChild(input);
+                    writeBidingPartExtensibleElements(inaxisMessage, fac, input);
+                }
+            }
+
+            if (WSDLConstants.MEP_URI_OUT_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_OUT_OPTIONAL_IN.equals(MEP) ||
+                    WSDLConstants.MEP_URI_IN_OPTIONAL_OUT.equals(MEP) ||
+                    WSDLConstants.MEP_URI_ROBUST_OUT_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_ROBUST_IN_ONLY.equals(MEP) ||
+                    WSDLConstants.MEP_URI_IN_OUT.equals(MEP)) {
+                AxisMessage outAxisMessage = axisOperation
+                        .getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
+                if (outAxisMessage != null) {
+                    OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
+                    addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use, "namespace",
+                            targetNamespace);
+                    operation.addChild(output);
+                    writeBidingPartExtensibleElements(outAxisMessage, fac, output);
+                }
+            }
+
+            // generate fault Messages
+            ArrayList faultyMessages = axisOperation.getFaultMessages();
+            if (faultyMessages != null) {
+                for (int i = 0; i < faultyMessages.size(); i++) {
+                    AxisMessage faultyMessge = (AxisMessage) faultyMessages.get(i);
+                    OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+                    addExtensionElemnet(fac, fault, SOAP_BODY, SOAP_USE, use, "namespace",
+                            targetNamespace);
+                    fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(), null);
+                    operation.addChild(fault);
+                    writeBidingPartExtensibleElements(faultyMessge, fac, fault);
+                }
+            }
+        }
+    }
+
+    private void writeBidingPartExtensibleElements(AxisMessage inaxisMessage,
+                                                   OMFactory fac,
+                                                   OMElement input) throws Exception {
+        ArrayList extElementList;
+        extElementList = inaxisMessage.getWsdlExtElements();
+        if (extElementList != null) {
+            Iterator elements = extElementList.iterator();
+            while (elements.hasNext()) {
+                AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                        (AxisExtensiblityElementWrapper) elements.next();
+                if (axisExtensiblityElementWrapper.getType() ==
+                        AxisExtensiblityElementWrapper.PORT_BINDING) {
+                    WSDLExtensibilityElement wsdlextElement =
+                            axisExtensiblityElementWrapper.getExtensibilityElement();
+                    if (!(wsdlextElement instanceof SOAPBody)) {
+                        writeExtensibilityElement(wsdlextElement, fac, input);
+                    }
+                    if (wsdlextElement instanceof SOAPHeader) {
+                        writeExtensibilityElement(wsdlextElement, fac, input);
+                    }
+
+                }
+            }
+        }
+    }
+
+    private void writeOperationExtensibleElements(AxisOperation axisOperation, OMFactory fac, OMElement operation) throws Exception {
+        ArrayList extElementList;
+        extElementList = axisOperation.getWsdlExtElements();
+        if (extElementList != null) {
+            Iterator elements = extElementList.iterator();
+            while (elements.hasNext()) {
+                AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                        (AxisExtensiblityElementWrapper) elements.next();
+                if (axisExtensiblityElementWrapper.getType() == AxisExtensiblityElementWrapper.PORT_BINDING) {
+                    WSDLExtensibilityElement wsdlextElement = axisExtensiblityElementWrapper.getExtensibilityElement();
+                    if (!(wsdlextElement instanceof SOAPOperation)) {
+                        writeExtensibilityElement(wsdlextElement, fac, operation);
+                    }
+                }
+            }
+        }
+    }
 
-            OMElement input = fac.createOMElement(IN_PUT_LOCAL_NAME, wsdl);
-            addExtensionElemnet(fac, input, SOAP_BODY, SOAP_USE, use, "namespace",
-                    targetNamespace);
-            operation.addChild(input);
-
-            OMElement output = fac.createOMElement(OUT_PUT_LOCAL_NAME, wsdl);
-            addExtensionElemnet(fac, output, SOAP_BODY, SOAP_USE, use, "namespace",
-                    targetNamespace);
-            operation.addChild(output);
+    private void writeBindingExtensibleElements(OMFactory fac, OMElement binding) throws Exception {
+        ArrayList extElementList = axisService.getWsdlExtElements();
+        if (extElementList != null) {
+            Iterator elements = extElementList.iterator();
+            while (elements.hasNext()) {
+                AxisExtensiblityElementWrapper axisExtensiblityElementWrapper =
+                        (AxisExtensiblityElementWrapper) elements.next();
+                if (axisExtensiblityElementWrapper.getType() == AxisExtensiblityElementWrapper.PORT_BINDING) {
+                    WSDLExtensibilityElement wsdlextElement = axisExtensiblityElementWrapper.getExtensibilityElement();
+                    if (!(wsdlextElement instanceof SOAPBinding)) {
+                        writeExtensibilityElement(wsdlextElement, fac, binding);
+                    }
+                }
+            }
         }
     }
 
@@ -282,10 +485,82 @@
                                      String name,
                                      String att1Name,
                                      String att1Value) {
-        OMElement soapbinding = fac.createOMElement(name, soap);
-        element.addChild(soapbinding);
-        soapbinding.addAttribute(att1Name, att1Value, null);
+        OMElement extElement = fac.createOMElement(name, soap);
+        element.addChild(extElement);
+        extElement.addAttribute(att1Name, att1Value, null);
     }
 
+
+    protected void writeExtensibilityElement(WSDLExtensibilityElement extElement, OMFactory fac, OMElement element) throws Exception {
+        if (extElement instanceof SOAPAddress) {
+            addExtensionElemnet(fac, element, SOAP_ADDRESS, LOCATION, ((SOAPAddress) extElement).getLocationURI());
+        } else if (extElement instanceof SOAPBinding) {
+            SOAPBinding soapBinding = (SOAPBinding) extElement;
+            addExtensionElemnet(fac, element, BINDING_LOCAL_NAME, TRANSPORT,
+                    soapBinding.getTransportURI(), STYLE, soapBinding.getStyle());
+        } else if (extElement instanceof SOAPHeader) {
+            SOAPHeader soapHeader = (SOAPHeader) extElement;
+            addSOAPHeader(fac, element, soapHeader);
+        } else if (extElement instanceof SOAPOperation) {
+            SOAPOperation soapop = (SOAPOperation) extElement;
+            addExtensionElemnet(fac, element, OPERATION_LOCAL_NAME, SOAP_ACTION,
+                    soapop.getSoapAction(), STYLE, soapop.getStyle());
+        } else if (extElement instanceof SOAPBody) {
+            SOAPBody soapBody = (SOAPBody) extElement;
+            if (soapBody.getNamespaceURI() != null) {
+                addExtensionElemnet(fac, element, SOAP_BODY, SOAP_USE,
+                        soapBody.getUse(), "namespace", soapBody.getNamespaceURI());
+            } else {
+                addExtensionElemnet(fac, element, SOAP_BODY, SOAP_USE, soapBody.getUse());
+            }
+        } else if (extElement instanceof PolicyExtensibilityElement) {
+            throw new UnsupportedOperationException();
+        } else {
+            if (extElement instanceof DefaultExtensibilityElement) {
+                DefaultExtensibilityElement wsdlExetElement = (DefaultExtensibilityElement) extElement;
+                String wsdl = DOM2Writer.nodeToString(wsdlExetElement.getElement());
+                if (wsdl != null) {
+                    XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+                    XMLStreamReader xmlReader = xmlInputFactory.createXMLStreamReader(new
+                            ByteArrayInputStream(wsdl.getBytes()));
+                    StAXOMBuilder staxOMBuilder = new
+                            StAXOMBuilder(fac, xmlReader);
+                    element.addChild(staxOMBuilder.getDocumentElement());
+                }
+            } else {
+                throw new Exception(" Unknown extensibility element" + extElement.toString());
+            }
+        }
+    }
+
+    private void addSOAPHeader(OMFactory fac, OMElement element,
+                               SOAPHeader header) {
+        OMElement extElement = fac.createOMElement("header", soap);
+        element.addChild(extElement);
+        String use = header.getUse();
+        if (use != null) {
+            extElement.addAttribute("use", use, null);
+        }
+        if (header.part() != null) {
+            extElement.addAttribute("part", header.part(), null);
+        }
+        if (header.getMessage() != null) {
+            extElement.addAttribute("message",
+                    getPrefix(targetNamespace) + ":" +
+                            header.getMessage().getLocalPart(), null);
+        }
+    }
+
+    private String getPrefix(String targetNameSpace) {
+        Map map = axisService.getNameSpacesMap();
+        Iterator keys = map.keySet().iterator();
+        while (keys.hasNext()) {
+            String key = (String) keys.next();
+            if (map.get(key).equals(targetNameSpace)) {
+                return key;
+            }
+        }
+        return null;
+    }
 
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java?rev=390321&r1=390320&r2=390321&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2WOM.java Thu Mar 30 20:16:42 2006
@@ -7,6 +7,7 @@
 import org.apache.ws.policy.PolicyConstants;
 import org.apache.ws.policy.PolicyReference;
 import org.apache.ws.java2wsdl.SchemaGenerator;
+import org.apache.ws.java2wsdl.Java2WSDLConstants;
 import org.apache.wsdl.Component;
 import org.apache.wsdl.MessageReference;
 import org.apache.wsdl.WSDLBinding;
@@ -84,13 +85,13 @@
         if (targetNamespece != null && !targetNamespece.trim().equals("")) {
             this.targetNamespece = targetNamespece;
         } else {
-            this.targetNamespece = SchemaGenerator.TARGET_NAMESPACE;
+            this.targetNamespece = Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE;
         }
         if (targetNamespecheprefix != null
                 && !targetNamespecheprefix.trim().equals("")) {
             this.targetNamespecheprefix = targetNamespecheprefix;
         } else {
-            this.targetNamespecheprefix = SchemaGenerator.TARGET_NAMESPACE_PREFIX;
+            this.targetNamespecheprefix = Java2WSDLConstants.TARGETNAMESPACE_PREFIX;
         }
 
     }