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 Johannes Fiala <ax...@fwd.at> on 2003/05/02 09:35:08 UTC

Fw: From Apache Soap 2.3.1 to Apache Axis 1.1

Just in case anybody still uses Apache Soap, here are my migration 
experiences from Soap to Axis:

----- Forwarded by Johannes Fiala/Johannes Fiala on 02.05.2003 09:34 -----

"Johannes Fiala" <so...@fwd.at> 
23.03.2003 11:10
Please respond to
soap-user@ws.apache.org


To
"'soap-user@xml.apache.org'" <so...@xml.apache.org>
cc

Subject
>From Apache Soap 2.3.1 to Apache Axis 1.1







Hi there, 

Just in case anybody else is finally making the move to Apache 1.1 (RC2 is 
a good candidate!), here are some facts on it: 

Migrating to Apache Axis from Apache Soap 2.3.1 turned out to be quite 
easy. 
Here are the most important things I ran into while exchanging my Apache 
Soap routines with Apache Axis calls: 

*) Apache Axis doesn't return a generic Parameter datatype. 
You can set the type you get returned (e.g. a String or a Bean) 

*) Interoperability: 
It seems Apache Soap Client Interface has no trouble calling an Apache 
Axis interface and vice versa. 
I only ran into troubles with BeanSerializers, but I didn't check that in 
more detail. I think that was an configuration issue. 
However Axis Client to Axis Server BeanSerializers work as expected, even 
with complex configurations with deeply cascaded beans. 

*) Calling Soap Backends - a comparison 

Apache Soap 2.3.1 
Apache Axis 1.1 
    Call call = new Call(); 

    call.setTargetObjectURI(service); 
    call.setMethodName(methodname); 

    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 

    // prepare parameters 
    Vector params = new Vector(); 
    params.addElement(new Parameter("command", String.class, command, 
Constants.NS_URI_SOAP_ENC)); 
    params.addElement(new Parameter("portalUserId", String.class, 
portalUserId, Constants.NS_URI_SOAP_ENC)); 

    params.addElement(new Parameter("vorname", String.class, vorname, 
Constants.NS_URI_SOAP_ENC)); 
    params.addElement(new Parameter("nachname", String.class, nachname, 
Constants.NS_URI_SOAP_ENC)); 
    params.addElement(new Parameter("geburtsDatum", java.util.Date.class, 
geburtsDatum, Constants.NS_URI_SOAP_ENC)); 
    call.setParams(params); 

    // Invoke the call. 
    Response resp; 
    try 
    { 
      resp = call.invoke(url, ""); 
    } 

    catch (SOAPException exception) 
    { 
      logger.error("Caught SOAPException (" + 
                         exception.getFaultCode() + "): " + 
                         exception.getMessage()); 
      return(null); 
    } 
Service  service = new Service(); 
    Call     call    = (Call) service.createCall(); 

    call.setTargetEndpointAddress( url ); 
    call.setOperationName( new QName(servicename, methodname) ); 

            call.addParameter( "command", XMLType.XSD_STRING, 
ParameterMode.IN); 
            call.addParameter( "portalUserId", XMLType.XSD_STRING, 
ParameterMode.IN); 
            call.addParameter( "vorname", XMLType.XSD_STRING, 
ParameterMode.IN); 
            call.addParameter( "nachname", XMLType.XSD_STRING, 
ParameterMode.IN); 
            call.addParameter( "geburtsDatum", XMLType.XSD_DATETIME, 
ParameterMode.IN); 

            call.setReturnType( XMLType.XSD_STRING ); 

            result = (String) call.invoke( new Object[] { command, 
portalUserId, vorname, nachname, geburtsDatum } ); 
 


The server side: 
Apache Axis doesn't need the SoapContext parameter if you need some info 
about the context. You can turn to a MessageContext instead. 
Apache Soap 2.3.1 
Apache Axis 1.1 
public myfunction (SOAPContext ctx, ...) 

HttpServlet servlet = 
(HttpServlet)ctx.getProperty(Constants.BAG_HTTPSERVLET); 
ServletContext context = servlet.getServletContext(); 
MessageContext mycontext = MessageContext.getCurrentContext(); 
          HttpServlet servlet = 
(HttpServlet)mycontext.getProperty(HTTPConstants.MC_HTTP_SERVLET); 
        ServletContext context = servlet.getServletContext();


Best regards, 
Johannes

Re: Fw: From Apache Soap 2.3.1 to Apache Axis 1.1

Posted by Davanum Srinivas <di...@yahoo.com>.
If you don't mind....Can you please add it to Wiki?
(http://nagoya.apache.org/wiki/apachewiki.cgi?AxisProjectPages)

Thanks,
dims

--- Johannes Fiala <ax...@fwd.at> wrote:
> Just in case anybody still uses Apache Soap, here are my migration 
> experiences from Soap to Axis:
> 
> ----- Forwarded by Johannes Fiala/Johannes Fiala on 02.05.2003 09:34 -----
> 
> "Johannes Fiala" <so...@fwd.at> 
> 23.03.2003 11:10
> Please respond to
> soap-user@ws.apache.org
> 
> 
> To
> "'soap-user@xml.apache.org'" <so...@xml.apache.org>
> cc
> 
> Subject
> From Apache Soap 2.3.1 to Apache Axis 1.1
> 
> 
> 
> 
> 
> 
> 
> Hi there, 
> 
> Just in case anybody else is finally making the move to Apache 1.1 (RC2 is 
> a good candidate!), here are some facts on it: 
> 
> Migrating to Apache Axis from Apache Soap 2.3.1 turned out to be quite 
> easy. 
> Here are the most important things I ran into while exchanging my Apache 
> Soap routines with Apache Axis calls: 
> 
> *) Apache Axis doesn't return a generic Parameter datatype. 
> You can set the type you get returned (e.g. a String or a Bean) 
> 
> *) Interoperability: 
> It seems Apache Soap Client Interface has no trouble calling an Apache 
> Axis interface and vice versa. 
> I only ran into troubles with BeanSerializers, but I didn't check that in 
> more detail. I think that was an configuration issue. 
> However Axis Client to Axis Server BeanSerializers work as expected, even 
> with complex configurations with deeply cascaded beans. 
> 
> *) Calling Soap Backends - a comparison 
> 
> Apache Soap 2.3.1 
> Apache Axis 1.1 
>     Call call = new Call(); 
> 
>     call.setTargetObjectURI(service); 
>     call.setMethodName(methodname); 
> 
>     call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC); 
> 
>     // prepare parameters 
>     Vector params = new Vector(); 
>     params.addElement(new Parameter("command", String.class, command, 
> Constants.NS_URI_SOAP_ENC)); 
>     params.addElement(new Parameter("portalUserId", String.class, 
> portalUserId, Constants.NS_URI_SOAP_ENC)); 
> 
>     params.addElement(new Parameter("vorname", String.class, vorname, 
> Constants.NS_URI_SOAP_ENC)); 
>     params.addElement(new Parameter("nachname", String.class, nachname, 
> Constants.NS_URI_SOAP_ENC)); 
>     params.addElement(new Parameter("geburtsDatum", java.util.Date.class, 
> geburtsDatum, Constants.NS_URI_SOAP_ENC)); 
>     call.setParams(params); 
> 
>     // Invoke the call. 
>     Response resp; 
>     try 
>     { 
>       resp = call.invoke(url, ""); 
>     } 
> 
>     catch (SOAPException exception) 
>     { 
>       logger.error("Caught SOAPException (" + 
>                          exception.getFaultCode() + "): " + 
>                          exception.getMessage()); 
>       return(null); 
>     } 
> Service  service = new Service(); 
>     Call     call    = (Call) service.createCall(); 
> 
>     call.setTargetEndpointAddress( url ); 
>     call.setOperationName( new QName(servicename, methodname) ); 
> 
>             call.addParameter( "command", XMLType.XSD_STRING, 
> ParameterMode.IN); 
>             call.addParameter( "portalUserId", XMLType.XSD_STRING, 
> ParameterMode.IN); 
>             call.addParameter( "vorname", XMLType.XSD_STRING, 
> ParameterMode.IN); 
>             call.addParameter( "nachname", XMLType.XSD_STRING, 
> ParameterMode.IN); 
>             call.addParameter( "geburtsDatum", XMLType.XSD_DATETIME, 
> ParameterMode.IN); 
> 
>             call.setReturnType( XMLType.XSD_STRING ); 
> 
>             result = (String) call.invoke( new Object[] { command, 
> portalUserId, vorname, nachname, geburtsDatum } ); 
>  
> 
> 
> The server side: 
> Apache Axis doesn't need the SoapContext parameter if you need some info 
> about the context. You can turn to a MessageContext instead. 
> Apache Soap 2.3.1 
> Apache Axis 1.1 
> public myfunction (SOAPContext ctx, ...) 
> 
> HttpServlet servlet = 
> (HttpServlet)ctx.getProperty(Constants.BAG_HTTPSERVLET); 
> ServletContext context = servlet.getServletContext(); 
> MessageContext mycontext = MessageContext.getCurrentContext(); 
>           HttpServlet servlet = 
> (HttpServlet)mycontext.getProperty(HTTPConstants.MC_HTTP_SERVLET); 
>         ServletContext context = servlet.getServletContext();
> 
> 
> Best regards, 
> Johannes


=====
Davanum Srinivas - http://webservices.apache.org/~dims/

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com