Home » SQL & PL/SQL » SQL & PL/SQL » Calling Web Service using UTL_DBWS
Calling Web Service using UTL_DBWS [message #627697] Fri, 14 November 2014 17:18 Go to next message
RAY_HT
Messages: 155
Registered: May 2005
Location: Giza
Senior Member
Dears ,
i'm trying to test calling Web Services using UTL_DBWS but i got error " .....does not contain port"
my code as following as following:
CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER,
p_int_2 IN NUMBER)
RETURN NUMBER
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;
l_return NUMBER;
BEGIN
l_wsdl_url := 'http://oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://oracle-base.com/webservices/';

l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Calculator');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'CalculatorPort');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'ws_add');

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);

l_xmltype_in := SYS.XMLTYPE('<?xml version="1.0" encoding="utf-8"?>
<ws_add xmlns="' || l_namespace || '">
<int1>' || p_int_1 || '</int1>
<int2>' || p_int_2 || '</int2>
</ws_add>');
l_xmltype_out := UTL_DBWS.invoke(call_Handle => l_call,
request => l_xmltype_in);

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

l_return := l_xmltype_out.extract('//return/text()').getNumberVal();
RETURN l_return;
END;

----------------------------------------------------------------------------
the web service WSDL is

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.oracle-base.com/webservices/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://www.oracle-base.com/webservices/">
<types>
<xsd:schema targetNamespace="http://www.oracle-base.com/webservices/">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
<message name="ws_addRequest">
<part name="int1" type="xsd:string"/>
<part name="int2" type="xsd:string"/>
</message>
<message name="ws_addResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="CalculatorPortType">
<operation name="ws_add">
<input message="tns:ws_addRequest"/>
<output message="tns:ws_addResponse"/>
</operation>
</portType>
<binding name="CalculatorBinding" type="tns:CalculatorPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="ws_add">
<soap:operation soapAction="http://oracle-base.com/webservices/server.php/ws_add" style="rpc"/>
<input>
<soap:body use="encoded" namespace="http://www.oracle-base.com/webservices/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="http://www.oracle-base.com/webservices/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="Calculator">
<port name="CalculatorPort" binding="tns:CalculatorBinding">
<soap:address location="http://oracle-base.com/webservices/server.php"/>
</port>
</service>
</definitions>
Re: Calling Web Service using UTL_DBWS [message #627698 is a reply to message #627697] Fri, 14 November 2014 18:10 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/ and read http://www.orafaq.com/forum/t/174502/
Re: Calling Web Service using UTL_DBWS [message #627729 is a reply to message #627698] Sat, 15 November 2014 07:00 Go to previous message
RAY_HT
Messages: 155
Registered: May 2005
Location: Giza
Senior Member
thanks for your usual reply , nothing help
Previous Topic: Sync master and local database
Next Topic: Error encountered while deleting a record with foreign key relationship.
Goto Forum:
  


Current Time: Thu Mar 28 23:59:03 CDT 2024