Using PFX certificate to call web services
Hi,
I need to use a PFX certificate to invoke a web services over HTTPS using a simple Java client; I've followed these steps:
1 - convert .pfx certificate in .cer format: I've imported the certificate in Internet Explorer and then exported in .cer format
2 - write a simple code before invocation of web service like this: System.setProperty("javax.net.ssl.trustStore","C:\\myCertificate.cer");
System.setProperty("javax.net.ssl.trustStoreType","PKCS12");
System.setProperty("javax.net.ssl.trustStorePassword","myPwd");but it does'nt work and this exception occured:
java.net.SocketException: Default SSL context init failed: DerInputStream.getLength(): lengthTag=109, too big.Then I've tried to import my certificate in a jsk keystore by keystore tool; after I've changed my code like this:
System.setProperty("javax.net.ssl.keyStore","C:\\myjks.jks");
System.setProperty("javax.net.ssl.keyStoreType","JKS");
System.setProperty("javax.net.ssl.keyStorePassword","myPwd");but the eception is:
sun.security.validator.ValidatorException: No trusted certificate foundWich are the right stpes to use a pfx certificate in a Java environment?
Thanks in advance.
Rob
I've resolved my problem coding a custom SecureSocketFactory which I load programmatically into my SSL Context and then activate in my Axis client:
public class MySocketFactory implements SecureSocketFactory {
private Hashtable ht;
public MySocketFactory(Hashtable ht) throws Exception {
this.ht = ht;
public Socket create(String host, int port, StringBuffer hds,
BooleanHolder bh) throws Exception {
SSLSocket theSocket = null;
try {
KeyStore keyStoreKeys;
KeyManagerFactory keyMgrFactory;
SSLContext sslContext;
keyStoreKeys = KeyStore.getInstance("PKCS12");
keyStoreKeys.load(new FileInputStream("mykey.pfx"),"mypwd".toCharArray());
keyMgrFactory = KeyManagerFactory.getInstance("SunX509");
keyMgrFactory.init(keyStoreKeys, "mypwd".toCharArray());
sslContext = SSLContext.getInstance("SSL");
sslContext.init(keyMgrFactory.getKeyManagers(), null, null);
SSLSocketFactory socketFactory = sslContext.getSocketFactory();
theSocket = (SSLSocket) socketFactory.createSocket(host, port);
} catch (Exception e) {
e.printStackTrace();
return theSocket;
}Then, in my proxy client, I activate in Axis my factory by this statement:
AxisProperties.setProperty("org.apache.axis.components.net.SecureSocketFactory", "socketfactory.MySocketFactory");bye
Rob
Similar Messages
-
Calling Web Service from CRM using proxy
Hi all,
I'm facing a problem trying to call a web service from CRM (WAS 620) via XI 3.0. The response that XI recieves from the web service contains SOAP Envelope, and the mapping fails because of it. I built the proxy manually, because if I load WSDL the proxy generation in CRM generates error that sais that external definition coudn't be used.
Is there any way to remove SOAP envelope from the response while mapping?
Is it possible to call web service from WAS 620?
Thanks!!!!
Anya.Hi Manish,
SOAP adapter does pass the message to XI (this message contains SOAP envelope although XI expects to get message without it), and during the mapping step i get "Runtime Exception in Message-Mapping transformatio~".
I suppose it's because i created proxy manually. I did so because when i imported WSDL, and tried to generate proxy in CRM, i got an error message that said that proxy couldn't be generated because external definitions are only allowed in XI 3. But my XI version is 3.0! And when I generate the same proxy in my R/3 system that is installed on WAS 640, it works.
What can I do?
Cheers,
Anya. -
How to call web service using J2SE 1.3?
Dear All,
i have developed a web service by jdev 10.1.3 (JAX-RPC with web service security
enabled).
i generate the ws proxy (jdev 10.1.3) and run it with wsclient_extended.jar (required JDK 1.4.1 or above??).
but one of my client say he has to use J2SE 1.3.x (as OS=AIX 4.3 that without J2SE
1.4.x ), could anyone tell me how can generate ws proxy (with supporting
library) for jdk 1.3.x?
if oracle don't have such library / tools, any third party tools / library available?
thank you.
lspI'm found answer:
Java and SAP Portal blog: How to call web service from java code example -
Using utl_dbws to call web service
We're calling a web service using utl_dbws and getting a response but the problem is the parameters. I haven't been able to find much documentation about how to use the utl_dbws package and have only one example to work from so could do with some expert help.
The following code calls the webservice:
procedure call_web_service(p_application_key in number,
out_success_message out varchar2)
is
v_service utl_dbws.service;
v_call utl_dbws.call;
v_service_qname utl_dbws.qname;
v_port_qname utl_dbws.qname;
v_operation_qname utl_dbws.qname;
v_string_type_qname utl_dbws.qname;
v_return anydata;
v_send_data anydata;
v_return_string varchar2 (100);
v_return_length number;
v_parameter_string varchar2(32767);
v_params utl_dbws.anydata_list;
v_interview_xml xmltype;
v_policy_number varchar2(14);
-- return parameters
v_interviewId varchar2(1000);
v_statusType varchar2(1000);
v_error_reason varchar2(1000);
begin
message_handler.set_module_name('ostp_to_xpb.call_web_service');
message_handler.set_current_process('retrieve generated xml');
begin
select upload_xml, extractvalue(upload_xml, '/interview/externalReferenceNumber') policy_number
into v_interview_xml, v_policy_number
from xpb_upload_data
where application_key = p_application_key
and extractvalue(upload_xml, '/interview/externalReferenceNumber') is not null;
--dbms_output.put_line('xml retrieved');
exception
when no_data_found then
v_success_message := 'No xml found for application_key = '||p_application_key;
raise v_procedure_error;
end;
message_handler.set_current_process('call web service');
-- create service
v_service_qname := utl_dbws.to_qname (null, 'xpertBridge');
v_service := utl_dbws.create_service (v_service_qname);
-- create call
v_port_qname := utl_dbws.to_qname (null, 'xpertBridgePort');
v_operation_qname :=
utl_dbws.to_qname
('http://m0154ukdox1/xpertBridgeEDSLV/services/xpertBridge',
'orcaAppUpload'
v_call := utl_dbws.create_call (v_service, v_port_qname, v_operation_qname);
-- set endpoint
utl_dbws.set_target_endpoint_address
(v_call,
'http://m0154ukdox1/xpertBridgeEDSLV/services/xpertBridge'
-- set type of input and output parameters
v_string_type_qname :=
utl_dbws.to_qname ('http://www.w3.org/2001/XMLSchema', 'string');
utl_dbws.add_parameter (v_call,
'orcaXml',
v_string_type_qname,
'ParameterMode.IN'
utl_dbws.add_parameter (v_call,
'interviewId',
v_string_type_qname,
'ParameterMode.OUT'
utl_dbws.add_parameter (v_call,
'status',
v_string_type_qname,
'ParameterMode.OUT'
utl_dbws.add_parameter (v_call,
'errorReason',
v_string_type_qname,
'ParameterMode.OUT'
utl_dbws.set_return_type (v_call, v_string_type_qname);
-- convert xmltype to string for call
select xmlserialize(document v_interview_xml)
into v_parameter_string
from dual;
v_params (1) := anydata.convertvarchar(v_parameter_string);
-- call
v_return := utl_dbws.invoke (v_call, v_params);
-- values which can be returned are Success / MessageError / ApplicationError
v_return_string := v_return.accessvarchar2;
dbms_output.put_line ('Message returned is: ' || nvl(v_return_string, 'No success message returned'));
-- retrieve out parameters
v_interviewId := v_params(2).accessvarchar2;
dbms_output.put_line ('Message returned is: ' || nvl(v_interviewId, 'No interviewId returned'));
v_statusType := v_params(3).accessvarchar2;
dbms_output.put_line ('Message returned is: ' || nvl(v_statusType, 'No status type returned'));
v_error_reason := v_params(4).accessvarchar2;
dbms_output.put_line ('Message returned is: ' || nvl(v_error_reason, 'No error reason returned'));
-- release call
utl_dbws.release_call ( v_call );
-- release services
utl_dbws.release_service ( v_service );
message_handler.set_module_finish;
exception
when others then
out_success_message := message_handler.formatted_error_message;
end call_web_service;
Here is an excerpt from the WSDL relating to the call being made:
<xs:element name="orcaAppUpload">
<xs:annotation>
<xs:documentation xml:lang="en">Message payload XML</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="orcaXml" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="orcaAppUploadResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="interviewId" type="xs:string">
<xs:annotation>
<xs:documentation xml:lang="en">Interview identifier used to access the interview from UI</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="status" type="tns:StatusType"/>
<xs:element name="errorReason" type="xs:string" minOccurs="0">
<xs:annotation>
<xs:documentation xml:lang="en">Only included if an error has occured </xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="StatusType">
<xs:restriction base="xs:string">
<xs:enumeration value="Success"/>
<xs:enumeration value="MessageError">
<xs:annotation>
<xs:documentation xml:lang="en">MessageError arises if the request payload was
rejected by xpertBridge. This might be because it does not validate against the
expected schema. Alternatively, a business rule is not satisfied.</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="ApplicationError">
<xs:annotation>
<xs:documentation xml:lang="en">ApplicationError would indicate application or system
error or exception occured in xpertBridge while processing the request.</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:schema>
<wsdl:message name="orcaAppUploadReq">
<wsdl:part name="orcaAppUpload" element="tns:orcaAppUpload"/>
</wsdl:message>
<wsdl:message name="orcaAppUploadResp">
<wsdl:part name="orcaAppUploadResponse" element="tns:orcaAppUploadResponse"/>
</wsdl:message>
<wsdl:portType name="xpertBridgePort">
<wsdl:operation name="orcaAppUpload">
<wsdl:documentation>Upload (typically paper) application from ORCA/Ingenium</wsdl:documentation>
<wsdl:input message="tns:orcaAppUploadReq"/>
<wsdl:output message="tns:orcaAppUploadResp"/>
</wsdl:operation>
</wsdl:portType>
etc.
The error being returned is the following:
ostp_to_xpb.call_web_service.call web service.ORA-29532: Java call terminated by uncaught Java exception: unexpected element name: expected=interviewId, actual=status
Initially I started the params at params(0) but when I received the response above I thought it might solve the problem by starting at 1 - try anything :-) but still had the same response.
I'm now out of ideas!UTL_DBWS is not part of XDB, XDB is more about being the web service, rather than calling a web service. Here's an example of using UTL_HTTP to test a XML DB Database Native Web Service which may help
SQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 17 08:23:14 2009
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> spool password.log
SQL> --
SQL> connect sys/oracle as sysdba
Connected.
SQL> --
SQL> def USERNAME=DBNWS
SQL> --
SQL> def PASSWORD=DBNWS
SQL> --
SQL> def HOSTNAME=&1
SQL> --
SQL> DROP USER &USERNAME CASCADE
2 /
old 1: DROP USER &USERNAME CASCADE
new 1: DROP USER DBNWS CASCADE
User dropped.
SQL> grant connect, resource to &USERNAME identified by &PASSWORD
2 /
old 1: grant connect, resource to &USERNAME identified by &PASSWORD
new 1: grant connect, resource to DBNWS identified by DBNWS
Grant succeeded.
SQL> begin
2 dbms_network_acl_admin.drop_acl('localhost.xml');
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_network_acl_admin.create_acl('localhost.xml', 'ACL for &HOSTNAME', '&USERNAME', true, 'connect');
3 dbms_network_acl_admin.assign_acl('localhost.xml', '&HOSTNAME');
4 end;
5 /
old 2: dbms_network_acl_admin.create_acl('localhost.xml', 'ACL for &HOSTNAME', '&USERNAME', true, 'connect');
new 2: dbms_network_acl_admin.create_acl('localhost.xml', 'ACL for localhost', 'DBNWS', true, 'connect');
old 3: dbms_network_acl_admin.assign_acl('localhost.xml', '&HOSTNAME');
new 3: dbms_network_acl_admin.assign_acl('localhost.xml', 'localhost');
PL/SQL procedure successfully completed.
SQL> COMMIT
2 /
Commit complete.
SQL> GRANT XDB_WEBSERVICES TO &USERNAME
2 /
old 1: GRANT XDB_WEBSERVICES TO &USERNAME
new 1: GRANT XDB_WEBSERVICES TO DBNWS
Grant succeeded.
SQL> GRANT XDB_WEBSERVICES_OVER_HTTP TO &USERNAME
2 /
old 1: GRANT XDB_WEBSERVICES_OVER_HTTP TO &USERNAME
new 1: GRANT XDB_WEBSERVICES_OVER_HTTP TO DBNWS
Grant succeeded.
SQL> connect &USERNAME/&PASSWORD
Connected.
SQL> --
SQL> create or replace function GET_SQRT (INPUT_VALUE number) return number
2 as
3 begin
4 return SQRT(2);
5 end;
6 /
Function created.
SQL> select GET_SQRT(2)
2 from dual
3 /
GET_SQRT(2)
1.41421356
SQL> VAR URL VARCHAR2(4000)
SQL> --
SQL> BEGIN
2 :url := 'http://&USERNAME:&PASSWORD@&HOSTNAME:' || dbms_xdb.getHttpPort() || '/orawsv/&USERNAME/GET_SQRT';
3 end;
4 /
old 2: :url := 'http://&USERNAME:&PASSWORD@&HOSTNAME:' || dbms_xdb.getHttpPort() || '/orawsv/&USERNAME/GET_SQRT';
new 2: :url := 'http://DBNWS:DBNWS@localhost:' || dbms_xdb.getHttpPort() || '/orawsv/DBNWS/GET_SQRT';
PL/SQL procedure successfully completed.
SQL> print url
URL
http://DBNWS:DBNWS@localhost:80/orawsv/DBNWS/GET_SQRT
SQL> --
SQL> set long 100000 pages 0 lines 256
SQL> --
SQL> select httpuritype( :url || '?wsdl' ).getXML() from dual
2 /
<definitions name="GET_SQRT" targetNamespace="http://xmlns.oracle.com/orawsv/DBNWS/GET_SQRT" xmlns="http://schemas.xmlsoap.org/wsdl/
" xmlns:tns="http://xmlns.oracle.com/orawsv/DBNWS/GET_SQRT" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://
schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/DBNWS/GET_SQRT" elementFormDefault="qualified">
<xsd:element name="SNUMBER-GET_SQRTInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="INPUT_VALUE-NUMBER-IN" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GET_SQRTOutput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RETURN" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="GET_SQRTInputMessage">
<part name="parameters" element="tns:SNUMBER-GET_SQRTInput"/>
</message>
<message name="GET_SQRTOutputMessage">
<part name="parameters" element="tns:GET_SQRTOutput"/>
</message>
<portType name="GET_SQRTPortType">
<operation name="GET_SQRT">
<input message="tns:GET_SQRTInputMessage"/>
<output message="tns:GET_SQRTOutputMessage"/>
</operation>
</portType>
<binding name="GET_SQRTBinding" type="tns:GET_SQRTPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GET_SQRT">
<soap:operation soapAction="GET_SQRT"/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="GET_SQRTService">
<documentation>Oracle Web Service</documentation>
<port name="GET_SQRTPort" binding="tns:GET_SQRTBinding">
<soap:address location="http://localhost:80/orawsv/DBNWS/GET_SQRT"/>
</port>
</service>
</definitions>
SQL> set serveroutput on
SQL> --
SQL> DECLARE
2 V_SOAP_REQUEST XMLTYPE := XMLTYPE(
3 '<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">
4 <SOAP-ENV:Body>
5 <m:SNUMBER-GET_SQRTInput xmlns:m="http://xmlns.oracle.com/orawsv/&USERNAME/GET_SQRT">
6 <m:INPUT_VALUE-NUMBER-IN>2</m:INPUT_VALUE-NUMBER-IN>
7 </m:SNUMBER-GET_SQRTInput>
8 </SOAP-ENV:Body>
9 </SOAP-ENV:Envelope>');
10 V_SOAP_REQUEST_TEXT CLOB := V_SOAP_REQUEST.getClobVal();
11 V_REQUEST UTL_HTTP.REQ;
12 V_RESPONSE UTL_HTTP.RESP;
13 V_BUFFER VARCHAR2(1024);
14 BEGIN
15
16 V_REQUEST := UTL_HTTP.BEGIN_REQUEST(URL => :URL, METHOD => 'POST');
17 UTL_HTTP.SET_HEADER(V_REQUEST, 'User-Agent', 'Mozilla/4.0');
18 V_REQUEST.METHOD := 'POST';
19 UTL_HTTP.SET_HEADER (R => V_REQUEST, NAME => 'Content-Length', VALUE => DBMS_LOB.GETLENGTH(V_SOAP_REQUEST_TEXT));
20 UTL_HTTP.WRITE_TEXT (R => V_REQUEST, DATA => V_SOAP_REQUEST_TEXT);
21
22 V_RESPONSE := UTL_HTTP.GET_RESPONSE(V_REQUEST);
23 LOOP
24 UTL_HTTP.READ_LINE(V_RESPONSE, V_BUFFER, TRUE);
25 DBMS_OUTPUT.PUT_LINE(V_BUFFER);
26 END LOOP;
27 UTL_HTTP.END_RESPONSE(V_RESPONSE);
28 EXCEPTION
29 WHEN UTL_HTTP.END_OF_BODY THEN
30 UTL_HTTP.END_RESPONSE(V_RESPONSE);
31 END;
32 /
old 5: <m:SNUMBER-GET_SQRTInput xmlns:m="http://xmlns.oracle.com/orawsv/&USERNAME/GET_SQRT">
new 5: <m:SNUMBER-GET_SQRTInput xmlns:m="http://xmlns.oracle.com/orawsv/DBNWS/GET_SQRT">
<?xml version="1.0" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GET_SQRTOutput xmlns="http://xmlns.oracle.com/orawsv/DBNWS/GET_SQRT">
<RETURN>1.41421356237309504880168872420969807857</RETURN>
</GET_SQRTOutput>
</soap:Body>
</soap:Envelope>
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> --
SQL>
SQL> -
How to copy List item from one list to another using SPD workflow using HTTP call web service
Hi,
How to copy List item from one list to another using SPD workflow using HTTP call web service.
Both the Lists are in different Web applications.
Regards, Shreyas R SHi Shreyas,
From your post, it seems that you are using SharePoint 2013 workflow platform in SPD.
If that is the case, we can use Call HTTP web service action to get the item data, but we cannot use Call HTTP web service to create a new item in the list in another web application with these data.
As my test, we would get Unauthorized error when using Call HTTP web service action to create a new item in a list in another web application.
So I recommend to achieve this goal programmatically.
More references:
https://msdn.microsoft.com/en-us/library/office/jj164022.aspx
https://msdn.microsoft.com/en-us/library/office/dn292552.aspx?f=255&MSPPError=-2147217396
Thanks,
Victoria
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
Error 504 DNS look up failed while calling web services using XML
Hi, I am trying to call web service from Oracle using XML.
Everything seems to be in place but im getting an error "The webserver for <My End URL> reported that an error occurred while trying to access the website. Please click here to return to the previous page."
If I directly access the end url from my browser its accessible and seems to work fine.
The http response receiveed is mentioned below:
Status code: 403
Reason phrase: Forbidden
<html>
<head>
<title>504 DNS look up failed</title>
</head>
<body>
<font size=2><table width="100%"><tr><td bgcolor=#3300cc align="center" colspan=2>504 DNS look up failed</td></tr></table><br><br>The webserver for 'My End URL' reported that an error occurred while trying to access the website. Please click <u>here</u> to return to the previous page.<br><br><hr></font></body>
</html>
Im using Oracle 9i
Please help
Edited by: 927814 on Apr 15, 2012 11:41 PM
Edited by: 927814 on Apr 15, 2012 11:46 PMWithout far greater details as to what you are doing, what you have installed, and what you have tried, not much can be offered. All that I can gather from the information you provided is that the server name you are trying to contact either is not responding or is invalid. If you have Forms installed on your local machine (for example using Developer Suite), try using localhost rather than the hostname. For example, http://localhost:port/forms/frmservlet?form=yourform
http://www.checkupdown.com/status/E504.html -
Call web service using code.
we want to call a web service from ADF JSP form.
We used web service data control. But deployment failed.
we applied Patch 5878326 to JDeveloper 10.1.3.3.0 and OAS.
But problem is not solved.
So we need a new way to call web services.
is there any other way to call web services from Jdev.
any code sample will be appreciated.
Thanks.Workaround for the Connection Failure
In JDeveloper, locate the .deploy file in the Resources folder of your web application project.
Double-click the file to open the WAR Deployment Profile Properties dialog.
Expand File Groups - WEB-INF/classes - Contributors.
In the Contributors panel, click Add and use the Browse dialog to locate the .adf folder in the root for your application (for example, /jdev/mywork//.adf path.)
Select the .adf folder and add it as a contributor to the deployment profile.
Note that the .adf folder does not become part of the deployable archive. This merely ensures that the contents of the META-INF get placed in an appropriate location in the archive that will permit the web container to find it when the application loads.
The failure to get the connection to Webservice is beacuse the "connections.xml" is not available in the deployed archive.
This has been release note'd as in
http://www.oracle.com/technology/products/jdev/htdocs/10.1.3.0.3/10.1.3_addendum.html under "Deployment issues" -
Calling Web Service using utl_http; Parameters not being recognized by ws
Hi All,
I have set-up appropriate function & packages based on this article:
Calling Web Services from PL/SQL in the Oracle9i Database -
http://www.oracle.com/technology/tech/webservices/htdocs/samples/dbwebservice/DBWebServices_PLSQL.html
I am able to consume my sample web service using the above, but my web service doesn't see any parameters that I'm passing.
Any ideas? I'm using Oracle 10g calling a .Net 1.1 web service
Thanks,
RobertHello,
I am not able to access the link you posted about calling a web service. Could please share your code again ?
Thanks in advance for your help...
Lionel -
How to call web-service using only java code
Hello, how to call web-service using only java code. I can call it from BPM process or Web Dynpro Java Application, but if I need to call it from ejb component?
I'm found answer:
Java and SAP Portal blog: How to call web service from java code example -
Configuring use of clinet certificates for jax web services configuring u
Hello dear people,
I have a very simple jax web service under glassfish v.2.1 and I want to secure it using mutual authentication. I could configure using server certificates but I have problems with configuring the server to ask client certificates. The problem is that the clients are not asked to provide a valid client certificate to use the service. The clients can easily use the service without having a certificate.
Can anyone tell me what should I do to have this?
I got the example code from http://java.net/projects/javaeetutorial/downloads and the sample code that I used is in the folder : javaeetutorial5/examples/jaxws/helloservice-clientcert
Best regards,
Arash.Did you resolve your issue?
I´m posting some comments that maybe can help newer administrators facing similar doubts.
I´m using NW PI 7.1 EHP1 also and some interfaces were developed for using an external site providing web services through SSL (HTTPS) connection.
As in browser navigation, secure sites protected with SSL has a certificate emited by a international CA. We didn´t perceive the "handshake" in the most of cases because normally the web browser has a group of trusted CAs loaded on its certificate store.
With SAP PI and its WAS Java a similar procedure occurs with a small difference. The WAS Java didn´t have the trusted CAs loaded on KeyStorage. So, when the adapter tries to establishing a connection with an HTTPS site (it is a background process) a "handshake" is required to accepting the certificate and produces a error.
We completes the handshake importing the entire certificate chain (you can upload the site´s certificate to your browser and export it as file) on Keytore under the Trusted CAs view.
Hope this can help someone. It´s an "easy" part of SSL communication.
Now I´m trying to configure the inverse: Some third party consuming the PI web services using SSL. I have an additional component on inbound/ incoming connections that is the SAP Web Dispatcher.
The Help.sap.com is the reference but as always its a little difficult to find the (sequential) path following the links (go ahead, go ahead, go ahead, go back, go back, go ahead)...
Regards,
Rodrigo Aoki -
Calling Web services using SOAP
Hi,
I am trying to execute a function through a webservice using a SOAP
package and am getting the following error:ORA-30625: method dispatch
on NULL SELF argument is disallowed. I think this is to do with one of
the parameters being null but dont know how to fix this. Following is
the function:
CREATE OR REPLACE FUNCTION ILACPMSPRC.GET_GREETING_fnc (p_name IN
VARCHAR2
--, p_date VARCHAR2
, p_age VARCHAR2 )
RETURN NUMBER
AS
l_request soap_api_pkg.t_request;
l_response soap_api_pkg.t_response;
l_price NUMBER;
-- DBMS_OUTPUT.ENABLE(20000);
BEGIN
DBMS_OUTPUT.ENABLE(20000);
DBMS_OUTPUT.PUT_LINE('BEGIN');
-- Set proxy details if no direct net connection.
--UTL_HTTP.set_proxy('myproxy:4480', NULL);
--UTL_HTTP.set_persistent_conn_support(TRUE);
-- Set proxy authentication if necessary.
--soap_api.set_proxy_authentication(p_username => 'myusername',
-- p_password => 'mypassword');
l_request := soap_api_pkg.new_request(p_method => 'ns1:validate',
p_namespace => 'xmlns:ns1="http://
impl.webservice.validation.workmgt.cb.irishlife.ie/xsd"');
-- parameter 1 is name
soap_api_pkg.add_parameter(p_request => l_request,
p_name => 'workType',
p_type => 'xsd:string',
p_value => p_name);
-- parameter 2 is date
soap_api_pkg.add_parameter(p_request => l_request,
p_name => 'workItemNo',
p_type => 'xsd:string',
p_value => 'ABC');
--p_value => '2007-01-01T00:00:00Z');
-- parameter 3 is age
soap_api_pkg.add_parameter(p_request => l_request,
p_name => 'indexName',
p_type => 'xsd:string',
p_value => p_age);
l_response := soap_api_pkg.invoke(p_request => l_request,
p_url => 'http://
10.253.55.139:7400/axis2/services/ValidationService',
p_action => 'http://
10.253.55.139:7400/axis2/services/ValidationService/validate');
if l_response.doc is not null then
dbms_output.put_line('the doc is not null');
end if;
DBMS_OUTPUT.PUT_LINE ( 'p_name = ' || p_name );
HERE l_price := soap_api_pkg.get_return_value(p_response =>
l_response,
p_name =>
'validateResponse',
p_namespace =>
'xmlns:ns1="http://impl.webservice.validation.workmgt.cb.irishlife.ie/
xsd"');
if l_price is null then
dbms_output.put_line('opps, the price is null');
end if;
DBMS_OUTPUT.PUT_LINE('PRICE:'||l_price);
RETURN l_price;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLCODE || ', ' || SQLERRM);
RETURN NULL;
END GET_GREETING_fnc;
Where HERE is marked is where the problem lies...the package body is
here:
CREATE OR REPLACE PACKAGE BODY SOAP_API_PKG AS
-- Name : http://www.oracle-base.com/dba/miscellaneous/soap_api
-- Author : DR Timothy S Hall
-- Description : SOAP related functions for consuming web services.
-- Ammedments :
-- When Who What
-- =========== ========
=================================================
-- 04-OCT-2003 Tim Hall Initial Creation
-- 23-FEB-2006 Tim Hall Parameterized the "soap" envelope tags.
-- 08-JUN-2006 Tim Hall Add proxy authentication functionality.
g_proxy_username VARCHAR2(50) := NULL;
g_proxy_password VARCHAR2(50) := NULL;
PROCEDURE set_proxy_authentication(p_username IN VARCHAR2,
p_password IN VARCHAR2) AS
BEGIN
g_proxy_username := p_username;
g_proxy_password := p_password;
END;
FUNCTION new_request(p_method IN VARCHAR2,
p_namespace IN VARCHAR2,
p_envelope_tag IN VARCHAR2 DEFAULT 'SOAP-ENV')
RETURN t_request AS
l_request t_request;
BEGIN
l_request.method := p_method;
l_request.namespace := p_namespace;
l_request.envelope_tag := p_envelope_tag;
RETURN l_request;
END;
PROCEDURE add_parameter(p_request IN OUT NOCOPY t_request,
p_name IN VARCHAR2,
p_type IN VARCHAR2,
p_value IN VARCHAR2) AS
BEGIN
p_request.body := p_request.body||'<'||p_name||' xsi:type="'||
p_type||'">'||p_value||'</'||p_name||'>';
DBMS_OUTPUT.PUT_LINE ( 'p_request.body = ' || p_request.body );
END;
--PROCEDURE add_parameter(p_request IN OUT NOCOPY t_request,
-- p_name IN VARCHAR2,
-- p_type IN DATE,
-- p_value IN VARCHAR2) AS
--BEGIN
-- p_request.body := p_request.body||'<'||p_name||' xsi:type="'||
p_type||'">'||p_value||'</'||p_name||'>';
--END;
--PROCEDURE add_parameter(p_request IN OUT NOCOPY t_request,
-- p_name IN VARCHAR2,
-- p_type IN INTEGER,
-- p_value IN VARCHAR2) AS
--BEGIN
-- p_request.body := p_request.body||'<'||p_name||' xsi:type="'||
p_type||'">'||p_value||'</'||p_name||'>';
--END;
PROCEDURE generate_envelope(p_request IN OUT NOCOPY t_request,
p_env IN OUT NOCOPY VARCHAR2) AS
BEGIN
p_env := '<'||p_request.envelope_tag||':Envelope xmlns:'||
p_request.envelope_tag||'="http://schemas.xmlsoap.org/soap/envelope/"
' ||
'xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">' ||
'<'||p_request.envelope_tag||':Body>' ||
'<'||p_request.method||' '||p_request.namespace||' '||
p_request.envelope_tag||':encodingStyle="http://schemas.xmlsoap.org/
soap/encoding/">' ||
p_request.body ||
'</'||p_request.method||'>' ||
'</'||p_request.envelope_tag||':Body>' ||
'</'||p_request.envelope_tag||':Envelope>';
END;
PROCEDURE show_envelope(p_env IN VARCHAR2) AS
i PLS_INTEGER;
l_len PLS_INTEGER;
BEGIN
i := 1; l_len := LENGTH(p_env);
WHILE (i <= l_len) LOOP
DBMS_OUTPUT.put_line(SUBSTR(p_env, i, 60));
i := i + 60;
END LOOP;
END;
PROCEDURE check_fault(p_response IN OUT NOCOPY t_response) AS
l_fault_node XMLTYPE;
l_fault_code VARCHAR2(256);
l_fault_string VARCHAR2(32767);
BEGIN
dbms_output.put_line('midas8-1');
l_fault_node := p_response.doc.extract('/'||
p_response.envelope_tag||':Fault',
'xmlns:'||
p_response.envelope_tag||'="http://schemas.xmlsoap.org/soap/
envelope/');
dbms_output.put_line('midas8-2');
IF (l_fault_node IS NOT NULL) THEN
dbms_output.put_line('midas8-3');
l_fault_code := l_fault_node.extract('/'||
p_response.envelope_tag||':Fault/faultcode/child::text()',
'xmlns:'||
p_response.envelope_tag||'="http://schemas.xmlsoap.org/soap/
envelope/').getstringval();
dbms_output.put_line('midas8-4');
l_fault_string := l_fault_node.extract('/'||
p_response.envelope_tag||':Fault/faultstring/child::text()',
'xmlns:'||
p_response.envelope_tag||'="http://schemas.xmlsoap.org/soap/
envelope/').getstringval();
dbms_output.put_line('midas8-5');
--RAISE_APPLICATION_ERROR(-20000, l_fault_code || ' - ' ||
l_fault_string);
END IF;
END;
FUNCTION invoke(p_request IN OUT NOCOPY t_request,
p_url IN VARCHAR2,
p_action IN VARCHAR2)
RETURN t_response AS
l_envelope VARCHAR2(32767);
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_response t_response;
BEGIN
dbms_output.put_line('Invoking request');
dbms_output.put_line('url :'||p_url);
dbms_output.put_line('action :'|| p_action);
generate_envelope(p_request, l_envelope);
show_envelope(l_envelope);
l_http_request := UTL_HTTP.begin_request(p_url, 'POST','HTTP/1.0');
dbms_output.put_line('midas1');
IF g_proxy_username IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('PROXY USERNAME IS NOT NULL');
UTL_HTTP.set_authentication(r => l_http_request,
username => g_proxy_username,
password => g_proxy_password,
scheme => 'Basic',
for_proxy => TRUE);
END IF;
UTL_HTTP.set_header(l_http_request, 'Content-Type', 'text/xml');
UTL_HTTP.set_header(l_http_request, 'Content-Length',
LENGTH(l_envelope));
UTL_HTTP.set_header(l_http_request, 'SOAPAction', p_action);
UTL_HTTP.write_text(l_http_request, l_envelope);
dbms_output.put_line('midas2');
l_http_response := UTL_HTTP.get_response(l_http_request);
dbms_output.put_line('midas3');
UTL_HTTP.read_text(l_http_response, l_envelope);
dbms_output.put_line('midas4');
UTL_HTTP.end_response(l_http_response);
dbms_output.put_line('midas5');
l_response.doc := XMLTYPE.createxml(l_envelope);
dbms_output.put_line('midas6');
l_response.envelope_tag := p_request.envelope_tag;
dbms_output.put_line('midas7');
l_response.doc := l_response.doc.extract('/'||
l_response.envelope_tag||':Envelope/'||l_response.envelope_tag||':Body/
child::node()',
'xmlns:'||
l_response.envelope_tag||'="http://schemas.xmlsoap.org/soap/
envelope/"');
-- show_envelope(l_response.doc.getstringval());
dbms_output.put_line('midas8');
check_fault(l_response);
dbms_output.put_line('midas9');
RETURN l_response;
END;
FUNCTION get_return_value(p_response IN OUT NOCOPY t_response,
p_name IN VARCHAR2,
p_namespace IN VARCHAR2)
RETURN VARCHAR2 AS
BEGIN
-- RETURN p_response.doc.extract('//'||p_name||'/
child::text()',p_namespace).getstringval();
dbms_output.put_line('function');
dbms_output.put_line(p_name);
DBMS_OUTPUT.PUT_LINE (p_response.doc.extract('//'||p_name||'/
child::text()', p_namespace).getstringval());
RETURN p_response.doc.extract('//'||p_name||'/child::text()',
p_namespace).getstringval();
END;
END SOAP_API_PKG;
Any help greatly appreciated!!Hello,
I have not looked in detail to you code but I would like to point out that Oracle provides utilities to call Web Services from the database, using a DB package and/or Java in the DB.
Have you looked to the documentation about:
- Developing a Web Service Client in the Database
regards
Tugdual Grall -
ICM_HTTP_SSL_ERROR when calling web service
Summary: ICM_HTTP_SSL_ERROR was met when I called web service in ABAP with logical port & RFC Connection of type G.
Details:
1. the <b>test of RFC Connection of type G in SM59 works OK</b>, with SSL inactive and basic authentication.
2. while <b>in ABAP code, the calling to web service throws ICM_HTTP_SSL_ERROR</b>, using the logical port with the RFC Connection as HTTp Destination.
3. also, with using URL directly in logical port settings, the calling to web service in ABAP throws ICM_HTTP_SSL_ERROR.
I searched threads and blog for ICM_HTTP_SSL_ERROR, it seems others met ICM_HTTP_SSL_ERROR in SM59; while my case is the test in SM59 works well.
Anybody can help?
Thanks and kind regards.
SaidDear Sayid,
The document which you had mentioned here is really helpful.
I'am working on Digital Signature for Form16 in SAP.I stucked up with the same issue.
I went through the document of
Enabling SSL and Client Certificates on the SAP J2EE Engine by Angel Dichev
in that document i went through one note
Note: Per default, the SAP J2EE Engine uses the u201Cssl-credentialsu201D entry for SSL, which contains a
public-key certificate that has been signed by a test CA. Although this certificate can be used for
testing purposes, a certificate that has been signed by a well-known, productive CA should be used
when in production mode.
right now i'am doing it for testing purpose, in the above note it is mentioned that we can use default credentials but when i see the expiry date of this default credentials in my server 1) SSL-Credentials 2)SSL-Credentials-cert it is given that these certificates are Valid Not After 2005 year.
So i got confused now whether to use the default credentials or not.
Please guide me with a solution.
With Regards,
Pradeep.B -
Calling web service from oracle forms 10g
Problem Description:
I'm following the steps as per the doc:
http://www.oracle.com/technology/products/forms/htdocs/10gr2/howto/webservicefromforms/ws_10_1_3_from_forms.html
to create a java stub to call external web service and then use java importer in oracle forms to call this web service from oracle forms.
WSDL for external web service used is http://gend:83/DesignService.svc?wsdl
The service was developed by us.
Calling the web service using JDeveloper works fine but when I complie in Oracle Forms it returns wrong number of types of arguments in call SENDHELLO.
The code from oracle form to call web service is as below:
DECLARE
jo ora_java.jobject;
xo ora_java.jobject;
rv varchar2(2000);
ex ora_java.jobject;
str varchar2(100);
BEGIN
jo := GendServiceClient.new;
rv := GendServiceClient.sendHello('Nora');
EXCEPTION
WHEN ORA_JAVA.JAVA_ERROR then
message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
WHEN ORA_JAVA.EXCEPTION_THROWN then
ex := ORA_JAVA.LAST_EXCEPTION;
message(Exception_.toString(ex));
END;
Any help/ideas on this is greatly appreciated. Thanks.
Edited by: KE Nora Loera on Jun 1, 2012 1:24 PMMy primary skill is PL/SQL but the only information I found on Oracle's site to call a web service from a 10g Form was creating a jar file and importing the java class. Since I don't want to ask our corporate IT to make changes on the UNIX box for the jar files I went a different route.
I use UTL_HTTP.BEGIN_REQUEST to call a URL then load I load the data to a table as a CLOB since we have more than 4000 characters. Now I need to parse the XML and load it into a form. I have never done this so if there is a helpful site please let me know. I have looked at several sites but none do what I want.
Thanks -
Calling web service from oracle forms fails with ORA_JAVA.JAVA_ERROR
Problem Description:
I'm following the steps as per the doc:
http://www.oracle.com/technology/products/forms/htdocs/10gr2/howto/webservicefromforms/ws_10_1_3_from_forms.html
to create a java stub to call external web service and then use java importer in oracle forms to call this web service from oracle forms.
WSDL for external web service used is http://www.webservicex.net/CurrencyConverter.asmx?wsdl
Calling the web service using JDeveloper works fine but from Oracle Forms returns ORA_JAVA.JAVA_ERROR; Unable to call out to Java, Invalid object type for argument 1
The code from oracle form to call web service is as below:
DECLARE
jo ora_java.jobject;
rv ora_java.jobject;
ex ora_java.jobject;
outString varchar2(2000);
BEGIN
jo:= CurrencyConvertorStub.new;
--This will get the exchange rate from US Dollars to UK Sterling.
rv:= CurrencyConvertorStub.ConversionRate(jo,'CAD','USD');
message (float_.floatValue(RV));
EXCEPTION
WHEN ORA_JAVA.JAVA_ERROR then
message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
WHEN ORA_JAVA.EXCEPTION_THROWN then
ex := ORA_JAVA.LAST_EXCEPTION;
outString := Exception_.toString(ex);
message(outString);
END;
Any help/ideas on this is greatly appreciated. Thanks.Yes, it is the message line - so basically this call fails => rv:= CurrencyConvertorStub.ConversionRate(jo,'CAD','USD'); and control goes in the exception block
WHEN ORA_JAVA.JAVA_ERROR then
message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
Below is the code from java stub that was generated using JDeveloper by using web services stub/skeleton and associating the WSDL
public Double ConversionRate(String FromCurrency, String ToCurrency) throws Exception
URL endpointURL = new URL(endpoint);
Envelope requestEnv = new Envelope();
Body requestBody = new Body();
Vector requestBodyEntries = new Vector();
String wrappingName = "ConversionRate";
String targetNamespace = "http://www.webserviceX.NET/";
Vector requestData = new Vector();
requestData.add(new Object[] {"FromCurrency", FromCurrency});
requestData.add(new Object[] {"ToCurrency", ToCurrency});
requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
requestBody.setBodyEntries(requestBodyEntries);
requestEnv.setBody(requestBody);
Message msg = new Message();
msg.setSOAPTransport(m_httpConnection);
msg.send(endpointURL, "http://www.webserviceX.NET/ConversionRate", requestEnv);
Envelope responseEnv = msg.receiveEnvelope();
Body responseBody = responseEnv.getBody();
Vector responseData = responseBody.getBodyEntries();
return (Double)fromElement((Element)responseData.elementAt(0), java.lang.Double.class);
} -
How to make a PDF form call Web service and return a static pdf for user to print?
Hi all,
Can anyone help me regarding the feasibility of using PDF forms for my following case?
I would like to create a Dynamic pdf form. User only have the Acrobat reader. they can enter some information. Then have a submit button. when user click the submit button, it can call the web service with data. then Web service returns a Static PDF document based on data and the user can print it out. (and maybe save as separate pdf file)
1. Is that possible to implement? Because I know PDF can call web service, but dont know how it handle when the webservice returns another static PDF document. could it able to handle the responds and open up in another acrobat reader?
2. As I understand I need to have Live Cycle Designer to create a pdf and make it Reader Enabled. So user can user reader to call webservice? am I correct?
3. What minimum reader that user need to have? PDF reader 7 or above?
4. I have a webservice serve the same purpose for web. But if I want the same web services can serve both web and PDF form. So, whatever client (PDF or Web)make the web service call, server returns the PDF document to client. Is that possible ? Do I need to make any changes on web service?
5. Do I need to get any other Adobe server product? (other than Live Cycle Designer )
Thanks a lotWe have done a similar approach in the past and yes, it can be doable.
1. Is that possible to implement? Because I know PDF can call web service, but dont know how it handle when the webservice returns another static PDF document. could it able to handle the responds and open up in another acrobat reader?
Srini: We have developed a Servlet to talk to Webservice. Based on the Webservice response, the Servlet, prepares the Byte stream and sends it to Webbrowser to display as a PDF. The PDF data was submitted to Servlet in XML format.
But if you do not want to use the above approach, then you have to use the Workbench Process.
Submit the PDF data to a Workbench process and the inside process, execute Webservice Service with the data. Once the response is received, prepare the data XML and render a PDF with it.
To do this, you need LiveCycle Server and Reader Extensions server component.
2. As I understand I need to have Live Cycle Designer to create a pdf and make it Reader Enabled. So user can user reader to call webservice? am I correct?
Srini: If you want to use the Servlet, you can Reader extend the PDF with Acrobat.. But if you want to submit the data directly to Webservice, then you need Reader Extensions server component.
3. What minimum reader that user need to have? PDF reader 7 or above?
Srini: Not sure but Reader 8 and above should work.
4. I have a webservice serve the same purpose for web. But if I want the same web services can serve both web and PDF form. So, whatever client (PDF or Web)make the web service call, server returns the PDF document to client. Is that possible ? Do I need to make any changes on web service?
Srini: If you use the Servlet approach, then you can re-use the same webservice. But if you want to submit directly to the same webservice, you may need to change it to suit your data XML.
5. Do I need to get any other Adobe server product? (other than Live Cycle Designer )
Srini: If you use the Servlet approach, you do not need any server component but other approach, you need Livecycle Server and Reader Extensions server component.
Thanks
Srini
Maybe you are looking for
-
Need help please with Adobe Flash
Hi out there. I'm not even sure if I'm in the right pilace! First time I've tried this. Anyway, all of a sudden when I opened the Kodak Gallery from an email someone sent me to see some photos, it would not open and the pop up said I needed to ins
-
Use of "User Role" tab in T.Code - VL10G
Hi, Can anyone help me in providing more information or document on "User Role" tab in T.Code-VL10G. Rahul
-
Have just upgraded to Firefox 4 today, and seems OK for 3 out of 4 users, but not for one of us. It's just that bit in the middle with the red fox logo and the search box that don't load properly - looks very bare - and can type into box but nothing
-
Price coming in FD order type also
Dear All, I am trying to create a Free of charge Order - FD (in doc type doc pricing procedure is - C) and the Item category is also coming as KLN (where pricing is blank i;e No pricing). But when i am creating this FD order system is determining the
-
Any suggestion about 1Z0-007?
Greetings to all Oracle DBA's! I would like to try for the Oracle 10g DBA OCA certification. But to take the test preparation, before I need to pass the exam 1Z0-007 (Introduction to Oracle 9i) http://education.oracle.com/pls/web_prod ... I was brows