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 "Clifton B. Sothoron Jr." <Cl...@LogiXML.com> on 2007/11/29 04:48:32 UTC

www.webservicex.net exception

The following is a simple java/Axis program to retrieve a stock quote.
It connects properly but all it returns is the word "exception".  What
is wrong here? I'm using Axis 1.3 with Tomcat 5.5 on Windows 2003
Server. Axis shows up properly on the Tomcat manager.

I'm also getting the following warning at runtime. I suppose it would be
nice if the logging worked as well. All the required jar files are in
the WEB-INF/lib directory and are in the CLASSPATH.

 

log4j:WARN No appenders could be found for logger
(org.apache.axis.i18n.ProjectResourceBundle).

log4j:WARN Please initialize the log4j system properly.

 

Thanks in advance,

                                            Clif...

 

   import org.apache.axis.client.Call;

   import org.apache.axis.client.Service;

   import javax.xml.namespace.QName;

   import javax.xml.rpc.ParameterMode;

   import org.apache.axis.encoding.XMLType;

 

   public class StockQuote {

     public static void main(String [] args) {

       try {

                String endpoint =
"http://www.webservicex.net/stockquote.asmx?wsdl";

        Service  service = new Service();

        Call call = (Call) service.createCall();

        call.setTargetEndpointAddress( new java.net.URL(endpoint) );

                call.setTimeout(30000);

        call.setSOAPActionURI("http://www.webserviceX.NET/GetQuote");

                call.setUseSOAPAction(true);

                call.setOperationUse("literal");

                call.setOperationName("GetQuote");

                call.setOperationStyle("rpc");

                call.addParameter("symbol", XMLType.XSD_STRING,
ParameterMode.IN);

                call.addParameter("GetQuoteResult", XMLType.XSD_STRING,
ParameterMode.OUT);

        String ret = (String) call.invoke("GetQuote", new Object[] {new
String("IBM")});

          System.out.println("after invoke " + ret);

      } catch (Exception e) {

        System.err.println(e.toString());

                e.printStackTrace(); 

      }

    }

  }


Re: www.webservicex.net exception

Posted by Upul Godage <up...@gmail.com>.
Try with
String endpoint =
"http://www.webservicex.net/stockquote.asmx<http://www.webservicex.net/stockquote.asmx?wsdl>
";

  http://www.webservicex.net/stockquote.asmx is the endpoint ?wsdl is used
to get the wsdl.


Upul

On Nov 29, 2007 9:18 AM, Clifton B. Sothoron Jr. <
Clifton.SothoronJr@logixml.com> wrote:

>  The following is a simple java/Axis program to retrieve a stock quote. It
> connects properly but all it returns is the word "exception".  What is wrong
> here? I'm using Axis 1.3 with Tomcat 5.5 on Windows 2003 Server. Axis
> shows up properly on the Tomcat manager.
>
> I'm also getting the following warning at runtime. I suppose it would be
> nice if the logging worked as well. All the required jar files are in the
> WEB-INF/lib directory and are in the CLASSPATH.
>
>
>
> log4j:WARN No appenders could be found for logger (
> org.apache.axis.i18n.ProjectResourceBundle).
>
> log4j:WARN Please initialize the log4j system properly.
>
>
>
> Thanks in advance,
>
>                                             Clif…
>
>
>
>    import org.apache.axis.client.Call;
>
>    import org.apache.axis.client.Service;
>
>    import javax.xml.namespace.QName;
>
>    import javax.xml.rpc.ParameterMode;
>
>    import org.apache.axis.encoding.XMLType;
>
>
>
>    public class StockQuote {
>
>      public static void main(String [] args) {
>
>        try {
>
>                 String endpoint = "
> http://www.webservicex.net/stockquote.asmx?wsdl";
>
>         Service  service = new Service();
>
>         Call call = (Call) service.createCall();
>
>         call.setTargetEndpointAddress( new java.net.URL(endpoint) );
>
>                 call.setTimeout(30000);
>
>         call.setSOAPActionURI("http://www.webserviceX.NET/GetQuote");
>
>                 call.setUseSOAPAction(true);
>
>                 call.setOperationUse("literal");
>
>                 call.setOperationName("GetQuote");
>
>                 call.setOperationStyle("rpc");
>
>                 call.addParameter("symbol", XMLType.XSD_STRING,
> ParameterMode.IN);
>
>                 call.addParameter("GetQuoteResult", XMLType.XSD_STRING,
> ParameterMode.OUT);
>
>         String ret = (String) call.invoke("GetQuote", new Object[] {new
> String("IBM")});
>
>           System.out.println("after invoke " + ret);
>
>       } catch (Exception e) {
>
>         System.err.println(e.toString());
>
>                 e.printStackTrace();
>
>       }
>
>     }
>
>   }
>