You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by "Lakkavaram, Ashok" <As...@ONSTAR.com> on 2001/10/29 15:31:11 UTC

SOAP 2.2 plug-in for Tomcat 4.0.1 (Has anybody did it ?)

Hi,

Has anybody plugged SOAP 2.2 into Tomcat 4.0.1 ?
At web site, there are instructions on how to plug into TomCat 3.2 and not
for
TomCat 4.0.1.
For example, there is no "tomcat.bat" in TomCat 4.0.1 instllation where one
is supposed to set the class path. 

Thanks,
ashok

-----Original Message-----
From: Paramdeep Singh [mailto:mau96412_lists@yahoo.com]
Sent: Monday, October 29, 2001 9:19 AM
To: soap-user@xml.apache.org
Subject: Re: Serializers/Deserializers


I have developed some serializers for some classes.
You can have a look at the WSTK from IBM.

It automatically generates the serializers/deserializers for you.

With warm regards
Paramdeep

----- Original Message -----
From: "David Turner" <tu...@genome.wi.mit.edu>
To: <so...@xml.apache.org>
Sent: Thursday, October 25, 2001 7:42 PM
Subject: Serializers/Deserializers


> Has anyone developed their own serializers & deserializers for their
> classes instead of using the BeanSerializer?
>
> I've attempted to write my own serializer/deserializer for the
> java.net.URL class in order to pass URL's to my service method, but the
> server sends back a fault:
>       Fault Code = SOAP-ENV:Server.Exception:
>       Fault String = org/apache/soap/util/xml/Deserializer
>
> I've attempted to write serializers/deserializers for a simple class
> also (class contains only Strings) instead of the BeanSerializer and I
> still get the above exception.
>
> Anybody know what's going wroing?  How do you set this up on both the
> client and server (deployment descr)?
>
> Below is the code:
>
> Deployment Descriptor
> --------------------------------------------------------------------------
------------------------------------
>
> <isd:service xmlns:isd="http://xml.apache.org/xml-soap/deployment"
>              id="urn:SimpleURLService">
>   <isd:provider type="java"
>                 scope="Session"
>                 methods="serviceMethod">
>     <isd:java
> class="examples.omnitide.SimpleURLService.SimpleURLService"
> static="false"/>
>   </isd:provider>
>
>
>
<isd:faultListener>org.apache.soap.server.DOMFaultListener</isd:faultListene
r>
>
>   <isd:mappings>
>     <isd:map encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
>              xmlns:xsd="http://www.w3.org/1999/XMLSchema"
> qname="xsd:URL"
>              javaType="java.net.URL"
>
> xml2JavaClassName="examples.omnitide.SimpleURLService.URLDeserializer"/>
>
>   </isd:mappings>
>
> </isd:service>
>
>
>
> Client that calls soap service
> --------------------------------------------------------------------------
------------------------------------
>
>       // Map the types
>        SOAPMappingRegistry smr = new SOAPMappingRegistry();
>
>        URLSerializer ser = new URLSerializer();
>        URLDeserializer des = new URLDeserializer();
>
>        smr.mapTypes(Constants.NS_URI_SOAP_ENC, new
> QName("urn:SimpleURLService", "URL"),
>            URL.class, ser, des);
>
>        // Build the call
>        Call call = new Call();
>        call.setSOAPMappingRegistry(smr);
>        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
>        call.setTargetObjectURI("urn:SimpleURLService");
>        call.setMethodName("serviceMethod");
>
>        Vector params = new Vector();
>        params.addElement(new Parameter("request", URL.class, url,
> null));
>        call.setParams(params);
>
>
>
> Serializer
> --------------------------------------------------------------------------
------------------------------------
>
> import java.net.URL;
>
> public class URLSerializer implements Serializer
> {
>
>   public void marshall(String inScopeEncStyle, Class javaType, Object
> src,
>                        Object context, Writer sink, NSStack nsStack,
>                        XMLJavaMappingRegistry xjmr, SOAPContext ctx)
>                         throws IllegalArgumentException, IOException
>   {
>       nsStack.pushScope();
>
>       SoapEncUtils.generateStructureHeader(inScopeEncStyle, javaType,
> context,
>                                           sink, nsStack, xjmr);
>
>       sink.write(StringUtils.lineSeparator);
>
>       URL src2 = (URL) src;
>
>       Parameter param;
>
>       param = new Parameter("URL", String.class, src2.toString(), null);
>
>       xjmr.marshall(inScopeEncStyle, Parameter.class, param, null,
>                     sink, nsStack, ctx);
>       sink.write(StringUtils.lineSeparator);
>
>       sink.write("</" + context + ">");
>
>       nsStack.popScope();
>   }
> }
>
>
>
> Deserializer
> --------------------------------------------------------------------------
------------------------------------
>
> public class URLDeserializer implements Deserializer
> {
>   public Bean unmarshall(String inScopeEncStyle, QName elementType, Node
> src,
>                          XMLJavaMappingRegistry xjmr, SOAPContext ctx)
>                           throws IllegalArgumentException
>   {
>     Element root = (Element)src;
>     Element tempEl = DOMUtils.getFirstChildElement(root);
>
>     URL url = null;
>
>     while (tempEl != null)
>     {
>         Bean paramBean = xjmr.unmarshall(inScopeEncStyle,
> RPCConstants.Q_ELEM_PARAMETER,
>                                          tempEl, ctx);
>         Parameter param = (Parameter)paramBean.value;
>         String tagName = tempEl.getTagName();
>
>         if (tagName.equals("URL"))
>         {
>             try
>             {
>                 url = new URL( (String)param.getValue() );
>             }
>             catch (Exception e)
>             {
>                 throw new IllegalArgumentException("Problem
> instantianting bean: " + e.getMessage());
>             }
>
>         }
>
>         tempEl = DOMUtils.getNextSiblingElement(tempEl);
>     }
>
>
>     return new Bean(URL.class, url);
>   }
> }


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com