unable to compile class in web svc tutorial


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: unable to compile class in web svc tutorial

  1. #1
    Mark Guest

    unable to compile class in web svc tutorial


    In the recent DevX tutorial written by Kyle Gabhart, he includes the following
    line of code in both of his examples:

    call.setProperty( call.NAMESPACE, NAMESPACE_URI );

    When I try to compile, however, I get the following error:

    "CurrencyExchange.java": Error #: 300 :
    variable NAMESPACE not found in class
    org.apache.axis.client.Call at line 33,
    column 30

    Any idea why I would be getting this error? The "call" object, by the way,
    comes from:

    import org.apache.axis.client.Call;

    Thanks,

    Mark

  2. #2
    Kyle Gabhart Guest

    Re: unable to compile class in web svc tutorial


    "Mark" <mfigart@cavernworks.com> wrote:
    >
    >In the recent DevX tutorial written by Kyle Gabhart, he includes the following
    >line of code in both of his examples:
    >
    > call.setProperty( call.NAMESPACE, NAMESPACE_URI );
    >
    >When I try to compile, however, I get the following error:
    >
    > "CurrencyExchange.java": Error #: 300 :
    > variable NAMESPACE not found in class
    > org.apache.axis.client.Call at line 33,
    > column 30
    >
    >Any idea why I would be getting this error? The "call" object, by the way,
    >comes from:
    >
    > import org.apache.axis.client.Call;
    >
    >Thanks,
    >
    >Mark


    Just prior to the story being posted on the DevX website, Apache released
    a new version(beta1) of Axis. The article assumes the alpha3 version.

    If you use the beta1 rather than alpha3 version, then you must place the
    following packages in their classpath:
    axis.jar, jaxrpc.jar, commons-logging.jar, axis-tt-bytecode.jar All of these
    files can be found in the lib directory of the axis distribution.

    Also, the CurrencyExchange example need to be modified in the following way:

    -Add one import statement: javax.xml.rpc.namespace.QName;
    -Remove the line: call.setProperty( call.NAMESPACE, NAMESPACE_URI );
    -Change the line that reads: call.setOperationName( OPERATION_NAME );
    to instead combine the Namespace URI and the operation name using a
    qualified name (a QName object):

    call.setOperationName( new QName( NAMESPACE_URI, OPERATION_NAME ) );


    The changes to the WidgetConsumer example are considerably more involved:

    -Add an import: import org.apache.axis.encoding.ser.*;
    -Add another import: import javax.xml.rpc.ParameterMode;
    -Remove the line: call.setProperty( call.NAMESPACE, NAMESPACE_URI );
    -Change the line that reads: call.setOperationName( OPERATION_NAME );
    to instead read: call.setOperationName( new QName( NAMESPACE_URI, OPERATION_NAME
    ) );
    -Change the serialization declaration by removing the call.addSerializer()
    method and replace it with this:
    call.registerTypeMapping(
    Widget.class,
    qname,
    new BeanSerializerFactory( Widget.class, qname ),
    new BeanDeserializerFactory( Widget.class, qname ) );
    -Change the addParameter() call to this:
    call.addParameter( "arg1", qname, ParameterMode.PARAM_MODE_IN );
    -You also must explicitly declare the return type:
    call.call.setReturnType( XMLType.XSD_STRING );

    That should do it. The full source code for these examples for the beta
    version of axis will be posted tonight or tomorrow morning. Just return
    to the article and you will be able to download them.

    Thanks.

    -Kyle Gabhart
    DevX Java Pro

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center