Publishing as web service an application that connects with Oracle 8i
Hi.
I have to execute a stored procedure in a 8i database (database migration or upgrade is not a possibiity). I have to incorporate this into an ADF 11g App and I've tried it making another project and using the 10g jdbc driver which allows me to execute that SP.
When I execute SP call, everything is OK, but when I try to call from the main app, there are conflicts with 11g driver and execution fails, because, I think, in the classpath is first 11g driver reference and it uses this river class instead 10g drivers.
Now I'm trying with a separate app which just call the SP. I put the same code, and again when I run it as standalone app everything is OK, but when I deploy it as a web service and run it from WS test it doesn't work and again results in the same error above.
java.lang.ArrayIndexOutOfBoundsException: 7
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:989)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:292)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
508)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
n.java:33)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at credito.wsutil.stage.SCL.execSpCartera(SCL.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstance
Resolver.java:101)
at weblogic.wsee.jaxws.WLSInstanceResolver$WLSInvoker.invoke(WLSInstance
Resolver.java:83)
at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:152)
at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethod
Handler.java:264)
at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTub
e.java:93)
at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:604)
at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:563)
at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:548)
at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:445)
at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:24
9)
at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdap
ter.java:453)
at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:250
at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAd
apter.java:140)
at weblogic.wsee.jaxws.HttpServletAdapter$AuthorizedInvoke.run(HttpServl
etAdapter.java:298)
at weblogic.wsee.jaxws.HttpServletAdapter.post(HttpServletAdapter.java:2
11)
at weblogic.wsee.jaxws.JAXWSServlet.doPost(JAXWSServlet.java:297)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at weblogic.wsee.jaxws.JAXWSServlet.service(JAXWSServlet.java:87)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
tyHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:292)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
a:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:3590)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
ervletContext.java:2200)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
ontext.java:2106)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
ava:1428)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Any suggestions or another way to accomplish this functionality?
Regards,
DEMR
Hi,
This was what I did when I was trying to run Hibernate on Weblogic, it was conflicting with different versions of antlr.* packages in Weblogic. Then I added these lines for making Weblogic to use Hibernate's antlr libs instead of installed on Weblogic.
So, I thought that it might help to solve your problem if Oracle drivers conflict with drivers pre-installed in Weblogic.
Also can you please try to add in your weblogic-application.xml, if it still does not solve your problem unfortunately I don't know any other way to solve your problem.
<prefer-application-packages>
<package-name>oracle.jdbc.*</package-name>
</prefer-application-packages> Edited by: Onur Aktaş on 30.Eyl.2009 08:31
Similar Messages
-
JCAPS UDDI - Problem Using the Web Service Management Application
Hi everyone, this is my problem:
1.) I installed the JCAPS UDDI Server in a Solaris. <-- Ok
2.) In the eManager I installed the Web Services Access Manager. <-- Ok
3.) I started the UDDI server. <-- Ok
4.) I check that the process is running (in Solaris). <-- Ok
5.) I'm trying to load the Web Service Management Application Login Page, but it doesn't show the page so I can't login and in consequence I can't publish, remove, view, and search WSDLs by using the Web Service Management Application.
I appreciate some help about this.
RegardsYes, I am connecting to the same system where we have data..
Anirban -
InvalidCategory error when publishing a Web Service
I am using EM to deploy an EAR file and publish a Web Service, which is a simple Java class. But I got following error:
The application was deployed successfully, but an error occurred while publishing the web services. You can attempt to re-publish the services from the deployed application. [UDDI SOAP Fault - errno= 20000 ; errCodeE_invalidCategory ; faultcode=Client; faultstring=Client Error; faultactor=null]
Could someone please explain why I hit this error, and what do I need to change to fix it?
Thanks.Hello,
First, I would like to thank you for your help.
Below is the SOAP envelope (request) that was created by the Application Express engine based on the Web service reference definition.
Input parameters:
Obra: 35078
Processo: 2073/DCEOD/I/1960
Morada: BECO BUGIO
<?xml version='1.0' encoding='UTF-8'?><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><ns1:ObterResultadosEmObjecto xmlns:ns1="urn:webservices.x-arq.mind.pt/urn:webservices.x-arq.mind.pt/ResultadosPesquisa.xsd"><ns1:Obra>35078</ns1:Obra><ns1:Processo>2073/DCEOD/I/1960</ns1:Processo><ns1:Morada>BECO BUGIO</ns1:Morada></ns1:ObterResultadosEmObjecto></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
From Portugal,
Helder Dinis -
Error in AXIS2 when i try publish ODI web services
Hi people,
I´m configured AXIS2 into OC4J (SOA Suite 10.1.3.1) and when i try to publish ODI web services using a odi-public-ws.aar file on AXIS2, show me a "Faulty Services" message and when i click on details link show me a Java message (below):
{color:#ff0000}*This Web axisService has deployment faults*{color}
Error: java.lang.NoSuchMethodError: javax.wsdl.Operation.getExtensionAttributes()Ljava/util/Map;
at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateOperations(WSDL11ToAxisServiceBuilder.java:1295) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populatePortType(WSDL11ToAxisServiceBuilder.java:592) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateEndpoints(WSDL11ToAxisServiceBuilder.java:469) at org.apache.axis2.description.WSDL11ToAxisServiceBuilder.populateService(WSDL11ToAxisServiceBuilder.java:363) at org.apache.axis2.description.WSDL11ToAllAxisServicesBuilder.populateAllServices(WSDL11ToAllAxisServicesBuilder.java:107) at org.apache.axis2.deployment.repository.util.ArchiveReader.processWSDLFile(ArchiveReader.java:248) at org.apache.axis2.deployment.repository.util.ArchiveReader.processWSDLs(ArchiveReader.java:356) at org.apache.axis2.deployment.ServiceDeployer.deploy(ServiceDeployer.java:67) at org.apache.axis2.deployment.repository.util.DeploymentFileData.deploy(DeploymentFileData.java:136) at org.apache.axis2.deployment.DeploymentEngine.doDeploy(DeploymentEngine.java:597) at org.apache.axis2.deployment.repository.util.WSInfoList.update(WSInfoList.java:144) at org.apache.axis2.deployment.RepositoryListener.update(RepositoryListener.java:330) at org.apache.axis2.deployment.RepositoryListener.checkServices(RepositoryListener.java:227) at org.apache.axis2.deployment.DeploymentEngine.loadServices(DeploymentEngine.java:131) at org.apache.axis2.deployment.WarBasedAxisConfigurator.loadServices(WarBasedAxisConfigurator.java:284) at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:82) at org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:516) at org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:436) at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2361) at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4810) at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4734) at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4922) at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1134) at com.evermind.server.http.HttpApplication.(HttpApplication.java:738) at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:414) at com.evermind.server.Application.getHttpApplication(Application.java:545) at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1990) at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.(HttpSite.java:1909) at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:645) at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:290) at com.evermind.server.http.HttpServer.setSites(HttpServer.java:270) at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:177) at com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2450) at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:998) at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131) at java.lang.Thread.run(Thread.java:595)
Wow, a lot of lines ! No problem, i can identify problem when try generate a WSDL file ... it´s correct ? (Please correct me if i have a incorrect reasoning).
Can a JDK Version too ? I´m using a JDK 1.5.0_06. According by manual instructions version of JDK can be 1.4.2 or later version....
Help me ! :-)
Thanks for your attention !!Roberto and all,
I installed Tomcat and published ODI web service and it was done sucessfully.
Why OC4J this simple activity doesn´t have any success ? I'm still curious what's difference between OC4J and Tomcat and why it does not allow this simple task when is completed in a such simple way... Oracle support analyst recommended that I use the OC4J but did not explain the reason, what are the advantages and benefits compared to Tomcat...
Sincerelly, i´m not too sure if i should go ahead with OC4J.
Thanks for your attention !
Best Regards,
João. -
Ws-basic username inside pl/sql procedure published as web service
I'm new to jdeveloper, but been working with Oracle for 13 years...
We have used Jdevelper to expose a pl/sql procedure as a web service using the "Publish as web service..." wizard. We then used Web Services Manager in server agent mode to protect that web service using ws-basic header auth. OWSM does a lookup on the user supplied credentials against our active directory ldap server to determine if the user should be able to call the service. That all works, EXCEPT...
The problem is that the stored procedure runs a query against data protected by virtual private database and extensive audit logs. We need access to the ws-basic credential from within oracle so that we can set the session context and pull the end-user's id for auditing purposes.
Right now, all we know inside the stored procedure is the oracle username used to connect to the database. This is of course different from the one used to authenticate our user in the OWSM layer.
The pl/sql procedure does not have a parameter to specify the user name, and even if it did, there is no way for us to verify that any user supplied parameter matches the credentials used in OWSM.
So, I assume, I need to modify the code generated by the "Publish as web service" wizard and somehow pull the ws-basic credentials (just username) and push them into the Oracle session_context.
Anyone have any sample code or advice on how to get access to ws-basic credentials or even any of the metadata on a certificate supplied to OWSM for authentication/authorization?I change p_action value ( before p_action => 'alta' ) now ( p_action => '"alta"' )
res := Xxm_Web_Service_Client_Pkg.invoke(p_init_msg_list => FND_API.G_TRUE,
p_url => 'http://198.137.253.178:7777/event/DefaultSystem/clienteService_RS',
p_action => '"alta"',
x_return_status => l_return_Status,
x_msg_count => l_msg_count,
x_msg_data => l_msg_data,
x_req => req)
And the invokation an ESB service from a PLSQL procedure began to work fine !!!
Thanks for all answers
Thans Peter !!!
Claudio -
How To Access HTTPS Web Service in Application Module
I need to know how to access HTTPS web service in application module.
If you can provide the tutorial or guidance to achieve this really appreciate.
Thanks
SameeraUse the Web Service Proxy wizard in JDeveloper to create a class that calls your Web service, and then call this class from code in your AM.
http://docs.oracle.com/cd/E16340_01/web.1111/b31974/web_services.htm#CJAHGIEF -
HTTP error when trying to access RESTful web service from application
Hi,
We are getting the following error when trying to access a RESTful web service coming from Apex workspace 4.2.1 and Apex listener 2.1:
ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-29024: Certificate validation failure
In the Debug report, besides the above I also see:
error_backtrace: ORA-06512: at "SYS.UTL_HTTP", line 1130 ORA-06512: at "APEX_040200.WWV_FLOW_WEB_SERVICES", line 543 ORA-06512: at "APEX_040200.WWV_FLOW_WEB_SERVICES", line 1164 ORA-06512: at "APEX_040200.WWV_FLOW_PROCESS", line 396
We get that error whether we use https or http in the URI pointing to the web service. When I test the Web Service in Workspace RESTful service GUI, I get the data back. When I go build an application with a report calling the RESTful Web Service I get that error. Both the Application and the Workspace RESTful services are on the same Apex environment and even the same workspace.
What is odd is that I can actually put the URL of the web service into a browser and I get the data: (using the demo hr data in sample RESTful services.)
IN browser-- https://weblogic-dev.edu/apex/ace/hr/empinfo/
yields:
7839,KING,PRESIDENT,,1981-11-17T05:00:00Z,5000,,10 7698,BLAKE,MANAGER,7839,1981-05-01T04:00:00Z,2850,,30 7782,CLARK,MANAGER,7839,1981-06-09T04:00:00Z,2450,,10 7566,JONES,MANAGER,7839,1981-04-02T05:00:00Z,2975,,20 7788,SCOTT,ANALYST,7566,1982-12-09T05:00:00Z,3000,,20 7902,FORD,ANALYST,7566,1981-12-03T05:00:00Z,3000,,20 7369,SMITH,CLERK,7902,1980-12-17T05:00:00Z,800,,20 7499,ALLEN,SALESMAN,7698,1981-02-20T05:00:00Z,1600,300,30 7521,WARD,SALESMAN,7698,1981-02-22T05:00:00Z,1250,500,30 7654,MARTIN,SALESMAN,7698,1981-09-28T04:00:00Z,1250,1400,30 7844,TURNER,SALESMAN,7698,1981-09-08T04:00:00Z,1500,0,30 7876,ADAMS,CLERK,7788,1983-01-12T05:00:00Z,1100,,20 7900,JAMES,CLERK,7698,1981-12-03T05:00:00Z,950,,30 7934,MILLER,CLERK,7782,1982-01-23T05:00:00Z,1300,,10
Any ideas on what would be causing the Error above in our application?
Thanks,
Pat
Edited by: patfmnd on Mar 11, 2013 3:25 PM
In reviewing the above error, I think we are realizing that we have to have the Weblogic layer SSL cert (actually the CERT from our BigIP load balancer which also does our SSL termination) imported into the Oracle server wallet where Apex is installed. Am I correct?
PMWe resolved our problem. The Apex Administrative Guide made us realize that we had to set up Wallet path in the Instance. This required working with DBAs to follow the Advanced networking guide to get the wallet set up on our server. We then added that path to the Instance configuration. (Manager Instance --> Instance settings). We ran into another other issue related to our implementation of CAS but were able to resolve that, and 'voila' were able to get the sample RESTful service consumed by our application!!
Now to the task of figuring out how to get Basic Auth working between client application and RESTful web service. If anyone has that working, let us know!!
It would be helpful if in the documentation of the Apex 2.x listener or Apex install/configuration there was clear reference to the above steps required for HTTPS access to RESTful web services.
Pat -
Error while trying to publish a web service in UDDI client
hi
i m getting this error when trying to publish my web service in UDDI client.I have
configured my uddi client using Visual Administrator.I created a local test registry.The name of my registry is QuickCarRentalRegistry_Local.I created this at admin level.I also tried at level 1 Tier.But it was giving the same error.
The error is "<b> Internet Explorer Script Error</b>".my ie version is 7.0
In my alert window it displays error: 'ur_txt' is undefined.
Regards
mythri.Hi mythri.
Did you find a way out of this error? Could you share the solution with me? Because I am facing a problem that looks just like the one you had.
Thanks in advance.
Renan -
Problem running report with BI Publisher and Web Service
Hello,
I actually try to run a Bi Publisher report via the Web Service.
I use the following documents:
- http://download.oracle.com/docs/cd/E10415_01/doc/bi.1013/e10416/bip_webservice_101331.htm
- "How to integrate Oracle BI Publisher via Web Services in Oracke Forms"
Everything works fine. But when I try to copy it on local computer the file is 0 length. I use the "getReportBytes" method.
Here is the code I tried with:
String userName = “Administrator”;
String passWord = “Administrator”;
System.out.println(”calling ” + myPort.getEndpoint());
System.out.println(myPort.validateLogin(userName,passWord));
ReportRequest repReq = new ReportRequest();
ReportResponse repRes = new ReportResponse();
repReq.setAttributeFormat(”pdf”);
repReq.setAttributeLocale(”en-US”);
repReq.setAttributeTemplate(”World Sales”);
repReq.setReportAbsolutePath(”/Sales Manager/World Sales/World Sales.xdo”);
repRes = myPort.runReport(repReq,userName,passWord);
System.out.println(repRes.getReportContentType());
byte[] binaryBytes = repRes.getReportBytes();
OutputStream out = new FileOutputStream(”D:
out.pdf”);
out.write(binaryBytes);
out.close();
System.out.println(”Success for Run Report”);
Thanks in advance.Hi,
I assume that you use 10.1.3.4. If not, my hint is not relevant for you ....
There's a new parameter in the web service API to set the Chunk-Size. Unfortunaltely is the default value not so, that the behaviour is like in older releases (no chunk-size ... the whole document at once). If you set the chunk size to -1, you should get your document. So try to add
repRequest.setSizeOfDataChunkDownload(-1);
regards
Rainer -
Problem in Web Service from Application Service
Hi All,
In Netweaver CE I have created a CAF project and within the project I have used one WebService as external service. Now to access the web service I have created an application over on the extrenal service( Just right clicking on webservice -> default mapping). Then the application service is exposed as web service. At that time I have also created Web Service Destination and mapped (External service mapping) the external service with that specific destination. Now my task is to test the web service from netweaver WebService Nevigator. At the testing phase I am providing one input value and executing the WS but it is not accepting any input value. I have also done the debugging in backend system but in backend the input value is acception as zero. That means the web service is not accepting anu input value.
Did anybody face the same problem for NetWeaver CE or any sugestion?
Thanks
ChandanHi Chandan,
You need to create a custom wrapper operation in the application service where the operation by default mapping gets created. From this custom operation you need to call the operation created by the default mapping. In the web service you need to expose the custom operation only.
Thanks,
Dipankar -
Report published as web service with parameters
Post Author: kevinzebeste
CA Forum: Publishing
hi,I have a problem in a report published as web service.indeed, the report has a parameter, a date.Client side I do this://I create the parameter ParameterFields paramFields = new ParameterFields(); ParameterField paramField = new ParameterField(); ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue(); paramField.Name = "date"; paramDiscreteValue.Value = "10/10/2006"; paramField.CurrentValues.Add(paramDiscreteValue); paramFields.Add(paramField);//I add the parameter into the crVievwer crystalReportViewer.ParameterFieldInfo = paramFields;//I call the web service to get data crystalReportViewer.ReportSource = "http://localhost/WebService/Rapport1Service.asmx"; Server Side :Now, I want to get back the parameter in the web service (in Rapport1Service.asmx, so server-side) to be able to call my storedprocedure with the good parameter, this one which was put on the client side (10/10/2006).I tried to do crystalReportViewer.ReportSource = "http://localhost/WebService/Rapport1Service.asmx?date=22/10/2006" on the client side but no way. i don't find a solution, is there any way to make this possible ?Moreover, i have one database for each user, so i need to pass the user name, password and account too..Post Author: kevinzebeste
CA Forum: Publishing
I have found a solution.
I create a web service in which i return a dataset, filled with the data wanted.the web service take as parameter: the report name we want, the parameter(s), and the username and password (to check if the user has right to access to data.)After that, I fill the report, client side, with the datasen given. i don't know if it's the best solution but it works ! -
Best practise for creating an application that connects to a SQL Server database
I have created an application that connects to a SQL Server database and views information using a datagrid and performs several updates when a button
is selected.
I have created a SQLcontrol.vb using the following code:
Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class SQlControl
'connection 1
Public SQLCon As New SqlConnection With {.ConnectionString
= "Data Source=;Initial Catalog=;Integrated Security=True"}
'connection 2
Public SQLCon1 As New SqlConnection With {.ConnectionString
= "Data Source;Initial Catalog=;Integrated Security=True"}
Public sqlcmd As SqlCommand
Public sqlda As SqlDataAdapter
Public sqldataset As DataSet
Public Function hasconnection() As Boolean
Try
SQLCon.open()
SQLCon.close()
Return True
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
End Function
Public Sub runquery(query As String)
Try
SQLCon.Open()
sqlcmd = New SqlCommand(query,
SQLCon)
'LOAD
SQL RECORDS FOR DATAGROD
sqlda = New SqlDataAdapter(sqlcmd)
sqldataset = New DataSet
sqlda.Fill(sqldataset)
BH READ DIRECTLY FROM THE DATABASE
'Dim
R As SqlDataReader = sqlcmd.ExecuteReader
'While
R.Read
'MsgBox(R.GetName(0)
& ": " & R(0))
'End
While
SQLCon.Close()
Catch ex As Exception
MsgBox(ex.Message)
'will
close connection if still open
If SQLCon.State
= ConnectionState.Open Then
SQLCon.Close()
End If
End Try
End Sub
Public Sub runquery1(query As String)
Try
SQLCon1.Open()
sqlcmd = New SqlCommand(query,
SQLCon1)
'LOAD
SQL RECORDS FOR DATAGROD
sqlda = New SqlDataAdapter(sqlcmd)
sqldataset = New DataSet
sqlda.Fill(sqldataset)
BH READ DIRECTLY FROM THE DATABASE
'Dim
R As SqlDataReader = sqlcmd.ExecuteReader
'While
R.Read
'MsgBox(R.GetName(0)
& ": " & R(0))
'End
While
SQLCon1.Close()
Catch ex As Exception
MsgBox(ex.Message)
'will
close connection if still open
If SQLCon1.State
= ConnectionState.Open Then
SQLCon1.Close()
End If
End Try
End Sub
End Class
A code for one of my button which views displays data grid contains the following code:
Private Sub Button1_Click_1(sender As Object,
e As EventArgs) Handles Button1.Click
If SQL.hasconnection
= True Then
SQL.runquery("select
* from tablea")
If SQL.sqldataset.Tables.Count
> 0 Then
DGVData.DataSource = SQL.sqldataset.Tables(0)
End If
End If
End Sub
I am fairly new to vb.net and have read a few books and followed a few tutorials on youtube, what I would like to know is, are there any disadvantages
to the way I have connected to a SQL database using the SQLControl.vb. A lot of the vb books include data adapter and dataset within the form, I'm not sure if I'm following best practice by have the connection details outside of the form.
My other question is, I have created two connections in the SQLControl and call these connections within the same form using the same data adapter
and dataset. It all works fine but I just wanted to know of any potential issues?
Public SQLCon As New SqlConnection With {.ConnectionString
= "Data Source=;Initial Catalog=;Integrated Security=True"}
'connection 2
Public SQLCon1 As New SqlConnection With {.ConnectionString
= "Data Source;Initial Catalog=;Integrated Security=True"}
ThanksMy other question is, I have created two connections in the SQLControl and call these connections within the same form using the same data adapter and dataset. It all works fine but
I just wanted to know of any potential issues
1) You are not using Sepration of concerns for a solution that is doing data access, like using a DAL.
http://en.wikipedia.org/wiki/Separation_of_concerns
2) You are directly issuing SQL commands at the UI, leading to sql injection attacks.
3) You are not using a UI design pattern, which leads you to tightly couple database activity to the UI.
http://www.codeproject.com/Articles/228214/Understanding-Basics-of-UI-Design-Pattern-MVC-MVP
@System243trd, parameters are important to prevent SQL injection attacks (people will insert SQL commands into the database if you do not perform basic checking of what you are passing to the database). If you write a stored procedure try to make
the variables the correct SQL server data type to avoid problems later of people trying to call it directly. Darnold924 is right, I see no code to prevent against SQL injection attacks. In addition, during development in some instances LocalSQLDB
database system is used and during deployment you usually need to use the production SQL server database. Moreover, Linq-to-SQL is used on Windows Phone 8.1 and it is required for phone development later and so I highly recommend learning
it if you plan on developing windows phone applications.
@System243trd, If you want the code for the windows phone app I think it uses the MVVM model or that might be for universal apps or regular windows phone apps. I have been using the windows phone Silverlight pivot or panorama template (it might
be pieces of both). I've already submitted to the windows phone marketplace and it had to go through certification first. I plan on later making an article on it but I need to first fix one or two simple problems I have with it. Here's a link to
the source code if you later want to look at the source code (in vb.net):
https://jeffsblogcodesamples.codeplex.com/downloads/get/1445836
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - Sherlock Holmes. speak softly and carry a big stick - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog
- http://www.computerprofessions.us -
Hello experts,
Could anyone give me a step by step guide on how to properly publish a web service in SAP. I've been trying to expose various BAPI's / RFC, but when I attempt to call them in Microsoft Visual Studio via the wsdl, I get a 503 error - server unavailable.
I think I am missing some level of configuration when creating the SAP web service. Any help gratefully appreciated.Hi,
Use the SEARCH button here on SDN, there have been already several blogs explaining how to publish web services.
By the way, SAP is a software vendor. You have to tell which SAP software product and release you are using...
Regards,
Olivier -
How to integrate Oracle BI Publisher via Web Services in Oracle Forms.
hi
I hope you fine and happy. I think you hear about the new reporting tool (Oracle BI Publisher).
Really it is a great tool. I need someone help me; How I can integrate Oracle BI Publisher via Web Services in Oracle Forms.
I got the guidelines of this integration process from ORACLE.
But, when I compile the script of publicreportserviceclient.callRunReport - the script running the report -, I get some errors in PL/SQL compiler
http://www.oracle.com/technology/products/xml-publisher/index.html==========================
PL/SQL CODE:
==========================
DECLARE
RAISEDEXCEPTION ORA_JAVA.JOBJECT;
REPORT_PATH VARCHAR2(200);
PARAM_NAME VARCHAR2(200);
PARAM_VALUE VARCHAR2(200);
UN VARCHAR2(200);
PW VARCHAR2(200);
FORMAT VARCHAR2(200);
TEMPLATE VARCHAR2(200);
OUT_FILE VARCHAR2(200);
OBJ ORA_JAVA.JOBJECT;
BEGIN
OBJ := PUBLICREPORTSERVICECLIENT.NEW();
REPORT_PATH := '/LEARN/EMPLOYEES/EMPLOYEES.XDO';
PARAM_NAME := 'P_DEPTNO';
PARAM_VALUE := '50';
UN := 'Administrator';
PW := 'Administrator';
FORMAT := 'PDF';
TEMPLATE := 'Simple';
OUT_FILE := 'C:\DevSuiteHome_1\j2ee\home\default-web-app\' || 'TEST';
--PUBLICREPORTSERVICECLIENT.CALLRUNREPORT(OBJ,:REPORT_PATH,PARAM_NAME,:PARAM_VALUE,UN,PW,:FORMAT,:TEMPLATE,OUT_FILE);
PublicReportServiceClient.callRunReport( REPORT_PATH,
PARAM_NAME,
PARAM_VALUE,
UN,
PW,
FORMAT,
TEMPLATE,
OUT_FILE);
WEB.SHOW_DOCUMENT('HTTP://127.0.0.1:8889/j2ee/' || 'TEST');
END;
==========================
JAVA CODE FOR callRunReport FUNCTION:
==========================
public void callRunReport (String reportPath, String[] paramName, String[] paramValue, String
username, String password, String format, String template, String outFile)
try {
bip_webservice.proxy.PublicReportServiceClient myPort =
new bip_webservice.proxy.PublicReportServiceClient();
// Calling runReport
ReportRequest repRequest = new ReportRequest();
repRequest.setReportAbsolutePath(reportPath);
repRequest.setAttributeTemplate(template);
repRequest.setAttributeFormat(format);
repRequest.setAttributeLocale("en-US");
repRequest.setSizeOfDataChunkDownload(-1);
if (paramName != null)
ParamNameValue[] paramNameValue = new ParamNameValue[paramName.length];
String[] values = null;
for (int i=0; i<paramName.length; i++)
paramNameValue[i] = new ParamNameValue();
paramNameValue.setName(paramName[i]);
values = new String[1];
values[0] = paramValue[i];
paramNameValue[i].setValues(values);
repRequest.setParameterNameValues(paramNameValue);
else
repRequest.setParameterNameValues(null);
ReportResponse repResponse = new ReportResponse();
repResponse = myPort.runReport(repRequest,username,password);
byte[] baReport = repResponse.getReportBytes();
FileOutputStream fio = new FileOutputStream(outFile);
fio.write(baReport);
fio.close();
} catch (Exception ex) {
ex.printStackTrace(); -
Failed to publish a web service
Hi, I am not able to publish a web service today morning
The error thrown is
Service call failed. Error 400 (Bad Request) when requesting /webservicegroups/aeb419ce7f9f46b3a560536ea34a1416/modelpackages/
Please help me with this.There could be many causes for this error. Two most common causes in my experience:
1. There is a split module between web-service input and web-service output path.
2. If doing text analytics, forgetting to just pick the label column as an output as the output (you may need to insert a project columns module to do this). -- otherwise the web-service would have to be able to return thousands of hashed values.
Are you running into either of these issues?
Thanks!
-Luis
Luis Cabrera. Program Manager -- Azure Machine Learning @luisito_cabrera Disclaimer: This post is provided &quot;AS IS&quot; with no warranties, and confer no rights.
Maybe you are looking for
-
Hello people! As I mentionned in my question, I have lost my iPhone I'm feeling very dumb, it is the second time that this happens to me and I really need your help! I don't even know what happened, but when I arrived home after school, I didn't find
-
How can I delete a single unwanted page in a Pages document?
I'm unable to delete a single unwanted page from a document.
-
Can't move items in dock -tried several solutions
My problem: I move a dock item to where I want it to be, a moment later the dock moves it down to the end of the dock. I've searched the forums and tried the following solutions to no avail: -Shift dragging items in the dock. -Dragging dock items alo
-
ICE adds "xml" extension to transported content
Hi all, We migrate KM content from EP6 to EP7. We use standard repository "/documents". When we transport documents the target portal identify them as xml files and doesn't open them. See snapshot: http://img401.imageshack.us/img401/1756/65621006tj1.
-
Problem when applying IPSEC to DMVPN
Hi i have some trouble with DMVPN i configured NHRP between a HUB and aSPOKE: HUB tu0 tu1 | | ISP | tu0,tu1 SPOKE the HUB has two physical