I’m using soap_api method for accessing web services in oracle. When I create add_numbers function and I execute add_numbers function then Function doesn’t execute.
fires following error when calling web service in select statement
select add_numbers(2,5) from dual
error is
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP",line 1029
ORA-12541: TNS:no listener
ORA-06512: at "dbtest.SOAP_API",line 144
ORA-06512: at "dbtest.ADD_NUMBERS", line 34 FROM!
I’m using this function and soap_api methods from this link. taken example from
http://www.oracle-base.com/articles/9i/consuming-web-services-9i.php#Top
Function for calling web services.
CREATE OR REPLACE FUNCTION add_numbers (p_int_1 IN NUMBER, p_int_2 IN NUMBER) RETURN NUMBER AS
l_request soap_api.t_request;
l_response soap_api.t_response;
l_return VARCHAR2(32767);
l_url VARCHAR2(32767);
l_namespace VARCHAR2(32767);
l_method VARCHAR2(32767);
l_soap_action VARCHAR2(32767);
l_result_name VARCHAR2(32767);
BEGIN
l_url := 'http://192.168.0.75:9001/LicWebService.asmx';
l_namespace := 'xmlns="http://192.168.0.75:9001/"';
l_method := 'AddNum';
l_soap_action := 'http://192.168.0.75:9001/AddNum';
l_result_name := 'return';
l_request := soap_api.new_request(p_method => l_method, p_namespace=> l_namespace);
soap_api.add_parameter(p_request => l_request,p_name => 'int1',p_type => 'xsd:integer',p_value => p_int_1);
soap_api.add_parameter(p_request => l_request,p_name=> 'int2', p_type=> 'xsd:integer',p_value => p_int_2);
l_response := soap_api.invoke(p_request => l_request, p_url=> l_url, p_action => l_soap_action);
l_return := soap_api.get_return_value(p_response => l_response,p_name=> l_result_name, p_namespace => NULL);
END;
Kindly suggest me where i am making mistake.
Either your TNS is not set up properly or the TNS service is not running. This is the reason why the UTL_HTTP api isn't working (which is used by SOAP_API).
Follow this link to troubleshoot and resolve this.
Related
APEX_UTIL.SET_SECURITY_GROUP_ID( APEX_UTIL.FIND_SECURITY_GROUP_ID( p_workspace => 'teacher' ));
apex_util.create_user(
p_user_name => 'teacher',
p_web_password => 'ChangeMe#1234',
p_developer_privs => 'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL',
p_email_address => 'test1#example.com',
p_default_schema => 'teacher',
p_change_password_on_first_use => 'N' );
end;
Error report -
ORA-20001: Package variable g_security_group_id must be set.
ORA-06512: at "APEX_210100.WWV_FLOW_API", line 485
ORA-06512: at "APEX_210100.WWV_FLOW_API", line 520
ORA-06512: at "APEX_210100.WWV_FLOW_FND_USER_INT", line 1731
ORA-06512: at "APEX_210100.HTMLDB_UTIL", line enter code here 1245
ORA-06512: at line 5
does the Oracle Autonomous database allow developer to create apex workspace via the programming method?
any API available?
Does the OCI for Java SDK support the creation of APEX?
To add workspaces to your APEX instance, please use the ADD_WORKSPACE procedure.
Example:
BEGIN
APEX_INSTANCE_ADMIN.ADD_WORKSPACE (
p_workspace_id => 8675309,
p_workspace => 'MY_WORKSPACE',
p_primary_schema => 'SCOTT',
p_additional_schemas => 'HR:OE' );
END;
To create APEX users on Autonomous Database, please note:
Application Express Administration Services and the Oracle Application
Express development environment on Autonomous Database use Database
Accounts authentication. This authentication method uses the database
account user name and password to authenticate users.
Run script from https://www.talkapex.com/2012/08/how-to-create-apex-session-in-plsql and get error
[Error] Execution (1: 1): ORA-20987: APEX - Application ID and current security group ID are not consistent. - Contact your application administrator.
Details about this incident are available via debug id "78243".
ORA-06512: at "APEX_190100.WWV_FLOW_ERROR", line 1381
ORA-06512: at "APEX_190100.WWV_FLOW_ERROR", line 1416
ORA-06512: at "APEX_190100.WWV_FLOW_CUSTOM_AUTH_STD", line 724
ORA-06512: at "APEX_190100.WWV_FLOW_CUSTOM_AUTH_STD", line 588
ORA-06512: at "APEX_190100.HTMLDB_CUSTOM_AUTH", line 260
ORA-06512: at "USER.SP_CREATE_APEX_SESSION", line 30
ORA-06512: at line 2
error raise from
apex_custom_auth.post_login(
p_uname => p_app_user,
p_session_id => APEX_CUSTOM_AUTH.GET_NEXT_SESSION_ID,
p_app_page => apex_application.g_flow_id||':'||p_app_page_id);
how to properly create a user in need wokrspace? Apex version 19.1
and create user
BEGIN
FOR C1 IN (SELECT WORKSPACE_ID
FROM APEX_APPLICATIONS
WHERE APPLICATION_ID = 4050)
LOOP
APEX_UTIL.SET_SECURITY_GROUP_ID (
P_SECURITY_GROUP_ID => C1.WORKSPACE_ID);
END LOOP;
APEX_UTIL.CREATE_USER (
P_USER_NAME => 'BOB',
P_EMAIL_ADDRESS => 'bob#bob.com',
P_DEFAULT_SCHEMA => 'MY_SPACE',
P_ALLOW_ACCESS_TO_SCHEMAS => 'MY_SPACE',
P_WEB_PASSWORD => 'change_me',
P_DEVELOPER_PRIVS =>
'ADMIN:CREATE:DATA_LOADER:EDIT:HELP:MONITOR:SQL'); -- workspace administrator
COMMIT;
END;
i have same error
[Error] Execution (2: 1): ORA-20987: APEX - Security Group ID (your workspace identity) is invalid. - Contact your application administrator.
declare
l_workspace_id number;
begin
l_workspace_id := apex_util.find_security_group_id (p_workspace => 'INTERNAL');
apex_util.set_security_group_id (p_security_group_id => l_workspace_id);
apex_util.create_user(
p_user_name => 'NEWUSER1',
p_web_password => 'secret99');
commit;
end;
Error at line 1 ORA-20001: Package variable g_security_group_id must
be set. ORA-06512: at "APEX_190100.WWV_FLOW_API", line 1828 ORA-06512:
at "APEX_190100.WWV_FLOW_API", line 1863 ORA-06512: at
"APEX_190100.WWV_FLOW_FND_USER_INT", line 1977 ORA-06512: at
"APEX_190100.HTMLDB_UTIL", line 1452 ORA-06512: at line 6
SELECT WORKSPACE,WORKSPACE_DISPLAY_NAME, OWNER, APPLICATION_GROUP_ID FROM APEX_APPLICATIONS WHERE WORKSPACE = 'INTERNAL' AND APPLICATION_ID = 4050;
INTERNAL >INTERNAL
APEX_190100
9.1051E+16
1 row selected.
Ok, now this makes more sense. You're trying to create a user but it fails when trying to create a session prior to creating the user. You don't need a session to create a user, you just need the security group to be set. This can be done using APEX_UTIL.SET_SECURITY_GROUP_ID. I executed this code in my environment, connected via sqldeveloper:
DECLARE
l_workspace_id number;
BEGIN
l_workspace_id := apex_util.find_security_group_id (p_workspace => '<myworkspacename>');
apex_util.set_security_group_id (p_security_group_id => l_workspace_id);
APEX_UTIL.CREATE_USER(
p_user_name => 'NEWUSER1',
p_web_password => 'secret99');
COMMIT;
END;
/
and the user was created without errors.
I am trying to export my application using the command line utility APEXExport. (APEX 19.2)
Exception in thread "main" java.sql.SQLException: ORA-06550: line 2, column 12:
PLS-00306: wrong number or types of arguments in call to 'GET_APPLICATION'
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:494)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:446)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1054)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:623)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:252)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:612)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:223)
at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:56)
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:907)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1119)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3780)
at oracle.jdbc.driver.T4CCallableStatement.executeInternal(T4CCallableStatement.java:1300)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3887)
at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4230)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1079)
at oracle.apex.APEXExport.exec_and_write_files(APEXExport.java:222)
at oracle.apex.APEXExport.ExportFile(APEXExport.java:523)
at oracle.apex.APEXExport.ExportFiles(APEXExport.java:332)
at oracle.apex.APEXExport.main(APEXExport.java:890)
Caused by: Error : 6550, Position : 17, Sql = begin
:1 := apex_export.get_application (
p_application_id => :2 ,
p_split => :3 ='Y',
p_with_date => :4 ='Y',
p_with_ir_public_reports => :5 ='Y',
p_with_ir_private_reports => :6 ='Y',
p_with_ir_notifications => :7 ='Y',
p_with_translations => :8 ='Y',
p_with_pkg_app_mapping => :9 ='Y',
p_with_original_ids => :10 ='Y',
p_with_no_subscriptions => :11 ='Y',
p_with_comments => :12 ='Y',
p_with_supporting_objects => :13 ,
p_with_acl_assignments => :14 ='Y',
p_components => apex_string.split(:15 ,'#') );
end;, OriginalSql = begin
? := apex_export.get_application (
p_application_id => ?,
p_split => ?='Y',
p_with_date => ?='Y',
p_with_ir_public_reports => ?='Y',
p_with_ir_private_reports => ?='Y',
p_with_ir_notifications => ?='Y',
p_with_translations => ?='Y',
p_with_pkg_app_mapping => ?='Y',
p_with_original_ids => ?='Y',
p_with_no_subscriptions => ?='Y',
p_with_comments => ?='Y',
p_with_supporting_objects => ?,
p_with_acl_assignments => ?='Y',
p_components => apex_string.split(?,'#') );
end;, Error Msg = ORA-06550: line 2, column 12:
PLS-00306: wrong number or types of arguments in call to 'GET_APPLICATION'
ORA-06550: line 2, column 5:
PL/SQL: Statement ignored
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:498)
... 18 more
I ran a fairly staright forward command from cmd
cd <Navigated to utilites folder in apex installation>
%JAVA_HOME%\java oracle.apex.APEXExport -db "myhost:myport:servicename" -user my_user -password my_password -applicationid 120
However, when i use APEX 18.2 installation, application is exported without issues.
Let me know if i am doing it wrong? Or is it a bug in APEX 19.2 (not listed in know issues)
Thanks in advance
Nowadays I would recommend using SQLcl instead of the "old" APEXExport utility...
SQLcl has built in APEX export tools which work nicely and have all the features of the old utility plus some more. Just connect with SQLcl to your DB parsing schema and type "apex export" for a command help page.
https://www.oracle.com/database/technologies/appdev/sqlcl.html
apex export command
I'm trying to launch jasperreports (on jaspersoft server) via APEX dynamic actions.
When I am executing this i receive a error:
Even when I'm only trying to login
DECLARE
v_blob BLOB;
v_file_name VARCHAR2 (25) := 'TestReport.pdf';
v_vcContentDisposition VARCHAR2 (25) := 'inline';
v_invoice_id VARCHAR2(10) := :INVOICE_ID; -- your NumberField Item
v_hostname VARCHAR2(30) := #HOST#; -- your hostname, eg: localhost
v_port NUMBER := #PORT#; -- port for your JasperReports Server, eg: 8081
v_username VARCHAR2(50) := 'jasperadmin'; -- jasperreports server username
v_password VARCHAR2(50) := 'jasperadmin'; -- jaspereports server password
v_jasper_string VARCHAR2(30) := v_username || ';' || v_password;
v_login_url VARCHAR2(100) :=
'http://' || v_hostname || ':' || v_port || '/jasperserver/rest/login';
v_report_url VARCHAR2(100) :=
'http://' || v_hostname || ':' || v_port || '/jasperserver/rest_v2/reports/Reports/' || v_file_name;
BEGIN
-- log into jasper server
v_blob := apex_web_service.make_rest_request_b(
p_url => v_login_url,
p_http_method => 'GET',
p_parm_name => apex_util.string_to_table('j_username;j_password',';'),
p_parm_value => apex_util.string_to_table(v_jasper_string,';')
); APEX_APPLICATION.STOP_APEX_ENGINE;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
The APEX and JasperServer are on different ports.
Have you added the target ip:port to the ACL?
https://docs.oracle.com/database/121/ARPLS/d_networkacl_adm.htm#ARPLS148
Problem was with the https protocol. Apex had https and Jasperserver didn't.
The conclusion is that both (apex and jasperserver) need to have https.
Edit:
In addittional I needed to create proper ACL and create Oracle Wallet to avoid "Certificate Validation Error"
I am trying to achieve following using my program:
Create log-group on aws cloudwatch
Create log-stream under above log-group
Put log-events under above log-stream
All this using go lang
package main
import (
"time"
"fmt"
"github.com/jcxplorer/cwlogger"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws"
)
func main() {
sess := session.Must(session.NewSessionWithOptions(session.Options{
SharedConfigState: session.SharedConfigEnable,
}))
svc := cloudwatchlogs.New(sess)
logGroupName := "my-log-group";
logStreamName := "my-log-stream";
logGroupInput := cloudwatchlogs.CreateLogGroupInput{LogGroupName: &logGroupName}
svc.CreateLogGroup(&logGroupInput);
logStreamInput := cloudwatchlogs.CreateLogStreamInput{LogGroupName: &logGroupName, LogStreamName: &logStreamName}
svc.CreateLogStream(&logStreamInput)
logevents := make([]*cloudwatchlogs.InputLogEvent, 1)
logevents = append(logevents, &cloudwatchlogs.InputLogEvent{
Message: aws.String("Simple log message"),
Timestamp: aws.Int64(111),
})
p := cloudwatchlogs.PutLogEventsInput{LogEvents: logevents, LogGroupName: &logGroupName, LogStreamName: &logStreamName}
resp, err := svc.PutLogEvents(&p)
if err != nil {
panic(err)
}
fmt.Print("Next Token: {}", resp.NextSequenceToken)
}
Now when I run above code, it successfully creates log-group and log-stream and I can verify that in aws cloudwatch. But for some reason PutLogEvents fails with following error:
panic: SerializationException:
status code: 400, request id: 0685efcc-47e3-11e9-b528-81f33ec2f468
I am not sure what may be wrong here. Any suggestion or direction will be really helpful.
Thanks in advance.
Reason for SerializationException was:logevents := make([]*cloudwatchlogs.InputLogEvent, 1)
followed by append which created first empty entry in slice. I replaced code with
logevents := make([]*cloudwatchlogs.InputLogEvent, 0) and it got resolved.
Additionally while debugging to find why logs were not getting populated I figured out that timestamp value used is not valid one. According to aws documentation timestamp for each event can't be older than 14 days and can't be more than 2hr in future.
Here is link: https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutLogEvents.html
Hope it will be helpful to someone facing similar issue in future.