You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by babloosony <ba...@gmail.com> on 2005/04/04 08:44:53 UTC

How to namespace prefix all elements in soap message

Hi All,

How do I get namespace for all the elements of a soap message. 

Say I am having below soap message generated by AXIS 1.2 RC2 and the
WSDL dynamically generated by axis. As you see there is no namespace
declaration for getDummyBeanReturn element generated by AXIS even
though I have this element in a seperate schema definition with its
own namespace. Please suggest.

soap message
----------------------
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Body>
      <getDummyBeanResponse xmlns="http://DefaultNamespace">
         <getDummyBeanReturn>
            <i>100</i>
            <st>dummystring</st>
         </getDummyBeanReturn>
      </getDummyBeanResponse>
   </soapenv:Body></soapenv:Envelope>



wsdl
--------
<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions
targetNamespace="http://localhost:8090/axis/services/TypesService"
					xmlns:apachesoap="http://xml.apache.org/xml-soap" 
					xmlns:impl="http://localhost:8090/axis/services/TypesService" 
					xmlns:intf="http://localhost:8090/axis/services/TypesService" 
					xmlns:tns1="http://DefaultNamespace" 
					xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
					xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
					xmlns:xsd="http://www.w3.org/2001/XMLSchema"
					xmlns:tns2="http://www.ravi.com/schema/types" >

<!--WSDL created by Apache Axis version: 1.2RC2Built on Nov 16, 2004
(12:19:44 EST)-->
 
 <wsdl:types>
  
	<schema elementFormDefault="qualified" 
			targetNamespace="http://www.ram.com/schema/types" 
			xmlns="http://www.w3.org/2001/XMLSchema">
			
			
		<element name="getDummyBeanReturn" type="tns1:DummyBean"/>
			
	</schema>
	
	<schema elementFormDefault="qualified" 
			targetNamespace="http://DefaultNamespace" 
			xmlns="http://www.w3.org/2001/XMLSchema">
		
		<import namespace="http://xml.apache.org/xml-soap"/>
		<import namespace="http://www.ravi.com/schema/types"/>
		
		
		<complexType name="DummyBean">
			<sequence>
				<element name="i" type="xsd:int"/>
				<element name="st" nillable="true" type="xsd:string"/>
			</sequence>
		</complexType>

		<element name="getHashMap">
			<complexType/>
		</element>
		
		<element name="getHashMapResponse">
			<complexType>
				<sequence>
					<element name="getHashMapReturn" type="apachesoap:Map"/>
				</sequence>
			</complexType>
		</element>
		
		<element name="getDummyBean">
			<complexType/>
		</element>
		
		<element name="getDummyBeanResponse">
			<complexType>
				<sequence>
					<element ref="tns2:getDummyBeanReturn"/>
				</sequence>
			</complexType>
		</element>
	</schema>
  
	<schema elementFormDefault="qualified"
targetNamespace="http://xml.apache.org/xml-soap"
xmlns="http://www.w3.org/2001/XMLSchema">
		<import namespace="http://DefaultNamespace"/>
		
		<complexType name="mapItem">
			<sequence>
				<element name="key" nillable="true" type="xsd:anyType"/>
				<element name="value" nillable="true" type="xsd:anyType"/>
			</sequence>
		</complexType>
		<complexType name="Map">
			<sequence>
				<element maxOccurs="unbounded" minOccurs="0" name="item"
type="apachesoap:mapItem"/>
			</sequence>
		</complexType>
	</schema>
</wsdl:types>

<wsdl:message name="getHashMapRequest">
	<wsdl:part element="tns1:getHashMap" name="parameters"/>
</wsdl:message>

<wsdl:message name="getHashMapResponse">
	<wsdl:part element="tns1:getHashMapResponse" name="parameters"/>
</wsdl:message>

<wsdl:message name="getDummyBeanResponse">
	<wsdl:part element="tns1:getDummyBeanResponse" name="parameters"/>
</wsdl:message>

<wsdl:message name="getDummyBeanRequest">
	<wsdl:part element="tns1:getDummyBean" name="parameters"/>
</wsdl:message>


<wsdl:portType name="Types">
	<wsdl:operation name="getHashMap">
		<wsdl:input message="impl:getHashMapRequest" name="getHashMapRequest"/>
		<wsdl:output message="impl:getHashMapResponse" name="getHashMapResponse"/>
	</wsdl:operation>
	<wsdl:operation name="getDummyBean">
		<wsdl:input message="impl:getDummyBeanRequest" name="getDummyBeanRequest"/>
		<wsdl:output message="impl:getDummyBeanResponse" name="getDummyBeanResponse"/>
	</wsdl:operation>
</wsdl:portType>

   <wsdl:binding name="TypesServiceSoapBinding" type="impl:Types">

      <wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="getHashMap">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getHashMapRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getHashMapResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getDummyBean">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getDummyBeanRequest">

            <wsdlsoap:body use="literal"/>

         </wsdl:input>

         <wsdl:output name="getDummyBeanResponse">

            <wsdlsoap:body use="literal"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="TypesService">

      <wsdl:port binding="impl:TypesServiceSoapBinding" name="TypesService">

         <wsdlsoap:address
location="http://localhost:9999/axis/services/TypesService"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>





- Kumar.