ORA-29541: class SYS.oracle/jpub/runtime/dbws/DbwsProxy could not be resolved

在oracle10.1.2中用function调用webservcie出现如下错误:

"ORA-29541: class SYS.oracle/jpub/runtime/dbws/DbwsProxy could not be resolved"

 

这是因为需要导入一些包(详情可参考http://www.oracle-base.com/articles/10g/utl_dbws10g.php


First, download the latest copy of the dbwsclient.jar file:

Extract the jar file from the zip file into the $ORACLE_HOME/sqlj/lib directory.

 

 # Load into the SYS schema.
export PATH=/u01/app/oracle/product/10.2.0/db_1/bin:$PATH
cd /u01/app/oracle/product/10.2.0/db_1/sqlj/lib
# 10gR2
loadjava -u sys/password -r -v -f -genmissing -s -grant public dbwsclientws.jar

# 11g
loadjava -u sys/password -r -v -f -genmissing -s -grant public dbwsclientws.jar

原文中提到也可以导入单个的schema,但是我导入后还是有问题。In Oracle 10g the UTL_DBWS package is loaded by default,所以我就用sys.UTL_DBWS.

我下载的是第二个包。

在导入的过程中正常情况下没有错误,那就要恭喜你了。可是事与愿违,经常会产生错误,所以当运行webservice代码时还会报上面的错误!!!

解决如下:

解压dbwsclientws.jar 找到oracle下的jpub/runtime/dbws整个目录,拷贝出来,重新打包,再重新单独导入这个包即可。将我重新打包的jar上传一下(看附件)

 

loadjava -u sys/password -r -v -f -genmissing -s -grant public dbwsproxy.jar

 

示例:

以下是我的wsdl:

  <?xml version="1.0" encoding="UTF-8" ?>
- < wsdl:definitions targetNamespace =" http://192.168.88.126:8400/axis/BCWebService.jws " xmlns:apachesoap =" http://xml.apache.org/xml-soap " xmlns:impl =" http://192.168.88.126:8400/axis/BCWebService.jws " xmlns:intf =" http://192.168.88.126:8400/axis/BCWebService.jws " xmlns:soapenc =" http://schemas.xmlsoap.org/soap/encoding/ " xmlns:wsdl =" http://schemas.xmlsoap.org/wsdl/ " xmlns:wsdlsoap =" http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:xsd =" http://www.w3.org/2001/XMLSchema ">
- <!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
  --> <script></script>
- < wsdl:types >
- < schema targetNamespace =" http://192.168.88.126:8400/axis/BCWebService.jws " xmlns =" http://www.w3.org/2001/XMLSchema ">
  < import namespace =" http://schemas.xmlsoap.org/soap/encoding/ " />
- < complexType name =" ArrayOf_xsd_string ">
- < complexContent >
- < restriction base =" soapenc:Array ">
  < attribute ref =" soapenc:arrayType " wsdl:arrayType =" xsd:string[] " />
  </ restriction >
  </ complexContent >
  </ complexType >
  </ schema >
  </ wsdl:types >
- < wsdl:message name =" mainRequest ">
  < wsdl:part name =" args " type =" impl:ArrayOf_xsd_string " />
  </ wsdl:message >
- < wsdl:message name =" validateXMLResponse ">
  < wsdl:part name =" validateXMLReturn " type =" xsd:string " />
  </ wsdl:message >
  < wsdl:message name =" mainResponse " />
- < wsdl:message name =" validateXMLRequest ">
  < wsdl:part name =" medicalGroup " type =" xsd:string " />
  < wsdl:part name =" requestTicket " type =" xsd:string " />
  < wsdl:part name =" userID " type =" xsd:string " />
  < wsdl:part name =" password " type =" xsd:string " />
  < wsdl:part name =" claimDate " type =" xsd:string " />
  < wsdl:part name =" memberKey1 " type =" xsd:string " />
  < wsdl:part name =" memberKey2 " type =" xsd:string " />
  < wsdl:part name =" doctorCode " type =" xsd:string " />
  </ wsdl:message >
- < wsdl:portType name =" BCWebService ">
- < wsdl:operation name =" validateXML " parameterOrder =" medicalGroup requestTicket userID password claimDate memberKey1 memberKey2 doctorCode ">
  < wsdl:input message =" impl:validateXMLRequest " name =" validateXMLRequest " />
  < wsdl:output message =" impl:validateXMLResponse " name =" validateXMLResponse " />
  </ wsdl:operation >
- < wsdl:operation name =" main " parameterOrder =" args ">
  < wsdl:input message =" impl:mainRequest " name =" mainRequest " />
  < wsdl:output message =" impl:mainResponse " name =" mainResponse " />
  </ wsdl:operation >
  </ wsdl:portType >
- < wsdl:binding name =" BCWebServiceSoapBinding " type =" impl:BCWebService ">
  < wsdlsoap:binding style =" rpc " transport =" http://schemas.xmlsoap.org/soap/http " />
- < wsdl:operation name =" validateXML ">
  < wsdlsoap:operation soapAction ="" />
- < wsdl:input name =" validateXMLRequest ">
  < wsdlsoap:body encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/ " namespace =" http://DefaultNamespace " use =" encoded " />
  </ wsdl:input >
- < wsdl:output name =" validateXMLResponse ">
  < wsdlsoap:body encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/ " namespace =" http://192.168.88.126:8400/axis/BCWebService.jws " use =" encoded " />
  </ wsdl:output >
  </ wsdl:operation >
- < wsdl:operation name =" main ">
  < wsdlsoap:operation soapAction ="" />
- < wsdl:input name =" mainRequest ">
  < wsdlsoap:body encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/ " namespace =" http://DefaultNamespace " use =" encoded " />
  </ wsdl:input >
- < wsdl:output name =" mainResponse ">
  < wsdlsoap:body encodingStyle =" http://schemas.xmlsoap.org/soap/encoding/ " namespace =" http://192.168.88.126:8400/axis/BCWebService.jws " use =" encoded " />
  </ wsdl:output >
  </ wsdl:operation >
  </ wsdl:binding >
- < wsdl:service name =" BCWebServiceService ">
- < wsdl:port binding =" impl:BCWebServiceSoapBinding " name =" BCWebService ">
  < wsdlsoap:address location =" http://192.168.88.126:8400/axis/BCWebService.jws " />
  </ wsdl:port >
  </ wsdl:service >
  </ wsdl:definitions >

下面是oracle function:

-------------------------------------------------------------------------------------

create or replace
FUNCTION get_city_from_zipcode (p_zipcode  IN  VARCHAR2)
  RETURN VARCHAR2
AS
  l_service  sys.UTL_DBWS.service;
  l_call     sys.UTL_DBWS.call;
  l_result   ANYDATA;
 
  l_wsdl_url         VARCHAR2(32767);
  l_namespace        VARCHAR2(32767);
  l_service_qname    sys.UTL_DBWS.qname;
  l_port_qname       sys.UTL_DBWS.qname;
  l_operation_qname  sys.UTL_DBWS.qname;
  l_input_params     sys.UTL_DBWS.anydata_list;
BEGIN
  l_wsdl_url        := 'http://192.168.88.126:8400/axis/BCWebService.jws?wsdl';
  l_namespace       := 'http://192.168.88.126:8400/axis/BCWebService.jws';

  l_service_qname   := sys.UTL_DBWS.to_qname(l_namespace, 'BCWebServiceService');
  l_port_qname      := sys.UTL_DBWS.to_qname(l_namespace, 'BCWebService');
  l_operation_qname := sys.UTL_DBWS.to_qname(l_namespace, 'validateXML');

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

  l_call := sys.UTL_DBWS.create_call (
    service_handle => l_service,
    port_name      => l_port_qname,
    operation_name => l_operation_qname);

  l_input_params(0) := ANYDATA.ConvertVarchar2('55555');
   l_input_params(1) := ANYDATA.ConvertVarchar2('11111111');
    l_input_params(2) := ANYDATA.ConvertVarchar2('11111111');
     l_input_params(3) := ANYDATA.ConvertVarchar2('11111111');
      l_input_params(4) := ANYDATA.ConvertVarchar2('20091103');
       l_input_params(5) := ANYDATA.ConvertVarchar2('11111111');
        l_input_params(6) := ANYDATA.ConvertVarchar2('11111111');
         l_input_params(7) := ANYDATA.ConvertVarchar2('55555');
 
  l_result := sys.UTL_DBWS.invoke (
    call_handle  => l_call,
    input_params => l_input_params);

  sys.UTL_DBWS.release_call (call_handle => l_call);
  sys.UTL_DBWS.release_service (service_handle => l_service);

  RETURN ANYDATA.AccessVarchar2(l_result);
END;

 ---------------------------------------------------------------------------------------------------------------------

 

执行成功!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值