Oracle stored procedure调用web service
create or replace FUNCTION TESTBCWEBSERVICE 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_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;
以下是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>
-
<
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
" >
-
<
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
="
userID
"
type
="
xsd:string
" />
<
wsdl:part
name
="
password
"
type
="
xsd:string
" />
-
<
wsdl:portType name
="
BCWebService
" >
-
<
wsdl:operation name
="
main
"
parameterOrder
="
args
" >
<
wsdl:input
message
="
impl:mainRequest
"
name
="
mainRequest
" />
<
wsdl:output
message
="
impl:mainResponse
"
name
="
mainResponse
" />
</
wsdl:operation
>
-
<
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:portType
>
-
<
wsdl:binding name
="
BCWebServiceSoapBinding
"
type
="
impl:BCWebService
" >
<
wsdlsoap:binding
style
="
rpc
"
transport
="
http://schemas.xmlsoap.org/soap/http
" />
-
<
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: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: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
>
注意其中蓝色字的对应