Web service, servlet, HttpServletResponse, Locale

Hello guys!
I have two questions:
- Can a servlet be a web service?
- For the next one, I supposed that yes... I'm trying to build a web service from a servlet and I get a strange error.
I simplified the code to the maximum, and it became like this:
public class PriceListServlet extends HttpServlet implements PriceListIF{
    public void init() {
     public void doPost(HttpServletResponse resp) {
          }and the interface is:
public interface PriceListIF extends Remote {
     public void init() throws RemoteException;
     public void doPost(HttpServletResponse resp)throws RemoteException;
}Cannot be more simple, can it?
When I type ant build, I get the following error message:
erreur : La classe java.util.Locale n'a pas de constructeur vide accessible public
which means:
error: Class java.util.Locale doesn't have public empty constructor
I did a few tests, and if I put HttpServletRequest instead of HttpServletResponse, it works.
If the doPost method doesn't have any parameter, it works!
So there's a problem with HttpServletResponse...
Does anyone know what's Locale got to do with HttpServletResponse????
Thanks for your help
Philippe

Hello guys!
I have two questions:
- Can a servlet be a web service?
- For the next one, I supposed that yes... I'm trying to build a web service from a servlet and I get a strange error.
I simplified the code to the maximum, and it became like this:
public class PriceListServlet extends HttpServlet implements PriceListIF{
    public void init() {
     public void doPost(HttpServletResponse resp) {
          }and the interface is:
public interface PriceListIF extends Remote {
     public void init() throws RemoteException;
     public void doPost(HttpServletResponse resp)throws RemoteException;
}Cannot be more simple, can it?
When I type ant build, I get the following error message:
erreur : La classe java.util.Locale n'a pas de constructeur vide accessible public
which means:
error: Class java.util.Locale doesn't have public empty constructor
I did a few tests, and if I put HttpServletRequest instead of HttpServletResponse, it works.
If the doPost method doesn't have any parameter, it works!
So there's a problem with HttpServletResponse...
Does anyone know what's Locale got to do with HttpServletResponse????
Thanks for your help
Philippe

Similar Messages

  • Soap Router versus Web Service Servlet

    Hello:
    I am trying to understand the fundamental difference between a SOAP Router versus
    Web Service Servlet?. In websphere there is a concept called WSG(Web Service
    Gateway) on which we can configure an handler to intercept the incoming soap requests.
    But in weblogic I do not think we can configure any handler on Web Service Servlet.
    So I think for this very purpose you have this soap router right ?. If this is
    correct then does the soap router will forward the call to the Web Service Servlet
    which implements the soap engine.
    Please clarify,
    Thanks,
    Vijay

    Hello,
    Right, today there is not a global handler that can be configured;
    however you can do servlet filter or check out an early access SOAP
    Router[1] from Manoj.
    Could you give us a snapshot of your use case?
    Thanks,
    Bruce
    [1]
    http://manojc.com/?router/readme.html
    Vijay Cherukumudi wrote:
    >
    Hello:
    I am trying to understand the fundamental difference between a SOAP Router versus
    Web Service Servlet?. In websphere there is a concept called WSG(Web Service
    Gateway) on which we can configure an handler to intercept the incoming soap requests.
    But in weblogic I do not think we can configure any handler on Web Service Servlet.
    So I think for this very purpose you have this soap router right ?. If this is
    correct then does the soap router will forward the call to the Web Service Servlet
    which implements the soap engine.
    Please clarify,
    Thanks,
    Vijay

  • Ignoring Http basic authentication header in wls 7.0.sp2 web service servlet (weblogic.webservice.server.servlet.WebServiceServlet)

    Hi!
    We need to implement authentication using our own methods, and the authentication
    information is provided to the web service implementation in a basic authentication
    header. The problem is, that the servlet
    weblogic.webservice.server.servlet.WebServiceServlet, which handles web services
    in
    wls 7.0.sp2, always attempts to perform authentication, if the header is present.
    Is there any way to circumvent this, because we want to implement authentication
    on our own?
    I already know two workarounds:
    The best would of course be to implement a custom security realm for our own
    authentication system. This is not an option, implementing an own security
    realm is overkill for this specific web service.
    The other way would be to route the requests by way of a custom servlet, which
    would
    remove the basic authentication header, and put the authentication info in custom
    headers, such as x-auth: <user:password>, or smthng similar, and after successful
    authentication, make a call to bea's servlet weblogic.webservice.server.servlet.WebServiceServlet.
    But still, I'd like to know if there is any way to tell bea's servlet to ignore
    the basic
    authentication header?
    Oh yeah, by the way, this is URGENT, as always. (really!! ;)
    Toni Nykanen

    Currently there is no option to turn off security check.
    I think you can use a servlet filter mapped to the URL
    of your service, instead of a proxy servlet?
    Regards,
    -manoj
    http://manojc.com
    "Toni Nykanen" <[email protected]> wrote in message
    news:3ef1577b$[email protected]..
    >
    Hi!
    We need to implement authentication using our own methods, and theauthentication
    information is provided to the web service implementation in a basicauthentication
    header. The problem is, that the servlet
    weblogic.webservice.server.servlet.WebServiceServlet, which handles webservices
    in
    wls 7.0.sp2, always attempts to perform authentication, if the header ispresent.
    Is there any way to circumvent this, because we want to implementauthentication
    on our own?
    I already know two workarounds:
    The best would of course be to implement a custom security realm for ourown
    authentication system. This is not an option, implementing an own security
    realm is overkill for this specific web service.
    The other way would be to route the requests by way of a custom servlet,which
    would
    remove the basic authentication header, and put the authentication info incustom
    headers, such as x-auth: <user:password>, or smthng similar, and aftersuccessful
    authentication, make a call to bea's servletweblogic.webservice.server.servlet.WebServiceServlet.
    >
    But still, I'd like to know if there is any way to tell bea's servlet toignore
    the basic
    authentication header?
    Oh yeah, by the way, this is URGENT, as always. (really!! ;)
    Toni Nykanen

  • Web service call - works locally but not on mobile?

    Hi,
    I have a web service call (the service is hosted on the cloud so it's an external, permamnent domain) which works fine when I'm testing it locally using the Flex Buritto built in emulator or directly using my browser.
    But when trying from an android phone (tried a few of them - nexus one, nexus s and galaxy tab) the service is being called but never returns anything.
    Is there a good way to trace to call / understand the problem?
    Thanks,
    Nir

    Oh. well that would explain alot of it. its not a stupid question we are all learning. You have to put a crossdomain xml in server on the root directory. there are alot of different ways to implement it.
    this should point you on the right direction.
    http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html
    here is a very basic format basically allowing anyone to call my service.
    <?xml version="1.0"?>
    <!DOCTYPE cross-domain-policy
      SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
    <cross-domain-policy>
      <allow-access-from domain="*" />
    </cross-domain-policy>
    miguel

  • Client triggers Web Service servlet

    Hi,
    I'm new to java enterprise app. I have to develop a web service which listens to incoming soap info and triggers a servlet to be displayed on the screen where the web service is installed. And the servlet must show the message received from soap. The problem is that I don't know how to trigger the servlet. Can anyone help me please? Thanks in advance!.
    Tobias

    Hi Martti,
    I am looking for something similar , were you able to get this to work?
    Also, how did you configure the identity assertion provider?
    Any help would be appreciated
    Thanks

  • Web Services - Servlets vs EJBs

    Hi,
    Looking for any suggestions about the benefits of using either servlets or EJBs as web service endpoints. Very early in the design of any application, I wish to expose my business logic components as web services, is there any particular benefit to using a specific approach (i.e. using either EJBs or Servlets as the end points of the web services exposing the business logic)?
    This is a totally new application so I have no considerations towards reusing old EJB code, etc. My initial thoughts favour using servlets, if only because it reduces the complexity / resources required for the application server (i.e only Web-container required, rather than Web & EJB container).
    Any thoughts please?

    Why do Servlets not scale as well? Surely they are
    more "lightweight" than an EJB (which has all theRMI
    overhead), and wouldn't it ultimately be down tothe
    underlying app server anyway?Right, but servlets are just HTTP request listeners.
    They aren't components, they aren't transactional,
    they don't handle persistence, they don't have
    naming services, they don't have queuing services.
    The EJB container offers you a lot.
    With that said, it's not just a choice between
    servlets and EJBs. You can use POJOs and avoid EJBs
    altogether if you do it right.
    Or choose the best of both worlds and mix 'n match as needed.
    Noone forces you to choose one over the other (at least not for any technical reasons, I'm not diving into corporate politics here).
    My thought was that web services were a better wayto
    expose business logic than EJBs, but if there some
    solid reason why this isn't the case I like toknow.
    Web services - lightweight? Maybe that's true of
    REST, but certainly not SOAP. There's an argument
    that says services are more heavyweight than EJBs,
    because all the XML on the wire is an expensive
    protocol.
    SOAP is heavy on the network, but it's essentially a rather thin layer on top of other services (if properly architected).
    For example we have a SOAP layer exposing a Spring application which proxies an EJB architecture.
    Next to that SOAP layer sits a traditional web application (servlets) which itself has a Spring application sitting on top of it for demonstration and testing purposes.
    And then there's an SDK allowing direct access to the Spring layer (and thus almost direct access to the EJB layer).
    That's the beauty of a true open architecture, each component can be built on top of another and the component underneath can function just fine without it.
    Look into Spring:
    http://www.springframework.org
    It's a lighter alternative to EJBs, and good plumbing
    for any Java EE app.While Spring can serve as an alternative for EJB in places where EJB are overkill it's of course not in competition with it.
    Spring is a service layer, making use of other technologies (like EJB, like AOP, like ORM) to provide data and other services (like Struts, like JSF, like JSP) to provide that data to requesters.

  • Force web service servlet to use http 1.1

    is there anyway to force a web service deployed to oc4j standalone 9.0.3 to service many calls over one http connection? there doesn't seem to be any documentation to that end. Thanks, Ki

    But, I want to know which Framework will provide
    better performance?
    better than what?
    Also I want to develope the web service as a standard
    one andeach has it's own quircks and implementation details. Each should be able to generate and accept the same SOAP messages though if you implement them properly.
    It should be able to provide bulk data exchange.
    That will depend in large part on your hardware.
    Please suggest a web service framework
    (Java-based) which will give better performance.again, better than what?
    Better than messenger pidgeons?
    Better than swallows (European or African)?
    And if so, how heavy would the message capsule be? 2 swallows may be able to carry a coconut together, holding it on a piece of string.

  • Web Service - Cannot Deploy on Local OC4J

    We get the following error when trying to deploy the following code as a web service to the local OC4J.
    The parameter of domDoc of type oracle.xml.parser.v2.XMLDocument cannot be serialized into XML, and no custom serializer has been defined for it.
    All we want to do with this service is connect to the database and return the results of the query in XML. We have tried a string, but it returns a string of XML and we need it to return the XML.
    The code compiles, runs, and looks as though it is returning what it is suppose to if we write the return out, but the code will not deploy as a web service.
    Thanx so much
    Pam
    This is the code:
    package getuserform;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import oracle.xml.parser.v2.XMLDocument;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class getUserInfo {
    public int GetUserInfo(XMLDocument domDoc){
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    } catch (SQLException e) {
    // TODO
    return(-1);
    String url = "jdbc:oracle:thin:@db:1521:v9it";
    Connection myCon;
    try {
    myCon = DriverManager.getConnection(url,"user","password");
    } catch (SQLException e) {
    // TODO
    return(-1);
    OracleXMLQuery qry = new OracleXMLQuery (myCon,
    "select upper(t.u_name_frst) || ' ' || upper(t.u_name_last) U_Name," +
    " t.user_id, " +
    " t.active Active, " +
    " to_char(t.termination_dt, 'DD-MON-YYYY') Termination_DT, " +
    " '(' || t.area_code || ') ' || t.phone_no Phone, " +
    " t.email Email, " +
    " t.city City, " +
    " (select dpl_desc from schema.dept_pay_locations dpl where dpl.dpl_num = t.pay_location) Pay_Location, " +
    " t.LOCATION Location " +
    " from schema.users t " +
    " where upper(t.user_id) like upper ('u227%')");
    // xmlStr = qry.getXMLString(); works.
    // return (qry.getXMLString()); works
    // !work
    domDoc = (XMLDocument)qry.getXMLDOM();
    qry.close();
    return(0);
    }

    Hi Pam,
    It is using Element as the method return that is causing the problem. As you've seen this means that the Data Control has no concrete schema types to associate with the fields so it fails.
    I have a couple of possible workarounds.
    1. Is it a requirement to write your SQL query in the method? Perhaps they are to be dynamic?
    If not, have you considered using the database to do the query and publishing that as the service. This would work around the problem. You can use JDeveloper to do all of this if you 'wrap' the query in a PL/SQL package in the database. Then use the 'Web Service from PL/SQL Package' wizard to generate the web service including wrapper Java classes for the package and DB connection/mgmt classes.
    Or you can publish the actual Query as a service - using the command line (unfortunately you can't use JDEV to do this)
    2. You mentioned the XSD for the query - if you have that then you can use a custom serializer and map your XSD to the return type of your method - the org.w3c.dom.Element class:
    a. if your web service is already generated - open properties (Web Services Editor)
    b. go to Custom Mappings page
    c. click Add
    d. for Java Class type in org.w3c.dom.Element
    e. for XML Qualified Name add your XSD
    f. add your serializer class - here is one I made earlier!
    package project3;
    import java.util.Map;
    import javax.xml.namespace.QName;
    import javax.xml.soap.SOAPElement;
    import javax.xml.soap.SOAPException;
    import oracle.webservices.SOAPUtil;
    import oracle.webservices.databinding.SOAPElementSerializer;
    import org.w3c.dom.Element;
    public class DummyElementSerialiser implements SOAPElementSerializer
    public void init(Map map)
    public SOAPElement serialize(QName qName, Object object)
    try
    return SOAPUtil.toSOAPElement((Element) object);
    catch (SOAPException ex)
    return null;
    if you're generating the service from scratch this same mapping page comes up as part of the wizard
    Now you should be able to create your data control
    rgds
    Susan

  • XI and Web services

    Hi guys,
       I want to exposed XI message intefaces as a web service on a local uddi repository . Is it possible to expose Outbound intefaces from SE80->Enteprise Services , I am sure about Inbound intefaces but not out bound .
       Any suggestions or help appreciated.
    Regards,
    Keith

    Keith,
    In your ID > tools>  Define Webservice and you can expose your Outbound interfaces as webservices.
    Take a look at section 3.2 ( especially 3.2.2 ) in this document,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
    Regards,
    Bhavesh

  • Problem Deploying Web Services

    I have created a Web Service based on a pl/sql function in my database. I used the JDeveloper (10.1.3.2.0) wizard to created the web service. I used the J2EE 1.4 (JAX-RPC) Web Service wizard. The web service works fine when I access it using the OC4J container built into JDeveloper. When I deploy the Web Service to our Oracle Application Server 10.1.2.0.2 on Solaris I receive the following error when I try to access the Web Service:
    Servlet error: Error instantiating servlet 'ticketwsSoapHttpPort' (servlet class not found, make sure it exists at /u01/app/oracle/midtier/j2ee/OC4J_APPS/applications/ticketws_jax/ticketws_jax/WEB-INF/classes/ticket/TicketwsUser.class, in a jar in /u01/app/oracle/midtier/j2ee/OC4J_APPS/applications/ticketws_jax/ticketws_jax/WEB-INF/lib/, in an orion-web.xml specified classpath or global server classpath)
    I checked both paths mentioned in the error message on the server. All files seemed to be there.
    Any insight into this issue would be much appreciated.

    Hi user493481,
    I have developed a PL/SQL Web Service using JDeveloper, it is working fine on local instance, time to deloy on Application Server (Apps 11.5.10.2),
    could you post the deploying steps...
    Thanks in advance,
    Rao.

  • Call web service from pl/slq

    When I tried to execute the following code thru sqlplus:
    sql>@demodemosoap.sql
    SQL> @local_modified_orig.sql
    Package created.
    Package body created.
    No errors.
    before new request..
    before add param..
    before invoke..
    BEGIN dbms_output.put_line(time_service.get_local_time('08812')); END;
    ERROR at line 1:
    ORA-30625: method dispatch on NULL SELF argument is disallowed
    ORA-06512: at "SBEERAM.DEMO_SOAP", line 50
    ORA-06512: at "SBEERAM.DEMO_SOAP", line 83
    ORA-06512: at "SBEERAM.TIME_SERVICE", line 16
    ORA-06512: at line 1
    /*********Here is the complete code that I have: @demosoap.sql **********/
    Rem
    Rem $Header: soapdemo.sql 21-may-2002.13:48:17 rpang Exp $
    Rem
    Rem soapdemo.sql
    Rem
    Rem Copyright (c) 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem soapdemo.sql - <one-line expansion of the name>
    Rem
    Rem DESCRIPTION
    Rem A PL/SQL demo package for making SOAP RPC calls.
    Rem
    Rem NOTES
    Rem This demo package can only be used in oracle 9ir2. It utilizes 9iR2's
    Rem XDB (XMLType and HttpUriType) and 9iR1's enhancements to UTL_HTTP to
    Rem make SOAP RPC calls.
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem rpang 05/21/02 - created
    Rem
    Rem A PL/SQL demo package that makes a SOAP RPC calls.
    Rem
    CREATE OR REPLACE PACKAGE demo_soap AS
    /* A type to represent a SOAP RPC request */
    TYPE request IS RECORD (
    method VARCHAR2(256),
    namespace VARCHAR2(256),
    body VARCHAR2(32767));
    /* A type to represent a SOAP RPC response */
    TYPE response IS RECORD (
    doc xmltype);
    * Create a new SOAP RPC request.
    FUNCTION new_request(method IN VARCHAR2,
    namespace IN VARCHAR2)
    RETURN request;
    * Add a simple parameter to the SOAP RPC request.
    PROCEDURE add_parameter(req IN OUT NOCOPY request,
    name IN VARCHAR2,
    type IN VARCHAR2,
    value IN VARCHAR2);
    * Make the SOAP RPC call.
    FUNCTION invoke(req IN OUT NOCOPY request,
    url IN VARCHAR2,
    action IN VARCHAR2) RETURN response;
    * Retrieve the sipmle return value of the SOAP RPC call.
    FUNCTION get_return_value(resp IN OUT NOCOPY response,
    name IN VARCHAR2,
    namespace IN VARCHAR2) RETURN VARCHAR2;
    END;
    show errors
    CREATE OR REPLACE PACKAGE BODY demo_soap AS
    FUNCTION new_request(method IN VARCHAR2,
    namespace IN VARCHAR2)
    RETURN request AS
    req request;
    BEGIN
    req.method := method;
    req.namespace := namespace;
    RETURN req;
    END;
    PROCEDURE add_parameter(req IN OUT NOCOPY request,
    name IN VARCHAR2,
    type IN VARCHAR2,
    value IN VARCHAR2) AS
    BEGIN
    req.body := req.body ||
    '<'||name||' xsi:type="'||type||'">'||value||'</'||name||'>';
    END;
    PROCEDURE generate_envelope(req IN OUT NOCOPY request,
                   env IN OUT NOCOPY VARCHAR2) AS
    BEGIN
    env := '<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body><'||req.method||' '||req.namespace||'
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'||
    req.body||'</'||req.method||'></SOAP-ENV:Body></SOAP-ENV:Envelope>';
    END;
    PROCEDURE show_envelope(env IN VARCHAR2) AS
    i pls_integer;
    len pls_integer;
    BEGIN
    i := 1; len := length(env);
    WHILE (i <= len) LOOP
    dbms_output.put_line(substr(env, i, 60));
    i := i + 60;
    END LOOP;
    END;
    PROCEDURE check_fault(resp IN OUT NOCOPY response) AS
    fault_node xmltype;
    fault_code VARCHAR2(256);
    fault_string VARCHAR2(32767);
    BEGIN
    fault_node := resp.doc.extract('/soap:Fault',
    'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/');
    IF (fault_node IS NOT NULL) THEN
    fault_code := fault_node.extract('/soap:Fault/faultcode/child::text()',
         'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
    fault_string := fault_node.extract('/soap:Fault/faultstring/child::text()',
         'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
    raise_application_error(-20000, fault_code || ' - ' || fault_string);
    END IF;
    END;
    FUNCTION invoke(req IN OUT NOCOPY request,
    url IN VARCHAR2,
    action IN VARCHAR2) RETURN response AS
    env VARCHAR2(32767);
    http_req utl_http.req;
    http_resp utl_http.resp;
    resp response;
    BEGIN
    generate_envelope(req, env);
    -- show_envelope(env);
    http_req := utl_http.begin_request(url, 'POST','HTTP/1.0');
    utl_http.set_header(http_req, 'Content-Type', 'text/xml');
    utl_http.set_header(http_req, 'Content-Length', length(env));
    utl_http.set_header(http_req, 'SOAPAction', action);
    utl_http.write_text(http_req, env);
    http_resp := utl_http.get_response(http_req);
    utl_http.read_text(http_resp, env);
    utl_http.end_response(http_resp);
    resp.doc := xmltype.createxml(env);
    resp.doc := resp.doc.extract('/soap:Envelope/soap:Body/child::node()',
    'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
    -- show_envelope(resp.doc.getstringval());
    check_fault(resp);
    RETURN resp;
    END;
    FUNCTION get_return_value(resp IN OUT NOCOPY response,
    name IN VARCHAR2,
    namespace IN VARCHAR2) RETURN VARCHAR2 AS
    BEGIN
    RETURN resp.doc.extract('//'||name||'/child::text()',
    namespace).getstringval();
    END;
    END;
    show errors
    /************** local.sql ********/
    Rem
    Rem $Header: time.sql 03-jul-2002.13:48:17 rpang Exp $
    Rem
    Rem time.sql
    Rem
    Rem Copyright (c) 2002, Oracle Corporation. All rights reserved.
    Rem
    Rem NAME
    Rem time.sql - <one-line expansion of the name>
    Rem
    Rem DESCRIPTION
    Rem PL/SQL Web service demo
    Rem
    Rem NOTES
    Rem This demo illustrates how to use PL/SQL to use Web service.
    Rem This demo utilize 9iR2's XDB (XMLType and HttpUriType) and 9iR1's
    Rem enhancements to UTL_HTTP to retrieve the local time for a give zip code.
    Rem
    Rem SQL> SET serveroutput ON
    Rem SQL> exec dbms_output.put_line(time_service.get_local_time('94065'));
    Rem 7/3/2002 1:33:04 PM
    Rem
    Rem PL/SQL procedure successfully completed.
    Rem
    Rem MODIFIED (MM/DD/YY)
    Rem rpang 07/03/02 - created
    Rem
    Rem A PL/SQL that makes a SOAP call to a Web service to get local time
    Rem
    CREATE OR REPLACE PACKAGE time_service AS
    FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2;
    END;
    CREATE OR REPLACE PACKAGE BODY time_service AS
    -- Location of Web service definition
    -- http://www.ripedev.com/webservices/LocalTime.asmx?WSDL
    FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2 IS
    req demo_soap.request;
    resp demo_soap.response;
    BEGIN
    dbms_output.put_line('before new request..');
    req := demo_soap.new_request('LocalTimeByZipCode',
    'xmlns="http://www.ripedev.com/webservices/"');
    dbms_output.put_line('before add param..');
    demo_soap.add_parameter(req, 'ZipCode', 'xsd:string', zipcode);
    dbms_output.put_line('before invoke..');
    resp := demo_soap.invoke(req,
    'http://www.ripedev.com/webservices/LocalTime.asmx',
    'http://www.ripedev.com/webservices/LocalTimeByZipCode');
    dbms_output.put_line('before return..');
    RETURN demo_soap.get_return_value(resp, 'LocalTimeByZipCodeResult',
    'xmlns="http://www.ripedev.com/webservices/"');
    END;
    BEGIN
    * Since the Web service resides outside of the firewall, we need to set
    * the proxy in the current session before invoking the service.
    utl_http.set_proxy('www-proxy', NULL);
    utl_http.set_persistent_conn_support(TRUE);
    dbms_output.put_line('in main..');
    END;
    show errors
    SET serveroutput ON
    exec dbms_output.put_line(time_service.get_local_time('08812'));

    Repost ->method dispatch on NULL SELF argument is disallowed.
    I had another thread with this issue, but I didn't get answer. Can somebody help?

  • Authentication error while consuming web service published in SR of CE 7.1

    Hi,
    I am having this error while trying to consume a web service published in local services registry. Authentication level is set as Basic in the web service and in end point. I am receiving this error in security log files.
    Message:Authentication for web service ServicesRegistrySiService, configuration ServicesRegistrySiPort using security policy sap.com/tcesiuddisrws~earServicesRegistrySiServiceServicesRegistrySiPort*ws failed: Login failed.. (See SAP Note 880896 for further info).
    Category: /System/Security/WS/Authentication
    Location: com.sap.engine.services.wssec.authentication.authenticate
    Application: sap.com/tcesiuddisrws~ear
    Thread: HTTP Worker [1]
    Data Source: j2ee\cluster\server0\log\system\security_00.log
    Correlator ID: 33747500000034965
    Argument Objects: 
    Arguments: 
    DSR Component: 
    DSR Transaction: 72b226c009ed11dd9a3e000c29c818ce
    DSR User: 
    Message Code: 
    Session: 4196
    Transaction: 
    User: Guest
    Host: ########
    System: ###
    Instance: J00
    Node: server0
    following is the code in a C# .Net 2.0 from where the service is called.
                CnarService srv = new CnarService();
                NetworkCredential ic = new NetworkCredential("user", "password");
                CredentialCache cache = new CredentialCache();
                srv.UseDefaultCredentials = false;
                srv.PreAuthenticate = true;
                srv.Credentials = ic;
                try
                    srv.Timeout = 600;
                    cnarobject cnObj = srv.GetObject("1");
                    fnameTextBox.Text = cnObj.firstname;
                    lnameTextBox.Text = cnObj.lastname;
                    mnameTextBox.Text = cnObj.middlename;
                catch (WebException wex)
                    MessageBox.Show(wex.Message + wex.Response + wex.StackTrace);
    I tried to find the SAP Note 880896 but note doesn't exists. I am receiving similar error while trying to connect Enterprise Services explorer for .Net
    Please help.
    Regards
    Monty

    Hi,
    maybe you should see the settings for the ServicesRegistrySiService too. Under nwa->SOA.
    I am not sure, but the error seems like not able to use the ServicesRegistrySiPort, which is to be authenticated against.
    It is then used for retrieval of web services and publishing to the registry... i suppose.
    I am not sure though.
    Best regards,
    Vera

  • RPC Style Web Service and SSL

    Hi,
    Has anyone tried (and maybe succeeded) in accessing an
    RPC-style Web Service deployed on WebLogic Server 6.1 using
    SSL? I have a Web Service deployed and am able to access it using JNDI and the
    weblogic.soap.http.SoapInitialContextFactory
    INITIAL_CONTEXT_FACTORY. However, when I try to set the
    Context.SECURITY_PROTOCOL to "ssl" and access the secure port,
    I get a "java.net.SocketException: Unexpected end of file from
    the server" error message.
    Does the weblogic.soap.http.SoapInitialContextFactory not
    support SSL? Do I need to do the SOAP/XML messaging myself,
    without being able to make use of the WebLogic convenience
    classes? Thanks! Rob

    Alright!
    Glad you got it working ;-)
    Actually, the problem with the protocol being hardcoded to http in the wsdl.jsp,
    is a bit strange. It's unusual that the BEA engineers that coded the wsgen component
    and support classes, didn't use something like the following:
    <soap:address location="<%= request.getScheme() + "://" + request.getServerName()
    + ":" + request.getServerPort() %>/security/examples/webservices/security/PhoneBookService"/>
    I don't use wsgen too much, because I need to have more control over the J2EE
    packaging. It (wsgen) is great for spitting out stuff, but not really setup for
    doing Web service packaging that use classes (i.e. helper files, frameworks, etc.)
    that it doesn't generate. I think they (BEA) might be looking into integrating
    the Web Services assembly process with other tools like WebGain, Forte, etc. to
    alleviate these types of issues.
    Anyway, glad you got it working, so now you can help somebody else (time permitting,
    of course) with this topic in the future!
    Regards,
    Mike Wooten
    "Rob Nelson" <[email protected]> wrote:
    >
    Mike,
    Thank you very much for your response! The next to
    last sentence did it for me (when you mentioned checking
    that the location attribute of the soap:address element
    was set properly)! I noticed that when I viewed the WSDL
    file via the browser (by clicking on the link in the
    index.html page), I saw http://host:<unsecure_port> when
    I requested it over the unsecure port, but I saw
    http://host:<secure_port> when I requested the WSDL over
    the secure port. Notice it did not say https!
    So, I unjarred the EAR file that was generated by my
    wsgen task, and then unjarred the generated WAR file
    contained therein. When I looked at wsdl.jsp, I noticed
    that "http" was hard-coded in the location attribute, but
    that the host name and port number were dynamically
    generated. So I added a scriplet to dynamically place an
    "s" after "http" (if request.isSecure()) and rejarred up
    the WAR and EAR files.
    Now when I deployed the EAR file, I see "https" when
    I request the WSDL over the secure port, and my client
    (actually your client;) works! Awesome! I really appreciate
    your help! Now my only issue is why did the wsdl.jsp have
    "http" hard-coded, not accounting for secure requests.
    These files were generated by the WSGEN task in ANT.
    I figure it's either: I have a configuration problem,
    I have a problem with my ANT build script, my version of
    WebLogic Server (6.1 w/SP1 built 9/18/2001) has a bug, or
    maybe you just have to manually go in and modify the wsdl.jsp
    file if you want to use https :(. Please let me know if
    you have any insight on this, and I will also follow up
    with WebLogic support. Thanks again! Rob
    "Michael Wooten" <[email protected]> wrote:
    Hi Rob,
    I am absolutely sure the code I posted works, so we need to approach
    this from
    a different angle ;-)
    First, I know why the Context.SECURITY_PROTOCOL approach doesn't works.
    It's because
    the namespace in the Web Services code examples is not the same oneas
    the one
    used for RMI objects, EJBs, JDBC Data Sources, etc. For those objects,
    the Context.PROVIDER_URL
    is something like "t3://localhost:7001", and the INITIAL_CONTEXT_FACTORY
    is "weblogic.jndi.WLInitialContextFactory".
    The one being used with WebLogic Web Services, is mainly just functioning
    as a
    mechanism for manufacturing WebServiceProxy objects, because it is a
    non-instanciable!
    It does this by using a subclass of javax.naming.Context called SOAPContext,
    which
    is completely hidden from you, but also doesn't do much except implement
    the lookup()
    method. The implementation of this method ignores the Context.SECURITY_URL
    property,
    but it does pay attention to the "java.naming.security.principal" and
    "java.naming.security.credentials"
    properties. You don't need these properties for SSL, just Basic Authentication.
    Enough about that, though. The service end-point is a servlet right?
    So this means
    it has a URL that begins with http or https, which in turn means the
    WebLogic
    servlet engine gets the SOAP request and sends it to the StatelessSessionAdapter
    servlet. To WLS, this is just like any other HTTP/HTTPS request sent
    to it ;-)
    There is no special "SOAP-related" HTTP/HTTPS handler in WLS, but the
    SSL challenge
    dance still happens. So my first question is, are you sure you havethe
    HTTPS
    attributes set properly in the WebLogic console. SSL/HTTPS should be
    enabled and
    the "Hostname Verification Ignored" checkbox should be checked. Next,
    are you
    sure the URL assigned to the location attribute of the <service> element
    in the
    WSDL is correct (i.e. https://localhost:7002)? Are you using the "dynamic
    client"
    approach?
    Regards,
    Mike Wooten
    "Rob Nelson" <[email protected]> wrote:
    Mike,
    Thanks for your response. I downloaded the code example that
    you
    posted
    last week, as well as the code example that you posted in October for
    a similar
    request (BEA Support pointed me towards that). Unfortunately, I still
    can't get
    the Web Service to respond to the client request when the client uses
    the HTTPS
    port for the WebLogic Server.
    I tried two different client approaches. The first uses the client
    code
    that you posted in October, the WebServiceProxy approach. The second
    approach
    is based on the example in the WebLogic documentation, which uses the
    weblogic.soap.SoapInitialContextFactory
    class with the javax.naming.Context object to perform a lookup on the
    service
    (which closely resembles rmi without the narrowing).
    Both client classes fail to invoke the the service itself viaHTTPS
    (although
    they both work when making HTTP requests to the unsecure port). However,
    when
    I run the client based on the client class that you posted in October
    and make
    an HTTPS request, I can see in the output where it is able to download
    the WSDL
    file and use it (via the WebServiceProxy) to describe the availablemethods
    for
    the associated Web Service. It is only when the actual invoke() method
    is called
    on the SoapMethod object (which in turn sends the XML request to the
    Web Service
    Servlet), that the server doesn't respond, and the client fails with
    an UnexpectedEndOfFileException
    (i.e. no response).
    So, do you know why the servlet that the RPC-style Web Serviceuses
    to handle
    requests would not respond to HTTPS requests, when it processes HTTP
    requests
    without a problem (using the same client code that fails with the HTTPS
    request)?
    I am using WebLogic Server 6.1 w/SP1 on a Solaris 8 platform. Thanks
    for any
    advice you can give me! Rob
    "Michael Wooten" <[email protected]> wrote:
    Hi Rob,
    Check out the attached zip for "insights" into how to do this. It
    contains
    the
    code for two Web service "consumers" (that the new fangled word fora
    "client")
    and the web.xml and weblogic.xml for the RPC-style Web Service, that
    they consume.
    Hope this helps,
    Mike Wooten
    "Rob Nelson" <[email protected]> wrote:
    Hi,
    Has anyone tried (and maybe succeeded) in accessing an
    RPC-style Web Service deployed on WebLogic Server 6.1 using
    SSL? I have a Web Service deployed and am able to access it using
    JNDI
    and the
    weblogic.soap.http.SoapInitialContextFactory
    INITIAL_CONTEXT_FACTORY. However, when I try to set the
    Context.SECURITY_PROTOCOL to "ssl" and access the secure port,
    I get a "java.net.SocketException: Unexpected end of file from
    the server" error message.
    Does the weblogic.soap.http.SoapInitialContextFactory not
    support SSL? Do I need to do the SOAP/XML messaging myself,
    without being able to make use of the WebLogic convenience
    classes? Thanks! Rob

  • Web Start client for two Web Services

    Hello.
    I wrote a client application that uses two different web services.
    Both web services are created using Basic Authentication. They have different user_names and passwords, but must be deployed on the same application server. I must invoked methods of these web services one after another.The problem occures when I invokes mehods of second web service. No matter which of service would be first or second. The problem occurs on second calling. I got this exception:
    EXCEPTION: java.rmi.RemoteException: HTTP Status-Code 403: Access to the requested resource has been denied; nested exception is:
         HTTP Status-Code 403: Access to the requested resource has been denied
         at com.softlets.insurelet.security.InsureletSecurityServiceSEI_Stub.login(InsureletSecurityServiceSEI_Stub.java:89)
         at com.softlets.insurelet.test.TestRefundPolicy.main(TestRefundPolicy.java:61)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    IMPORTANT: Everything worked fine until I started to install this application using Java Web Start.
    MY ASSUMPTION: It's likely to me that web start executes my application in some environment where it caches the first web service's username and password and applies it to the second web service. Because, if I run both web services on my local machine and set ENDPOINT_ADDRESS_PROPERTY to different values (first - localhost:8080, second - 192.168.0.21:8080) everything works fine.
    CODE FRAGMENT:
    public static void main(String[] args) {
    try {          
    String user = "test"; String pass ="test";
    String host = "http://192.168.0.21:8080/insurelet-p/insurelet_p";
    Stub stub = (Stub)(new Insurelet_policies_Impl().getInsureletPoliciesServiceSEIPort()); stub1._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, host);
    stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, user);
    stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, pass);
    InsureletPoliciesServiceSEI ws = (InsureletPoliciesServiceSEI)stub;
    String officeid = "test1"; String operatorid = "test2"; String mct = "1";
    // FIRST WEB SERVICE CALLING
    boolean result = ws.makeRefund(officeid, operatorid, mct);
    String suser = "test"; String spass ="test";
    String shost = "http://192.168.0.21:8080/insurelet-s/insurelet_s";
    Stub stub1 = (Stub)(new Insurelet_security_Impl()).getInsureletSecurityServiceSEIPort();
    stub1._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, suser);
    stub1._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, spass);
    stub1._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, shost);
    InsureletSecurityServiceSEI ws1 = (InsureletSecurityServiceSEI)stub1;
    // SECOND WEB SERVICE CALLING
    OperatorTO to = ws1.login("softlets", "admin", "admin"); // EXCEPTION
    ENVIRONMENT: Both web services are deployed in a single enterprise application on Sun Java System Application Server 8.1.
    Java version: 1.5..0_02

    In case anyone's search leads them here, I've posted the solution at:
    *[http://www.pby.com/general.nsf/webarticles/dominowebservice01]*
    It is an exhaustive article (not "Hello World"!) that goes through several versions of the web service and client - hopefully explaining all* pieces of the puzzle:
    ~ web service code,
    ~ WSDLs
    ~ schema
    ~ thoroughly-documented clients that do and do not use JAXB
    ~ ... that use generated artifacts
    ~ ... that customize existing POJOs
    ~ the SOAP messages generated in each direction
    ~ the necessary JAXB annotations
    ~ explanations of how the code works
    ~ explanations of how namespaces affect the code
    ~ on and on and on...
    My constant goal was to write an uncomplicated solution that uses as few artifacts (two) and annotations as possible. The end result is a small, fast JAX-WS 2.0 client that uses JAXB to invoke and consume a secured Domino 7 (1.4.2 JVM + AXIS) web service, using RPC/literal SOAP messages.

  • 9.0.3 two web services questions

    OK, I'm trying to get web services to work and having two problems.
    The (hopefully) simple one: I want to install a web service on the local OC4J, and I can't seem to get the connection to work. Getting connection refused. Not sure why. Didn't see any problems like this with 9.0.2, but we mostly installed them on 9iAS.
    The more complex one: I started working with a PLSQL web service. While I can't execute it yet (see above), I can create one with a simple return type. For example, something like f_seq_to_name (i_seq in number) return varchar2. And the stub is pretty easy.
    But if I want to return a rowtype, for example
    f_seq_to_row (i_seq in number) return facility_table%rowtype,
    the routine is grayed out because JDev decides there is an out parameter of type "null". I could explicitly include each individual parameter, but that seems like a waste of developer effort. And this happens for both rowtypes and ref cursors, so it will be pretty hard to move any significant amount of data. So am I missing something, or is this a bug? If it's a bug, will it be fixed in 9.0.3 production?
    Of course, I can go over to BC4J and try this there with view objects. But I'm looking to see which of the tools are usable.
    -- jim

    Here is some pointers that might help:
    1. A PL/SQL Web Services Tutorial using Oracle9i JDeveloper 9.0.3 including the setup necessary to configure OC4J. As you will see you don't have to actually create a SOAP connection in JDev; for PL/SQL you simply need to have an app server connection as per the writeup. See:
    http://otn.oracle.com/tech/webservices/htdocs/series/plsql/content.html
    2. To see what data types are supported for PL/SQL take a look at:
    http://otn.oracle.com/docs/products/ias/doc_library/90200doc_otn/web.902/a95453/plsqlservices.htm#1030045
    ROWTYPE and REFCURSOR are not supported. This does not appear to change between 9.0.3 preview and 9.0.3 production. There are some other approaches to consider, though your milage may vary. For example, VARRAYS and abstract datatypes are supported - you can see the ADT support in the above tutorial and try VARRAYs by tweaking it to return an array of employees rather than a single employee.
    Hope this gets you going.
    Mike.

Maybe you are looking for