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

How to Custom (De)Serilaizer in AXIS

Hi All,

I am using AXIS 1.2 RC2 both on server and client. Can anyone please
tell me how to write a  custom serializer and deserializer in axis in
order to consume below soap request message from AXIS Client.  My WSDL
has also been  included in this mail. Please redirect me to any
docs/tutorials/code samples. Please suggest ....



Request Soap Message
-----------------------------------
POST /Proj04022005Axis12Rc2Web/services/TypesService HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.2RC2
Host: 127.0.0.1:9999
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: ""
Content-Length: 501


<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>
      <getDummyBean xmlns="http://ws.as.com/wsdl/typesws">
         <VOILA>
            <ns1:j xmlns:ns1="http://ws.as.com/schema/typesws">9999</ns1:j>
            <ns2:st xmlns:ns2="http://ws.as.com/schema/typesws">BLAH
BLAH</ns2:st>
            <ns3:i xmlns:ns3="http://ws.as.com/schema/typesws">9999</ns3:i>
         </VOILA>
      </getDummyBean>
   </soapenv:Body></soapenv:Envelope>
   
   



Response Soap Message
-------------------------------------
HTTP/1.1 200 OK
Server: WebSphere Application Server/5.1
Content-Type: text/xml; charset=utf-8
Content-Language: en-US
Connection: close


<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://ws.as.com/wsdl/typesws">
         <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://ws.as.com/wsdl/typesws" 
					xmlns:apachesoap="http://xml.apache.org/xml-soap" 
					xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
					xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" 
					xmlns:xsd="http://www.w3.org/2001/XMLSchema"
					xmlns:impl="http://ws.as.com/wsdl/typesws" 
					xmlns:intf="http://ws.as.com/wsdl/typesws" 
					xmlns:tns1="http://ws.as.com/wsdl/typesws" 
					xmlns:tns2="http://ws.as.com/schema/typesws">
 
<wsdl:types>
	<schema elementFormDefault="qualified" 
			targetNamespace="http://ws.as.com/schema/typesws" 
			xmlns="http://www.w3.org/2001/XMLSchema">

		<complexType name="DummyParentBean">
			<sequence>
				<element name="j" type="xsd:int"/>
			</sequence>
		</complexType>
		
		<complexType name="InputBean">
			<complexContent>
				<extension base="tns2:DummyParentBean">
					<sequence>
						<element name="st" nillable="true" type="xsd:string"/>
						<element name="i" type="xsd:int"/>
					</sequence>
				</extension>
			</complexContent>
		</complexType>
		
		<complexType name="DummyBean">
			<sequence>
				<element name="i" type="xsd:int"/>
				<element name="st" nillable="true" type="xsd:string"/>
			</sequence>
		</complexType>
	</schema>

	<schema elementFormDefault="qualified" 
			targetNamespace="http://ws.as.com/wsdl/typesws" 
			xmlns="http://www.w3.org/2001/XMLSchema">
		
		<import namespace="http://ws.as.com/schema/typesws"/>

		<element name="getDummyBean">
			<complexType>
				<sequence>
					<element name="VOILA" type="tns2:InputBean"/>
				</sequence>
			</complexType>
		</element>
		
		<element name="getDummyBeanResponse">
			<complexType>
				<sequence>
					<element name="getDummyBeanReturn" type="tns2:DummyBean"/>
				</sequence>
			</complexType>
		</element>
	</schema>
</wsdl:types>

<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="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="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/Proj04022005Axis12Rc2Web/services/TypesService"
/>
	</wsdl:port>
</wsdl:service>

</wsdl:definitions>




Thanks & Regards,
Kumar.

Enabling SOAP 1.2 fault handling

Posted by Jyrki Saarinen <jy...@valimo.com>.
Hello all,

I'm having a problem that when setting a sub fault with 
AxisFault.addFaultSubCode(),
it is not transported to the client - axisFault.getFaultSubCodes() 
returns null.
AFAIK this is because SOAP 1.2 is not enabled. What is the correct way 
to enable SOAP 1.2 in Axis?

Jyrki