1 Reply Latest reply: Jun 22, 2009 4:55 PM by 450560 RSS

    OCS Calendar and SOAP (PL/SQL)

    107478
      I tried to make a connection between Calendar (Webservice) and DB (PLSQL
      UTL_HTTP). When I use the Web Service Toolkit, all works fine. When I use the
      Procedure, I get an error:
      "Content-Type: text/html; charset=iso-8859-1"
      When I use encode_text, I get the following error:
      "<faultstring>An XML parsing fatal error occurred Line: 4 Column: 76 Error
      Expected end of tag &apos;SOAP-ENV:Envelope&apos;</faultstring>"
      What is wrong?

      This is the procedure
      CREATE OR REPLACE PROCEDURE TEST AS
      req utl_http.req;
      resp utl_http.resp;
      name VARCHAR2(256);
      value VARCHAR2(30000);
      url VARCHAR(200);
      BEGIN

      url := 'http://ocs.system4.de:7778/ocws-bin/ocas.fcgi';
      utl_http.set_response_error_check(FALSE);

      value := '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><cwsl:NoOp xmlns:cwsl="http://www.oracle.com/WebServices/Calendaring/1.0/"/></SOAP-ENV:Body></SOAP-ENV:Envelope>';

      -- value := utl_encode.text_encode(value,'UTF8');
      -- value := replace(value,'3D','');

      utl_http.set_body_charset('UTF8');
      req := utl_http.begin_request(url,'POST','HTTP/1.1');
      utl_http.set_body_charset(req, 'UTF8');
      utl_http.set_header(req, 'Content-Type', 'text/xml;charset="UTF-8"');
      utl_http.set_header(req, 'Content-Length',length(value));
      utl_http.set_header(req, 'SOAPAction','"http://ocs.system4.de:7778/ocws-bin/ocas.fcgi/"');
      utl_http.write_text(req,value);
      resp := utl_http.get_response(req);

      FOR i IN 1..utl_http.get_header_count(resp) LOOP
      utl_http.get_header(resp, i, name, value);
      dbms_output.put_line(name || ': ' || value);
      END LOOP;
      begin
      LOOP
           utl_http.read_line(resp, value, TRUE);
      dbms_output.put_line(name || ': ' || value);
      END LOOP;
      utl_http.end_response(resp);
      EXCEPTION
      WHEN utl_http.end_of_body THEN
      utl_http.end_response(resp);
      when others then dbms_output.put_line ('Fehler: ' || sqlerrm);
      END;
      END;
      /