使用UTL_DBWS包从oracle(PL / sql)调用.net WS(OPERATION_STYLE = document)

时间:2012-05-31 11:20:45

标签: asp.net web-services oracle plsql

我使用ASP.NET创建了一个Web服务。 我试图通过UTL_DBWS包从PL / sql程序访问这个url。执行后我收到以下错误:

ORA-29532:Java调用因未捕获的Java异常而终止:port:{http://tempuri.org/}Service1Soap 不包含操作:信封

您是否可以告诉我缺少哪些配置步骤。

我真的很乐意帮助你。

调用asp.net服务的Oracle过程是:

create or replace procedure check_dbws

AS

    l_service          UTL_DBWS.service;
    l_call             UTL_DBWS.call;

    l_wsdl_url         VARCHAR2(32767);
    l_namespace        VARCHAR2(32767);
    l_service_qname    UTL_DBWS.qname;
    l_port_qname       UTL_DBWS.qname;
    l_operation_qname  UTL_DBWS.qname;

    l_xmltype_in       SYS.XMLTYPE;
    l_xmltype_out      SYS.XMLTYPE;
    p_fault_node         xmltype;
    l_return           NUMBER;
    l_int_type  utl_dbws.qname;
    l_string_type utl_dbws.QNAME;
BEGIN

    l_wsdl_url := 'http://localhost/TestWebService/Service1.asmx?wsdl';
    l_namespace := 'http://tempuri.org/';

    l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Service1');
    l_port_qname := UTL_DBWS.to_qname(l_namespace, 'Service1Soap');
    l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'DBConnect');

    l_service := UTL_DBWS.create_service (
    wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
    service_name => l_service_qname);

    l_call := UTL_DBWS.create_call (
    service_handle => l_service,
    port_name => l_port_qname,
    operation_name => l_operation_qname);
    utl_dbws.set_property (l_call,'SOAPACTION_USE','TRUE');
    utl_dbws.set_property (l_call,'SOAPACTION_URI', 'DBConnect');

    utl_dbws.set_property(l_call,'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
    utl_dbws.set_property(l_call,'OPERATION_STYLE', 'document'); 

    l_string_type :=utl_dbws.to_qname('http://www.w3.org/2001/xmlschema','String'); 
    utl_dbws.add_parameter(l_call,'Request',l_string_type,'ParameterMode.IN');
    utl_dbws.set_return_type(l_call,l_string_type);
    l_xmltype_in:=sys.xmltype('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v002="http://tempuri.org/DBConnect">
    <soapenv:Header/>
    <soapenv:Body>
    <DBConnect>
    <Name>Test</Name>
    <DBConnect>
    </soapenv:Body>
    </soapenv:Envelope>');


    l_xmltype_out := UTL_DBWS.invoke (call_handle => l_call,,request => l_xmltype_in);
    p_fault_node := l_xmltype_out.extract('//soap:Fault', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/');
    if (p_fault_node is not null) then
        dbms_output.put_line(p_fault_node.getclobval());

        l_return:=2;
    elsif l_xmltype_out is not null then
        dbms_output.put_line(l_xmltype_out.getclobval());
        l_return:=1;
    else
        dbms_output.put_line('errorin fault'||sqlerrm);
        l_return:=0;
    end if;

    UTL_DBWS.release_call (call_handle => l_call);
    UTL_DBWS.release_service (service_handle => l_service);
    dbms_output.put_line(l_result.AccessVarchar2);
END;

1 个答案:

答案 0 :(得分:0)

在这里查看我的answer;您可能没有使UTL_DBWS工作所需的所有Java类。而且,根据我的回答,我会重申,我发现使用UTL_HTTP要比UTL_DBWS容易得多,并继续使用UTL_HTTP,因为我遇到了很多UTL_DBWS的限制和问题。