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 Praveen Kumar <pd...@gmail.com> on 2007/06/12 14:55:37 UTC

How to access one particular method in .jws file from IE.

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.

Re: How to access one particular method in .jws file from IE.

Posted by Duncan Thomson <du...@mitre.org>.
Praveen Kumar wrote:

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

> How to  access  getQuote method from  IE acess.

What do you mean, IE access?  Web service methods are intended to be accessed from client programs, not web browsers.  Are you talking about having some code (e.g. an applet) running within your browser that is going to access the service.  

See my previous response to your previous question.

I suggest you read some tutorials/overviews on web services to get some basic understanding of the concepts before going any further or posting any more questions!

Good luck,

Duncan




---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org