axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Praveen Kumar" <pdomm...@gmail.com>
Subject How to access one particular method in .jws file from IE.
Date Tue, 12 Jun 2007 12:55:37 GMT
Hi,

import org.apache.axis.utils.XMLUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

/**
 * See \samples\stock\readme for info.
 *
 * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
 * @author Doug Davis (dug@us.ibm.com)
 */
public class StockQuoteService {
  public float get quote (String symbol) throws Exception {
    // get a real (delayed by 20min) stockquote from
    // http://www.xmltoday.com/examples/stockquote/. The IP addr
    // below came from the host that the above form posts to ..

    if ( symbol.equals("XXX") ) return( (float) 66.25 );


    Document doc = null ;

    doc = XMLUtils.newDocument( "http://www.xmltoday.com/examples/" +
                                "stockquote/getxmlquote.vep?s="+symbol );

    Element  elem = doc.getDocumentElement();
    NodeList list = elem.getElementsByTagName("stock_quote");

    elem = (Element) list.item(0);
    list = elem.getElementsByTagName( "price" );
    elem = (Element) list.item( 0 );
    String quoteStr = elem.getAttribute("value");
    try {
      return Float.valueOf(quoteStr).floatValue();
    } catch (NumberFormatException e1) {
      // maybe its an int?
      try {
        return Integer.valueOf(quoteStr).intValue() * 1.0F;
      } catch (NumberFormatException e2) {
        return -1.0F;
      }
    }
  }
}


This is one  sample jws.file  and i have wsdl for this as

    <wsdl:definitions targetNamespace="
http://localhost:8090/axis/StockQuoteService.jws">
−
    <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
−
    <wsdl:message name="getQuoteRequest">
<wsdl:part name="symbol" type="xsd:string"/>
</wsdl:message>
−
    <wsdl:message name="getQuoteResponse">
<wsdl:part name="getQuoteReturn" type="xsd:float"/>
</wsdl:message>
−
    <wsdl:portType name="StockQuoteService">
−
    <wsdl:operation name="getQuote" parameterOrder="symbol">
<wsdl:input message="impl:getQuoteRequest" name="getQuoteRequest"/>
<wsdl:output message="impl:getQuoteResponse" name="getQuoteResponse"/>
</wsdl:operation>
</wsdl:portType>
−
    <wsdl:binding name="StockQuoteServiceSoapBinding"
type="impl:StockQuoteService">
<wsdlsoap:binding style="rpc" transport="
http://schemas.xmlsoap.org/soap/http"/>
−
    <wsdl:operation name="getQuote">
<wsdlsoap:operation soapAction=""/>
−
    <wsdl:input name="getQuoteRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://DefaultNamespace" use="encoded"/>
</wsdl:input>
−
    <wsdl:output name="getQuoteResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://localhost:8090/axis/StockQuoteService.jws" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
−
    <wsdl:service name="StockQuoteServiceService">
−
    <wsdl:port binding="impl:StockQuoteServiceSoapBinding"
name="StockQuoteService">
<wsdlsoap:address location="http://localhost:8090/axis/StockQuoteService.jws
"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

How to  access  getQuote method from  IE acess.

My http://localhost:8090/axis/

Pls help me !!

-
Thanks
Domma Raju Praveen Kumar.

Mime
View raw message