Webservices

Discussion in 'ASP .Net' started by devjnr@gmail.com, Oct 19, 2006.

  1. Guest

    I have to call e NET web service via Oracle.

    this is my asmx:
    =========================================
    <%@ WebService Language="C#" class="MyClass" %>

    using System.Web.Services ;

    public class MyClass
    {
    [WebMethod()]
    public int Add ( int a, int b)
    {
    return a + b ;
    }
    }
    =========================================


    If I call http://localhost/TestWebService.aspx where
    TestWebService.aspx is
    =========================================
    <html>

    <body>
    <form action="http://localhost/MyWebService.asmx/Add" method="POST">

    <input name="a"></input>
    <input name="b"></input>

    <input type="submit" value="Enter"> </input>
    </form>

    </body>
    </html>
    =========================================


    and I fill input "a" with 2 and input "b" with 3 I obtain:

    =========================================
    <?xml version="1.0" encoding="utf-8"?>
    <int xmlns="http://tempuri.org/">5</int>
    =========================================


    This web service works fine.


    I have to call it from Oracle function and I found this script:

    =========================================
    CREATE OR REPLACE FUNCTION get_stock_price (p_stock_code IN VARCHAR2)
    RETURN NUMBER
    AS
    l_request soap_api.t_request;
    l_response soap_api.t_response;
    l_price NUMBER;
    BEGIN

    l_request := soap_api.new_request(p_method => 'ns1:getQuote',
    p_namespace =>
    'xmlns:ns1="urn:xmethods-delayed-quotes"');

    soap_api.add_parameter(p_request => l_request,
    p_name => 'symbol',
    p_type => 'xsd:string',
    p_value => p_stock_code);

    l_response := soap_api.invoke(p_request => l_request,
    p_url =>
    'http://64.124.140.30:9090/soap',
    p_action =>
    'urn:xmethods-delayed-quotes#getQuote');

    l_price := soap_api.get_return_value(p_response => l_response,
    p_name => 'Result',
    p_namespace =>
    'xmlns:ns1="urn:xmethods-delayed-quotes"');

    RETURN l_price;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN NULL;
    END;
    /
    =========================================


    I don't figure out which parameters (of my asp net web service) I have
    to replace to this last script to use web service.

    Can you help me pls?

    Thx.
     
    , Oct 19, 2006
    #1
    1. Advertising

  2. Have not worked with Oracle on web services before, but looking at the code,
    you need to add two parameters, both of which are integers. Have you checked
    out technet.oracle.com yet? It has samples and docs to help developers work
    with Oracle.

    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA
    http://gregorybeamer.spaces.live.com

    *************************************************
    Think outside of the box!
    *************************************************
    <> wrote in message
    news:...
    >I have to call e NET web service via Oracle.
    >
    > this is my asmx:
    > =========================================
    > <%@ WebService Language="C#" class="MyClass" %>
    >
    > using System.Web.Services ;
    >
    > public class MyClass
    > {
    > [WebMethod()]
    > public int Add ( int a, int b)
    > {
    > return a + b ;
    > }
    > }
    > =========================================
    >
    >
    > If I call http://localhost/TestWebService.aspx where
    > TestWebService.aspx is
    > =========================================
    > <html>
    >
    > <body>
    > <form action="http://localhost/MyWebService.asmx/Add" method="POST">
    >
    > <input name="a"></input>
    > <input name="b"></input>
    >
    > <input type="submit" value="Enter"> </input>
    > </form>
    >
    > </body>
    > </html>
    > =========================================
    >
    >
    > and I fill input "a" with 2 and input "b" with 3 I obtain:
    >
    > =========================================
    > <?xml version="1.0" encoding="utf-8"?>
    > <int xmlns="http://tempuri.org/">5</int>
    > =========================================
    >
    >
    > This web service works fine.
    >
    >
    > I have to call it from Oracle function and I found this script:
    >
    > =========================================
    > CREATE OR REPLACE FUNCTION get_stock_price (p_stock_code IN VARCHAR2)
    > RETURN NUMBER
    > AS
    > l_request soap_api.t_request;
    > l_response soap_api.t_response;
    > l_price NUMBER;
    > BEGIN
    >
    > l_request := soap_api.new_request(p_method => 'ns1:getQuote',
    > p_namespace =>
    > 'xmlns:ns1="urn:xmethods-delayed-quotes"');
    >
    > soap_api.add_parameter(p_request => l_request,
    > p_name => 'symbol',
    > p_type => 'xsd:string',
    > p_value => p_stock_code);
    >
    > l_response := soap_api.invoke(p_request => l_request,
    > p_url =>
    > 'http://64.124.140.30:9090/soap',
    > p_action =>
    > 'urn:xmethods-delayed-quotes#getQuote');
    >
    > l_price := soap_api.get_return_value(p_response => l_response,
    > p_name => 'Result',
    > p_namespace =>
    > 'xmlns:ns1="urn:xmethods-delayed-quotes"');
    >
    > RETURN l_price;
    > EXCEPTION
    > WHEN OTHERS THEN
    > RETURN NULL;
    > END;
    > /
    > =========================================
    >
    >
    > I don't figure out which parameters (of my asp net web service) I have
    > to replace to this last script to use web service.
    >
    > Can you help me pls?
    >
    > Thx.
    >
     
    Cowboy \(Gregory A. Beamer\), Oct 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jib

    Webservices and OLE object

    jib, Jul 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    389
  2. Colt [MVP]
    Replies:
    1
    Views:
    392
    Nathan Baulch
    Jul 11, 2003
  3. David Waz...

    Re: Events in HTML throught webservices...

    David Waz..., Jul 11, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    377
    David Waz...
    Jul 11, 2003
  4. khawar
    Replies:
    0
    Views:
    442
    khawar
    Jul 15, 2003
  5. majiofpersia

    webservices filestream

    majiofpersia, Jul 16, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    325
    majiofpersia
    Jul 16, 2003
Loading...

Share This Page