Consuming Web Services using UTL_DBWS
Hi,
I am trying to call a web service using UTL_DBWS package.
But I am getting this error:
ORA-29532: Java call terminated by uncaught Java exception: [failed to localize] No Deserializer found!
It is failing at this point:
l_result := sys.UTL_DBWS.invoke (
call_handle => l_call,
input_params => l_input_params);
Is this a problem with database or Web Service? How to resolve this?
No awnsers???
I'm having the same problem here....
Similar Messages
-
Unable to call WSS (WS-Security) enabled Web Service using UTL_DBWS
We are attempting to call a WSS (WS-Security) enabled Web Service from PL/SQL using the UTL_DBWS package (see [http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_dbws.htm#CHDIDGJH] ). We are doing this in similar fashion to [http://www.oracle-base.com/articles/10g/utl_dbws10g.php] with calls to utl_dbws.create_service, utl_dbws.create_call and utl_dbws.invoke.
Using this method we can successfully call an unsecured Web Service, but calls to WSS-enabled Web Services fail. We are currently using Oracle Database 10.2.0.3.
The failure we are getting is:
ORA-29532: Java call terminated by uncaught Java exception: javax.xml.rpc.soap.SOAPFaultException:
com.sun.xml.wss.XWSSecurityException: Message does not conform to configured
policy ( AuthenticationTokenPolicy(S) ): No Security Header found;nested
exception is com.sun.xml.wss.XWSSecurityException:
com.sun.xml.wss.XWSSecurityException: Message does not conform to configured
policy ( AuthenticationTokenPlicy(S) ): No Security Header found
Apparently UTL_DBWS does not support calling WSS enabled services, although this doesn't appear to be an officially recognised position. Does anyone know if Oracle are planning to support this soon (if ever)? Looking at Re: Calling WS from PL/SQL using WS-security suggests that support has been considered before, but not yet realised.
Thanks,
TomHaving raised a Service Request with Oracle support on this, I got the following response from Oracle Development (On unpublished bug [8542959|https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=BUG&p_id=8542959]):
Development has confirmed that WS-Security is not supported through UTL_DBWS. They have also acknowledged that this is not documented and they will change the official Oracle documentation will reflect this fact. From what is being stated, it would appear that there is no plan to support the use of WS-Security through UTL_DBWS in any release in the near future.
So, in short, without developing your own home-grown SOAP request, there is no way to call a WSS enabled web service from within PL/SQL.
-Tom -
Consuming Web Service using WS-Security: USERNAME Token
Hi ABAP Experts,
we like to consume a self defined web service between to SAP systems (ECC6 701/006). Without any security settings the connection is successfully. But we like to setup a message security like USERNAME Token.
The wss profiles are already created by using TX: WSSPROFILE. Therefore we used the templates "SET_USERNAME" and "CHECK_USERNAME". The service user "DELAY_L<sid>" has been generated as well. The problem is in SOAMANAGER we can't find the related configuration (For Provider and Consumer) to set the parameters "PROFILE In" and "Profile Out" like it was in the obsolete TX "LPCONFIG".
Can anybody help me to find out how to configure USERNAME Token using SOAMANAGER.
Thank you very much in advance.
Kind regards
AxelHi,
The following articles would be helpful:
.net call WS-Security enabled web service (created in java)
http://stackoverflow.com/questions/2138129/net-call-ws-security-enabled-web-service-created-in-java
WS-Security Protocol with .NET – A Overview
http://www.c-sharpcorner.com/UploadFile/mahesha/WSSecurityProtocol11232005052243AM/WSSecurityProtocol.aspx
An introduction to Web Service Security using WSE - Part I
http://www.codeproject.com/Articles/7062/An-introduction-to-Web-Service-Security-using-WSE
As this question is not relate to SharePoint, I suggest you post it to a suitable Forum, you will get more help and confirmed answers from there.
Best Regards
Dennis Guo
TechNet Community Support -
ORA-29532 error when invoking SSL web services using UTL_DBWS
Web Service gurus,
The WSDL for web services is as follows -
<definitions name="Webservice" targetNamespace="http://webservice.airclic.com/">
−
<types>
−
<xs:schema targetNamespace="http://webservice.airclic.com/" version="1.0">
<xs:element name="Exception" type="tns:Exception"/>
<xs:element name="listenForEvents" type="tns:listenForEvents"/>
<xs:element name="listenForEventsResponse" type="tns:listenForEventsResponse"/>
<xs:element name="sendAuthenticationResponse" type="tns:sendAuthenticationResponse"/>
<xs:element name="sendAuthenticationResponseResponse" type="tns:sendAuthenticationResponseResponse"/>
<xs:element name="upsertTask" type="tns:upsertTask"/>
<xs:element name="upsertTaskResponse" type="tns:upsertTaskResponse"/>
−
<xs:complexType name="upsertTask">
−
<xs:sequence>
<xs:element minOccurs="0" name="task" type="tns:Task"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Task">
−
<xs:complexContent>
−
<xs:extension base="tns:PlatformObject">
−
<xs:sequence>
<xs:element minOccurs="0" name="status" type="tns:status"/>
<xs:element minOccurs="0" name="assignee" type="xs:string"/>
<xs:element minOccurs="0" name="assigneeUserId" type="xs:string"/>
<xs:element minOccurs="0" name="name" type="xs:string"/>
<xs:element minOccurs="0" name="type" type="xs:string"/>
<xs:element minOccurs="0" name="creationTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="updateTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="startTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="endTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="source" type="tns:source"/>
<xs:element minOccurs="0" name="notes" type="xs:string"/>
<xs:element minOccurs="0" name="priority" type="xs:int"/>
<xs:element minOccurs="0" name="penalized" type="xs:boolean"/>
<xs:element minOccurs="0" name="hasSLA" type="xs:boolean"/>
<xs:element minOccurs="0" name="location" type="tns:Location"/>
<xs:element minOccurs="0" name="windowStartTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="windowEndTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="signee" type="xs:string"/>
<xs:element minOccurs="0" name="signature" type="xs:base64Binary"/>
<xs:element minOccurs="0" name="customerId" type="xs:string"/>
<xs:element minOccurs="0" name="travelTime" type="xs:int"/>
<xs:element minOccurs="0" name="expirationTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="parentId" type="xs:long"/>
<xs:element minOccurs="0" name="externalTimezone" type="xs:string"/>
<xs:element minOccurs="0" name="localTimeOffset" type="xs:long"/>
<xs:element minOccurs="0" name="consignee" type="xs:string"/>
<xs:element minOccurs="0" name="assignmentWindowStartTimestamp" type="xs:long"/>
<xs:element minOccurs="0" name="assignmentWindowEndTimestamp" type="xs:long"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="PlatformObject">
−
<xs:sequence>
<xs:element name="id" type="xs:string"/>
<xs:element name="externalId" type="xs:string"/>
<xs:element name="revision" type="xs:long"/>
<xs:element name="platformDateCreated" type="xs:dateTime"/>
<xs:element name="platformDateUpdated" type="xs:dateTime"/>
<xs:element name="objectName" type="xs:string"/>
<xs:element maxOccurs="unbounded" name="extendedAttributes" type="tns:ExtendedAttribute"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Location">
−
<xs:sequence>
<xs:element minOccurs="0" name="name" type="xs:string"/>
<xs:element minOccurs="0" name="description" type="xs:string"/>
<xs:element minOccurs="0" name="type" type="xs:string"/>
<xs:element minOccurs="0" name="address" type="tns:Address"/>
<xs:element minOccurs="0" name="position" type="tns:Position"/>
<xs:element minOccurs="0" name="geofenceId" type="xs:long"/>
<xs:element minOccurs="0" name="capcity" type="xs:int"/>
<xs:element minOccurs="0" name="contact" type="xs:string"/>
<xs:element minOccurs="0" name="email" type="xs:string"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Address">
−
<xs:sequence>
<xs:element minOccurs="0" name="addressLine" type="xs:string"/>
<xs:element minOccurs="0" name="addressLine2" type="xs:string"/>
<xs:element minOccurs="0" name="city" type="xs:string"/>
<xs:element minOccurs="0" name="secondaryCity" type="xs:string"/>
<xs:element minOccurs="0" name="subdivision" type="xs:string"/>
<xs:element minOccurs="0" name="postalCode" type="xs:string"/>
<xs:element minOccurs="0" name="country" type="xs:string"/>
<xs:element minOccurs="0" name="phone" type="xs:string"/>
<xs:element minOccurs="0" name="freeform" type="xs:string"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Position">
−
<xs:sequence>
<xs:element name="latitude" type="xs:double"/>
<xs:element name="longitude" type="xs:double"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="ExtendedAttribute">
−
<xs:sequence>
<xs:element name="name" type="xs:string"/>
<xs:element name="value" type="xs:anyType"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="upsertTaskResponse">
−
<xs:sequence>
<xs:element minOccurs="0" name="task" type="tns:Task"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Exception">
−
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="listenForEvents">
−
<xs:sequence>
<xs:element minOccurs="0" name="listenParams" type="tns:ListenParams"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="ListenParams">
−
<xs:sequence>
<xs:element name="queueName" type="xs:string"/>
<xs:element name="resendLast" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="listenForEventsResponse">
−
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="events" type="tns:Event"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="Event">
−
<xs:sequence>
<xs:element name="id" type="xs:string"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="AuthenticationRequestEvent">
−
<xs:complexContent>
−
<xs:extension base="tns:RequestEvent">
−
<xs:sequence>
<xs:element name="username" type="xs:string"/>
<xs:element minOccurs="0" name="password" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="RequestEvent">
−
<xs:complexContent>
−
<xs:extension base="tns:Event">
−
<xs:sequence>
<xs:element name="correlationId" type="xs:string"/>
<xs:element name="response" type="tns:Response"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="Response">
−
<xs:sequence>
<xs:element name="correlationId" type="xs:string"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="AuthenticationResponse">
−
<xs:complexContent>
−
<xs:extension base="tns:Response">
−
<xs:sequence>
<xs:element name="success" type="xs:boolean"/>
<xs:element name="username" type="xs:string"/>
<xs:element minOccurs="0" name="password" type="xs:string"/>
<xs:element minOccurs="0" name="firstName" type="xs:string"/>
<xs:element minOccurs="0" name="lastName" type="xs:string"/>
<xs:element minOccurs="0" name="email" type="xs:string"/>
<xs:element minOccurs="0" name="active" type="xs:boolean"/>
<xs:element minOccurs="0" name="timeZone" type="xs:string"/>
<xs:element minOccurs="0" name="group" type="xs:string"/>
<xs:element minOccurs="0" name="role" type="xs:string"/>
<xs:element minOccurs="0" name="errorCode" type="xs:string"/>
<xs:element minOccurs="0" name="errorMessage" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="DispatchEvent">
−
<xs:complexContent>
−
<xs:extension base="tns:Event">
−
<xs:sequence>
<xs:element name="type" type="tns:eventType"/>
<xs:element minOccurs="0" name="previousTask" type="tns:Task"/>
<xs:element name="changeTask" type="tns:Task"/>
<xs:element minOccurs="0" name="newTask" type="tns:Task"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
−
<xs:complexType name="sendAuthenticationResponse">
−
<xs:sequence>
<xs:element minOccurs="0" name="authenticationResponse" type="tns:AuthenticationResponse"/>
</xs:sequence>
</xs:complexType>
−
<xs:complexType name="sendAuthenticationResponseResponse">
<xs:sequence/>
</xs:complexType>
−
<xs:simpleType name="status">
−
<xs:restriction base="xs:string">
<xs:enumeration value="NULL"/>
<xs:enumeration value="UNASSIGNED"/>
<xs:enumeration value="ASSIGNED"/>
<xs:enumeration value="RECEIVED"/>
<xs:enumeration value="ACCEPTED"/>
<xs:enumeration value="REJECTED"/>
<xs:enumeration value="IN_PROGRESS"/>
<xs:enumeration value="POSTPONED"/>
<xs:enumeration value="COMPLETED"/>
<xs:enumeration value="CANCELED"/>
<xs:enumeration value="CLEARED"/>
<xs:enumeration value="EXPIRED"/>
</xs:restriction>
</xs:simpleType>
−
<xs:simpleType name="source">
−
<xs:restriction base="xs:string">
<xs:enumeration value="NULL"/>
<xs:enumeration value="DISPATCH"/>
<xs:enumeration value="SYSTEM"/>
<xs:enumeration value="ENDUSER"/>
</xs:restriction>
</xs:simpleType>
−
<xs:simpleType name="eventType">
−
<xs:restriction base="xs:string">
<xs:enumeration value="TaskCreated"/>
<xs:enumeration value="TaskUpdated"/>
<xs:enumeration value="TaskAssigned"/>
<xs:enumeration value="TaskDeleted"/>
<xs:enumeration value="TaskStatusChanged"/>
<xs:enumeration value="TaskConflicted"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
</types>
−
<message name="Webservice_listenForEvents">
<part element="tns:listenForEvents" name="listenForEvents"/>
</message>
−
<message name="Webservice_sendAuthenticationResponseResponse">
<part element="tns:sendAuthenticationResponseResponse" name="sendAuthenticationResponseResponse"/>
</message>
−
<message name="Webservice_sendAuthenticationResponse">
<part element="tns:sendAuthenticationResponse" name="sendAuthenticationResponse"/>
</message>
−
<message name="Webservice_upsertTaskResponse">
<part element="tns:upsertTaskResponse" name="upsertTaskResponse"/>
</message>
−
<message name="Exception">
<part element="tns:Exception" name="Exception"/>
</message>
−
<message name="Webservice_upsertTask">
<part element="tns:upsertTask" name="upsertTask"/>
</message>
−
<message name="Webservice_listenForEventsResponse">
<part element="tns:listenForEventsResponse" name="listenForEventsResponse"/>
</message>
−
<portType name="Webservice">
−
<operation name="listenForEvents" parameterOrder="listenForEvents">
<input message="tns:Webservice_listenForEvents"/>
<output message="tns:Webservice_listenForEventsResponse"/>
<fault message="tns:Exception" name="Exception"/>
</operation>
−
<operation name="sendAuthenticationResponse" parameterOrder="sendAuthenticationResponse">
<input message="tns:Webservice_sendAuthenticationResponse"/>
<output message="tns:Webservice_sendAuthenticationResponseResponse"/>
<fault message="tns:Exception" name="Exception"/>
</operation>
−
<operation name="upsertTask" parameterOrder="upsertTask">
<input message="tns:Webservice_upsertTask"/>
<output message="tns:Webservice_upsertTaskResponse"/>
<fault message="tns:Exception" name="Exception"/>
</operation>
</portType>
−
<binding name="WebserviceBinding" type="tns:Webservice">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
−
<operation name="listenForEvents">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
−
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
−
<operation name="sendAuthenticationResponse">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
−
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
−
<operation name="upsertTask">
<soap:operation soapAction=""/>
−
<input>
<soap:body use="literal"/>
</input>
−
<output>
<soap:body use="literal"/>
</output>
−
<fault name="Exception">
<soap:fault name="Exception" use="literal"/>
</fault>
</operation>
</binding>
−
<service name="Webservice">
−
<port binding="tns:WebserviceBinding" name="WebservicePort">
<soap:address location="https://webservice.mp.b.airclic.com:443/webservice/product/fieldservice/v1/Webservice"/>
</port>
</service>
</definitions>
Following is the pl/sql code using UTL_DBWS
DECLARE
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_input_params UTL_DBWS.anydata_list;
soap_request xmltype;
l_result xmltype;
result_output VARCHAR2(32767);
BEGIN
l_wsdl_url := 'https://webservice.mp.b.airclic.com/webservice/product/fieldservice/v1/Webservice?WSDL';
l_namespace := 'http://webservice.airclic.com/';
dbms_output.put_line ('1');
l_service_qname := UTL_DBWS.to_qname(l_namespace, 'Webservice');
dbms_output.put_line ('2');
l_port_qname := UTL_DBWS.to_qname(l_namespace, 'WebservicePort');
dbms_output.put_line ('3');
l_operation_qname := UTL_DBWS.to_qname(l_namespace, 'sendAuthenticationResponse');
dbms_output.put_line ('4');
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
dbms_output.put_line ('5');
l_call := UTL_DBWS.create_call (
service_handle => l_service,
port_name => l_port_qname,
operation_name => l_operation_qname);
dbms_output.put_line ('6');
UTL_DBWS.SET_PROPERTY(l_call,'USERNAME',<username to access wsdl>);
dbms_output.put_line ('7');
UTL_DBWS.SET_PROPERTY(l_call,'PASSWORD',<password>);
dbms_output.put_line ('8');
utl_dbws.set_property(l_call,'OPERATION_STYLE', 'document');
dbms_output.put_line ('9');
soap_request := xmltype.createxml('<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:sendAuthenticationResponse xmlns:ns2="http://webservice.airclic.com/">
<authenticationResponse>
<correlationId>4646735802698040711:[email protected]</correlationId>
<success>true</success>
<username>changlanih</username>
<password>abcd1234</password>
<firstName>hero</firstName>
<lastName>changlani</lastName>
<email>[email protected]</email>
<active>true</active>
<timeZone>eastern</timeZone>
<group>Northeast</group>
<role>Service Manager</role>
</authenticationResponse>
</ns2:sendAuthenticationResponse>
</S:Body>
</S:Envelope>');
l_result := UTL_DBWS.invoke ( l_call,soap_request);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
result_output := l_result.getstringval;
dbms_output.put_line('web svc output ===> ' || result_output);
END;
Following is the error from pl/sql code
1
2
3
4
DECLARE
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception: java.lang.IllegalAccessException: error.build.wsdl.model: oracle.j2ee.ws.common.tools.api.WsdlValidationException:
Failed to read WSDL from https://webservice.mp.b.airclic.com/webservice/product/fieldservice/v1/Webservice?WSDL:
HTTP connection error code is 401
ORA-06512: at "SYS.UTL_DBWS", line 193
ORA-06512: at "SYS.UTL_DBWS", line 190
ORA-06512: at line 20
Notes
The program fails at following line of code -
l_service := UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(l_wsdl_url),
service_name => l_service_qname);
Web services are SSL.
The WSDL is at https location and needs username/password for access. The username/password to access WSDL are set using UTL_DBWS.SET_PROPERTY
To access the SSL site, I have imported the CA in Oracle Wallet, JVM home and JDK home.
Can anyone tell me what am I doing wrong here. I am not able to even establish connection to web service host.
This is very frustrating - Oracle has no examples on how to access a SSL Web Service (that needs authentication) from Database.
This is effecting our project deadlines ......... any help would be greatly appreciated.
Thanks.Hi,
I presume your Web Service needs HTTP (BASIC?) Authentication.
All this needs is setting the following 2 properties, which as can be seen, you are setting....
UTL_DBWS.set_property(l_call, 'USERNAME', '<username>');
UTL_DBWS.set_property(l_call, 'PASSWORD', '<pwd>');
This should work as long as your DBWS Callout Utility was downloaded from OTN after June 2008, and it's version is atleast 10.1.3.1.
Following is a sample code snippet that was tested successfully for this :
Declare
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_result sys.XMLTYPE;
l_request sys.XMLTYPE;
BEGIN
l_service := UTL_DBWS.create_service(null);
l_call := UTL_DBWS.create_call(l_service);
UTL_DBWS.set_target_endpoint_address(l_call, 'http://xxx.oracle.com:8888/basic/MyWebService1SoapHttpPort');
UTL_DBWS.set_property(l_call, 'USERNAME', 'username');
UTL_DBWS.set_property(l_call, 'PASSWORD', 'pwd');
UTL_DBWS.set_property(l_call, 'OPERATION_STYLE', 'document');
UTL_DBWS.set_property(l_call, 'SOAPACTION_USE', 'true');
UTL_DBWS.set_property(l_call, 'SOAPACTION_URI', 'http://xxx.oracle.com:8888/basic/MyWebService1SoapHttpPort');
l_request := XMLTYPE('<Z_CENTRICITY_GET_DOCLIST
xmlns:urn="urn:sap-com:document:sap:rfc:functions">' ||
'<I_INCLUDE_OLD_VERSIONS></I_INCLUDE_OLD_VERSIONS>' ||
'<I_INSTITUTION>0001</I_INSTITUTION>' ||
'<I_PATIENT_NR>0000000181</I_PATIENT_NR>' ||
'</Z_CENTRICITY_GET_DOCLIST>');
l_result := UTL_DBWS.invoke(l_call, l_request);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlcode || ' ' || sqlerrm);
END;
Hope this helps,
Yogesh -
Calling a web service using UTL_DBWS
Hello,
I am trying to call a web service froma PL/SQL procedure using UTL_DBWS. I've been able to use a different method to determine that the web service is working correctly, so I know my problem is somewhere within my UTL_DBWS call. It seems like my call to the web service is not authenticating correctly. What I would like to do is be able to take a look at the XML header that is created by UTL_DBWS based on the parameters I have supplied, in order to ensure that everything is correct. Does anyone know a way to do this?
Thanks,
JasonHello,
I am trying to call a web service froma PL/SQL procedure using UTL_DBWS. I've been able to use a different method to determine that the web service is working correctly, so I know my problem is somewhere within my UTL_DBWS call. It seems like my call to the web service is not authenticating correctly. What I would like to do is be able to take a look at the XML header that is created by UTL_DBWS based on the parameters I have supplied, in order to ensure that everything is correct. Does anyone know a way to do this?
Thanks,
Jason -
ORA-29541 while trying to access web service using UTL_DBWS
Hi all,
Solicit your help in the beforesaid scenario:
I've 9.2.01 RDBMS, JPub 9.2.0.1.0 Production and OC4J Release 10.1.2 (standalone) environment and a local webservice.
While issuing jpub, I get the following response:
jpub -user=scott/tiger@ORACLE -sysuser sys/tiger -proxywsdl="e:\IMyFloatWebService.wsdl" -endpoint="http://10.177.238.71:8988/WS_Appln-WSFloat_prj-context-root/MyFloatWebService" -proxyopts=soap,tabfun -dir=FloatValue -plsqlpackage=soap_callout_wrap_eg -proxyopts=noload
Note: FloatValue\MyFloatWebServiceProxy.java uses unchecked or unsafe operations
Note: Recompile with -Xlint:unchecked for details.
FloatValue\MyFloatWebServiceProxyJPub.java
FloatValue\plsql_wrapper.sql
FloatValue\plsql_dropper.sql
FloatValue\plsql_grant.sql
FloatValue\plsql_revoke.sql
FloatValue\plsql_proxy.jar
Please run FloatValue\plsql_wrapper.sql in the user schema, load the generated j
ar file and run FloatValue\plsql_grant.sql in the SYS schema.
i. e - I get message as seen above:
"Please run FloatValue\plsql_wrapper.sql in the user schema, load the generated j
ar file and run FloatValue\plsql_grant.sql in the SYS schema."
And in sqlplus, while I try to access the web service, I get this error:
"SQL> sho user;
USER is "SCOTT"
SQL> SELECT soap_callout_wrap_eg.getCircumference(20)
2 FROM dual;
FROM dual
ERROR at line 2:
ORA-29541: class SCOTT.MyWebServiceFloatRTEProxyJPub could not be resolved"
Could somebody please advise me where I might be going wrong? Any help in this regards will be highly appreciated.
Regards,
LeslieHi,
I presume your Web Service needs HTTP (BASIC?) Authentication.
All this needs is setting the following 2 properties, which as can be seen, you are setting....
UTL_DBWS.set_property(l_call, 'USERNAME', '<username>');
UTL_DBWS.set_property(l_call, 'PASSWORD', '<pwd>');
This should work as long as your DBWS Callout Utility was downloaded from OTN after June 2008, and it's version is atleast 10.1.3.1.
Following is a sample code snippet that was tested successfully for this :
Declare
l_service UTL_DBWS.service;
l_call UTL_DBWS.call;
l_result sys.XMLTYPE;
l_request sys.XMLTYPE;
BEGIN
l_service := UTL_DBWS.create_service(null);
l_call := UTL_DBWS.create_call(l_service);
UTL_DBWS.set_target_endpoint_address(l_call, 'http://xxx.oracle.com:8888/basic/MyWebService1SoapHttpPort');
UTL_DBWS.set_property(l_call, 'USERNAME', 'username');
UTL_DBWS.set_property(l_call, 'PASSWORD', 'pwd');
UTL_DBWS.set_property(l_call, 'OPERATION_STYLE', 'document');
UTL_DBWS.set_property(l_call, 'SOAPACTION_USE', 'true');
UTL_DBWS.set_property(l_call, 'SOAPACTION_URI', 'http://xxx.oracle.com:8888/basic/MyWebService1SoapHttpPort');
l_request := XMLTYPE('<Z_CENTRICITY_GET_DOCLIST
xmlns:urn="urn:sap-com:document:sap:rfc:functions">' ||
'<I_INCLUDE_OLD_VERSIONS></I_INCLUDE_OLD_VERSIONS>' ||
'<I_INSTITUTION>0001</I_INSTITUTION>' ||
'<I_PATIENT_NR>0000000181</I_PATIENT_NR>' ||
'</Z_CENTRICITY_GET_DOCLIST>');
l_result := UTL_DBWS.invoke(l_call, l_request);
UTL_DBWS.release_call (call_handle => l_call);
UTL_DBWS.release_service (service_handle => l_service);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(sqlcode || ' ' || sqlerrm);
END;
Hope this helps,
Yogesh -
Exposing and Consuming web service using NWDS
Hi all,
I want to expose and consume a webservice using NWDS.
My java application will interact with the SAP web service to create materials in r3.
I just want to know how to create a EJB project that contains the Web service and deploy on the SAP WAS.
and from the java application how would I access the same.
do I need to AXIS jar ?
How would get The WSDL corrosponding java files ?
I will be very thank ful if you can provide me with the some study materials also.
Warm regardsHi
Refer these links
https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/media/uuid/60dbd7ac-4788-2910-539b-b3599c64be12
http://help.sap.com/saphelp_nw04s/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
Regards
Abhishek -
Loadjava and jpub in web service using UTL_DBWS giving errors - Help Please
Hi all,
Solicit your help in the below-mentioned scenario.
I am trying to access some published web services from 9.2.0.1.0 RDBMS using UTL_DBMS API. I have accomplished the same using UTL_HTTP. I have followed the instructions specified in:
'http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm#Web_Service_Callout_Utility_Download_'
to prepare the database, download Callout Utility for pre-10g RDBMS (ZIP, 5.68MB), JPub 9.2.0.1.0 Production and OC4J Release 10.1.2 (standalone) and set the environment variables.
loadjava ran successfully for:
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/OC4J/j2ee/home/lib/servlet.jar
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/OC4J/j2ee/home/lib/ejb.jar
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/jlib/jssl-1_2.jar
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/soap/webapps\soap\WEB-INF\lib\soap.jar
But it gave error for:
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/OC4J/j2ee/home/lib/mail.jar
%ORACLE_DB_HOME%/BIN/loadjava -user scott/tiger@ORACLE -r -v -f -grant public -genmissing %ORACLE_HOME%/OC4J/lib/dms.jar
ORA-29534: referenced object SCOTT.oracle/core/odjl/logMessage could not be resolved.
ORA-29545: badly formed class.
And while trying to run JPub using:
jpub -user=scott/tiger -sysuser sys/change_on_install -httpproxy=www-proxy.us.oracle.com:80 -proxywsdl=http://www.webservicex.net/stockquote.asmx?wsdl -endpoint=http://www.webservicex.net/stockquote.asmx -proxyopts=soap,tabfun -dir=Stock -plsqlpackage=soap_callout_wrapper
I get error:
J2T-120, ERROR: Illegal option "-proxywsdl=http://www.webservicex.net/stockquote.asmx?wsdl" ignored
J2T-120, ERROR: Illegal option "-endpoint=http://www.webservicex.net/stockquote.asmx" ignored
J2T-120, ERROR: Illegal option "-proxyopts=soap,tabfun" ignored
Any help in resolving these issues will be appreciated. Kindly also advise which api – UTL_HTTP or UTL_DBWS I should go for and why.
Regards,
LeslieIt may be better to post this problem to this forum - http://forums.oracle.com/forums/category.jspa?categoryID=24 since this is much more related to loadjava and jpub
-
500 Error code while consuming web service using HTTPURLConnection
Hi,
I am getting an HTTP response code 500 and an IOException when I run a web service client to invoke a BMC Remedy web service (document based). I am using XML over HTTP to hit the web service as follows:
// For Remedy
soapAddress = "http://www.test-sislhelpdesk.siemens.co.in/arsys/services/ARService?server=bomw041a&webService=WebService_Test";
soapEnvelope = "<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:Header><AuthenticationInfo><userName>webservice</userName><password>*******</password></AuthenticationInfo></SOAP-ENV:Header><SOAP-ENV:Body><Q1:OpGetList xmlns:Q1=\"urn:WebService_Test\"><Q1:Qualification></Q1:Qualification></Q1:OpGetList></SOAP-ENV:Body></SOAP-ENV:Envelope>";
soapAction = "urn:WebService_Test/OpGetList";
URL url = new URL(soapAddress);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
System.out.println ("Connection got");
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type","text/xml");
connection.setRequestProperty ("soapAction", "\"" + soapAction + "\"");
OutputStreamWriter outputStream = new OutputStreamWriter(connection.getOutputStream());
System.out.println ("outputstream got");
outputStream.write(soapEnvelope);
outputStream.flush();
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = null;
while ((line = reader.readLine()) != null)
writer.write(line);
writer.write("\n");
System.out.println (writer);
catch(Exception e){
e.printStackTrace();
I have created a .NET client proxy which seems to work well.
I am not able to figure out as to why this code is not working. May be something wrong with the SOAP message request I am sending? But I have created this SOAP request message from the log generated for a successful hit. Any help in this regard will be highly appreciated.
The web service is on the internet and hance is accessible to all :)
Regards
VaibhavTried "POST" request method, did not work.
Actually when i hit other web services (created by me) , the code works.
But when I hit a third party web service, it fails returning 500 error code.
How can I extract the SOAP message returned, if any and see thinggs for myself.
I guess there is something wrong with the request SOAP message which I am sending. -
Web Services using UTL_DBWS
Hiiiii Guys,
Can you pls give a simple working example of procedure through which we can call a web services. I have tried example given on oracle's site, but it seems its not working.
I have just installed oracle in my PC, so guys pls give me the names of extra JARs which are required
Thanks in advance
Cheers!!!
VikasYour question makes no sense in this forum.
This is the XML DB forum.
XML DB Native web services allows SQL statements and PL/SQL procedures packages and functions to be invoked from any client that understands how to process a WSDL withot requring any additional code or jars to be installed. It is a feature of database 11.1.x
If you are wanting to invoke a Web Service from PL/SQL code then you can do this with UTL_HTTP, again with no jars required..
DECLARE
V_SOAP_REQUEST XMLTYPE := XMLTYPE(
'<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<m:CXMLTYPE-POSTInput xmlns:m="http://xmlns.oracle.com/orawsv/SOAPTEST/POST">
<m:P_REQUEST-XMLTYPE-IN><Request>4</Request></m:P_REQUEST-XMLTYPE-IN>
</m:CXMLTYPE-POSTInput>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>');
V_SOAP_REQUEST_TEXT CLOB := V_SOAP_REQUEST.getClobVal();
V_REQUEST UTL_HTTP.REQ;
V_RESPONSE UTL_HTTP.RESP;
V_BUFFER VARCHAR2(32000);
V_RESPONSE_TEXT CLOB;
V_RESPONSE_XML XMLTYPE;
V_WSDL XMLTYPE;
BEGIN
DBMS_LOB.CREATETEMPORARY(V_RESPONSE_TEXT, TRUE);
begin
V_REQUEST := UTL_HTTP.BEGIN_REQUEST(URL => :URL, METHOD => 'POST');
UTL_HTTP.SET_HEADER(V_REQUEST, 'User-Agent', 'Mozilla/4.0');
V_REQUEST.METHOD := 'POST';
UTL_HTTP.SET_HEADER (R => V_REQUEST, NAME => 'Content-Length', VALUE => DBMS_LOB.GETLENGTH(V_SOAP_REQUEST_TEXT));
UTL_HTTP.WRITE_TEXT (R => V_REQUEST, DATA => V_SOAP_REQUEST_TEXT);
V_RESPONSE := UTL_HTTP.GET_RESPONSE(V_REQUEST);
LOOP
UTL_HTTP.READ_LINE(V_RESPONSE, V_BUFFER, TRUE);
if (LENGTH(V_BUFFER) > 0) then
DBMS_LOB.WRITEAPPEND(V_RESPONSE_TEXT,LENGTH(V_BUFFER),V_BUFFER);
end if;
END LOOP;
UTL_HTTP.END_RESPONSE(V_RESPONSE);
EXCEPTION
WHEN UTL_HTTP.END_OF_BODY THEN
UTL_HTTP.END_RESPONSE(V_RESPONSE);
END;
V_RESPONSE_XML := XMLTYPE(V_RESPONSE_TEXT);
select XMLQUERY
'declare namespace SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; (::)
declare namespace SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; (::)
declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; (::)
declare namespace xsd="http://www.w3.org/2001/XMLSchema"; (::)
declare namespace m="http://xmlns.oracle.com/orawsv/WSDLTEST/TEST_CLOB"; (::)
$resp/SOAP-ENV:Envelope/SOAP-ENV:Body/*'
passing V_RESPONSE_XML as "resp" returning content
into V_WSDL
from DUAL;
select V_WSDL.getClobVal()
into :RESULT
from dual;
DBMS_LOB.FREETEMPORARY(V_RESPONSE_TEXT);
END;
/I've no idea about UTL_DBWS or why you would need it -
Return NULL when invoke Web Service via UTL_DBWS
Hi all,
right now, i'm using UTL_DBWS to acces Web Service via database.. but when i'm trying to get data from WEB SERVICE, using utl_dbws.invoke , i got NULL value.
It happened if The result more than Varchar2 / 32767 byte.
i'have tried to change code by :
result := sys.utl_dbws.invoke(l_call, l_input_params);
P_clob := sys.anydata.accessCLOB(result);
The Output IS NULL value even if the data was less than Varchar2 or 32767 byte..
this is my script looks like ::
declare
service sys.utl_dbws.SERVICE;
l_call sys.utl_dbws.CALL;
result ANYDATA;
wsdl_url VARCHAR2(1024);
service_name VARCHAR2(200);
operation_name VARCHAR2(200);
input_params sys.utl_dbws.ANYDATA_LIST;
p_out VARCHAR2(32767);
p_xml XMLTYPE;
p_clob CLOB;
begin
wsdl_url := 'http://127.0.0.1/Exercise/WSDL2.php?wsdl';
service_name :='{urn:hellowsdl}hellwsdl';
operation_name := 'getData';
service := sys.UTL_DBWS.create_service (
wsdl_document_location => URIFACTORY.getURI(wsdl_url),
service_name => service_name);
l_call := sys.utl_dbws.create_call(
service_handle => service,
port_name => null,
operation_name => operation_name
input_params(1) := ANYDATA.ConvertVarchar2('DOCCODE');
result := sys.utl_dbws.invoke(l_call, l_input_params);
p_out := sys.anydata.accessVarchar2(result);
sys.UTL_DBWS.release_call (call_handle => l_call);
sys.UTL_DBWS.release_service (service_handle => service);
end;
Thanx for Any HelpThe basics are simple:
- format a valid SOAP envelope
- use UTL_HTTP to make the call
- process the response (typically XML output)
Sample source code in {message:id=4205205}. -
Web Services using MAC Dreamweaver
I have been asked to develop a web site UI that
needs to retrieve data from calls to web services developed by a
third party. Adobe provide a very useful tutorial on how to this
for Windows based development but as an 'artist' I use Dreamweaver
on a MAC OS X system and the tutorial does not seem relevent ?
So, anyone out there point me to how how consume web services
using Dreamweaver for the MAC ??? Any coding I have to do will
probably be in C#.Hi,
check these:
http://www.oracle.com/technology/obe/obe1013jdev/ws/wsandascontrol.htm
http://www.oracle.com/technology/obe/obe1013jdev/index.htm
http://www.oracle.com/technology/documentation/jdev.html
http://www.google.com
and old posts on the forum.
Regards,
Patrik -
Error running demo PL/SQL consuming web services
I downloaded and installed the code from:
http://technet.oracle.com/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
on Oracle 9i version 2 (on both Windows and Solaris).
But I got the following error running the local time
demo:
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1022
ORA-12545: Connect failed because target host or object does not exist
ORA-06512: at "XN.DEMO_SOAP", line 72
ORA-06512: at "XN.TIME_SERVICE", line 13
ORA-06512: at line 2
The error occurs on this line:
http_req := utl_http.begin_request(url, 'POST','HTTP/1.0');
Can anybody tell me what I do wrong? Thanks a lot!
Also, is there any alternative ways to consume web services
using PL/SQL only? Many thanks!
Henry X.Mike,
Thanks so much for your help. I tried your code just now.
Same error:
ORA-30625: method dispatch on NULL SELF argument is disallowed
ORA-06512: at "XN.DEMO_SOAP", line 50
ORA-06512: at "XN.DEMO_SOAP", line 83
ORA-06512: at "XN.TIME_SERVICE", line 27
ORA-06512: at line 7
Let me post the code I am using. Note that
I removed the code for using proxy in time_service.
Henry
-- code for calling the time_service
DECLARE
ZIPCODE VARCHAR2(200);
v_Return VARCHAR2(200);
BEGIN
ZIPCODE := '94065';
v_Return := TIME_SERVICE.GET_LOCAL_TIME(ZIPCODE => ZIPCODE);
DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
END;
-- code for the package demo_soap
CREATE OR REPLACE PACKAGE demo_soap AS
TYPE request IS RECORD (
method VARCHAR2(256),
namespace VARCHAR2(256),
body VARCHAR2(32767));
TYPE response IS RECORD (
doc xmltype);
FUNCTION new_request(method IN VARCHAR2,
namespace IN VARCHAR2)
RETURN request;
PROCEDURE add_parameter(req IN OUT NOCOPY request,
name IN VARCHAR2,
type IN VARCHAR2,
value IN VARCHAR2);
FUNCTION invoke(req IN OUT NOCOPY request,
url IN VARCHAR2,
action IN VARCHAR2) RETURN response;
FUNCTION get_return_value(resp IN OUT NOCOPY response,
name IN VARCHAR2,
namespace IN VARCHAR2) RETURN VARCHAR2;
END;
CREATE OR REPLACE PACKAGE BODY demo_soap AS
FUNCTION new_request(method IN VARCHAR2,
namespace IN VARCHAR2)
RETURN request AS
req request;
BEGIN
req.method := method;
req.namespace := namespace;
RETURN req;
END;
PROCEDURE add_parameter(req IN OUT NOCOPY request,
name IN VARCHAR2,
type IN VARCHAR2,
value IN VARCHAR2) AS
BEGIN
req.body := req.body ||
'<'||name||' xsi:type="'||type||'">'||value||'</'||name||'>';
END;
PROCEDURE generate_envelope(req IN OUT NOCOPY request,
env IN OUT NOCOPY VARCHAR2) AS
BEGIN
env := '<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body><'||req.method||' '||req.namespace||'
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'||
req.body||'</'||req.method||'></SOAP-ENV:Body></SOAP-ENV:Envelope>';
END;
PROCEDURE show_envelope(env IN VARCHAR2) AS
i pls_integer;
len pls_integer;
BEGIN
i := 1; len := length(env);
WHILE (i <= len) LOOP
dbms_output.put_line(substr(env, i, 60));
i := i + 60;
END LOOP;
END;
PROCEDURE check_fault(resp IN OUT NOCOPY response) AS
fault_node xmltype;
fault_code VARCHAR2(256);
fault_string VARCHAR2(32767);
BEGIN
fault_node := resp.doc.extract('/soap:Fault',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/');
IF (fault_node IS NOT NULL) THEN
fault_code := fault_node.extract('/soap:Fault/faultcode/child::text()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
fault_string := fault_node.extract('/soap:Fault/faultstring/child::text()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/').getstringval();
raise_application_error(-20000, fault_code || ' - ' || fault_string);
END IF;
END;
FUNCTION invoke(req IN OUT NOCOPY request,
url IN VARCHAR2,
action IN VARCHAR2) RETURN response AS
env VARCHAR2(32767);
http_req utl_http.req;
http_resp utl_http.resp;
resp response;
BEGIN
generate_envelope(req, env);
-- show_envelope(env);
http_req := utl_http.begin_request(url, 'POST','HTTP/1.0');
utl_http.set_header(http_req, 'Content-Type', 'text/xml');
utl_http.set_header(http_req, 'Content-Length', length(env));
utl_http.set_header(http_req, 'SOAPAction', action);
utl_http.write_text(http_req, env);
http_resp := utl_http.get_response(http_req);
utl_http.read_text(http_resp, env);
utl_http.end_response(http_resp);
resp.doc := xmltype.createxml(env);
resp.doc := resp.doc.extract('/soap:Envelope/soap:Body/child::node()',
'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"');
-- show_envelope(resp.doc.getstringval());
check_fault(resp);
RETURN resp;
END;
FUNCTION get_return_value(resp IN OUT NOCOPY response,
name IN VARCHAR2,
namespace IN VARCHAR2) RETURN VARCHAR2 AS
BEGIN
RETURN resp.doc.extract('//'||name||'/child::text()',
namespace).getstringval();
END;
END;
-- code for the package time_service
CREATE OR REPLACE PACKAGE time_service AS
FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2;
END;
CREATE OR REPLACE PACKAGE BODY time_service AS
-- Location of Web service definition
-- http://www.alethea.net/webservices/LocalTime.asmx?WSDL
FUNCTION get_local_time(zipcode IN VARCHAR2) RETURN VARCHAR2 IS
req demo_soap.request;
resp demo_soap.response;
BEGIN
req := demo_soap.new_request('LocalTimeByZipCode',
'xmlns="http://www.alethea.net/webservices/"');
demo_soap.add_parameter(req, 'ZipCode', 'xsd:string', zipcode);
resp := demo_soap.invoke(req,
'http://www.alethea.net/webservices/LocalTime.asmx',
'http://www.alethea.net/webservices/LocalTimeByZipCode');
RETURN demo_soap.get_return_value(resp, 'LocalTimeByZipCodeResult',
'xmlns="http://www.alethea.net/webservices/"');
END;
END; -
Consuming Web Services in 11.2 does not work (UTL_DBWS)
Hello
i read some documents for consuming web services on the internet , but i get an error when i call add_numbers function as follows:
i connected on WSUSER , then
SQL> select add_numbers(1,3) from dual;
The Error message is:
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
ORA-06512: at "WSUSER.UTL_DBWS", line 193
ORA-06512: at "WSUSER.UTL_DBWS", line 190
ORA-06512: at "WSUSER.ADD_NUMBERS", line 25"
I use the following steps to setup the UTL_DBWS :
1- Create new user 'WSUSER'
2- Run the UTL_DBWS scripts ( utl_dbws_decl.sql , utl_dbws_body.sql) on WSUSER.
3- Execute this command
loadjava -u scott/tiger -r -v -f -genmissing dbwsclientws.jar dbwsclientdb11.jar
4- Log in as sys and grant these privileges to our new user:
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxySet','write');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyHost', 'write');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','http.proxyPort', 'write');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'accessClassInPackage.sun.util.calendar','');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','getClassLoader','');
execute dbms_java.grant_permission('WSUSER','SYS:java.net.SocketPermission','*','connect,resolve');
execute dbms_java.grant_permission('WSUSER','SYS:java.util.PropertyPermission','*','read,write');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission','setFactory','');
execute dbms_java.grant_permission('WSUSER','SYS:java.lang.RuntimePermission', 'createClassLoader', '' )
5- Create add_numbers function on wsuser to test utl_dbws:
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://www.oracle-base.com/webservices/server.php?wsdl';
l_namespace := 'http://www.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;
6- Test the function
Select add_numbers(1,2) from dual
on the test i get the error message :
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
java.lang.IllegalAccessException: java.lang.ExceptionInInitializerError
ORA-06512: at "WSUSER.UTL_DBWS", line 193
ORA-06512: at "WSUSER.UTL_DBWS", line 190
ORA-06512: at "WSUSER.ADD_NUMBERS", line 25
anyone have an idea to resolve this error .
thanks alotHi.
Looking at the code, it seems it is my article you are asking about.
http://www.oracle-base.com/articles/10g/utl_dbws10g.php
I've just run through it on an 11.2 instance and it works fine for me.
Make sure your server has access to the Internet and make sure the java classes are loaded successfully.
Cheers
Tim... -
Pros & Cons for consuming web services in ABAP using ABAP PROXY
Hi,
Other then performence is there any other disadvantages like security,etc for consuming web services in ABAP using ABAP proxy?
I really appreciate if some one provide the more details(Pros & Cons ) regarding cosuming web services and I also want to know is there any other way to consume web services in ABAP.
Thanks.<i> is there any other way to consume web services in ABAP</i>
you can use cl_http_client class to make your program to act as http client and post the soap message too webservice. This way you dont need to generate proxy, but you should know the soap message format.
Regards
Raja
Maybe you are looking for
-
Can not activate the wsp in WSS
Hi, I have developed a farm solution to create Doc Library programmatically using Visual studio 2012 and SharePoint foundation 2013. I am trying to deploy that solution on WSS. When i upload the solution and try to activate, no action occurs. Followi
-
Hello I recently bought an mac air 2012 and want to upgrade the internal memory HDD and simms ( from 4 to 8 gigs) is it possible and also worth it.
-
My Programming Exercise is: Write a 3D Bézier surface editor. Display the control points of the surface as square dots. Allow the user to select and move a control point with mouse operations and update the surface accordingly, and I need for your he
-
How to make a field as mandatory in database table
i created one itab table in data base. i would like to insert data from module pool programming . the first field of table field must be mandatory... thanks in advance.. Anitha.D
-
Simple Browser - can't run programs
I installed the game Cars on the new iMac - it runs under my (admin) account, but will not run uner the kid's simple browser user accounts - any idea why not? Thanks