Oas jservlet that returns wml
I've build an http servlet (using the oas
jservlet cartrige) that returns a wml file:
void Handle_Micro_Browser_doGet_Req
(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
//--- setting the header information
response.setContentType("txt/vnd.wap.wml");
PrintWriter out = new PrintWriter (response.getOutputStream());
out.println("<?xml version=\"1.0\"?>");
out.println("<!DOCTYPE wml PUBLIC \"-//PHONE.COM//DTD WML 1.1//EN\"");
out.println("\"http://www.wapforum.org/DTD/wml1_1.1.xml\">");
out.println("<wml>");
out.println("<card id=\"c1\" title=\"title 1\">");
out.println("<p>");
out.println("card1");
out.println("</p>");
out.println("</card>");
out.println("</wml>");
the response from the phone.com simulator is:
Content-Type: text/html. Content follows:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- Generated by Oracle's Dynamic HTML Generation Pack
<HTML>
<HEAD>
<TITLE>JServlet Error</TITLE>
</HEAD>
<BODY>
<H2>A Servlet Error Occurred</H2>Unable to locate the sp
most likely explanation is a problem with the servlet's
k the server log for a detailed message.</BODY>
</HTML>
End Content-Type: text/html.
----------------- DATA SIZE ------------------------
Uncompiled data from FILE is 264 bytes.
...found Content-Type: text/vnd.wap.wml.
Compiled WAP binary is 99 bytes.
I've added the wml mime type to the www
listener configuration.
thanks for your help.
Eli.
null
I have a similar problem where I use a package for the Servlet. The "servlet" consists of a large number of classes that do queries, reply generation and so on. I have no way of configurating the OAS the same way I do with a Apache JServ, or is there a way?
Similar Messages
-
How to create a function that returns multiple rows in table
Dear all,
I want to create a funtion that returns multiple rows from the table (ex: gl_balances). I done following:
-- Create type (successfull)
Create or replace type tp_gl_balance as Object
PERIOD_NAME VARCHAR2(15),
CURRENCY_CODE VARCHAR2(15),
PERIOD_TYPE VARCHAR2(15),
PERIOD_YEAR NUMBER(15),
BEGIN_BALANCE_DR NUMBER,
BEGIN_BALANCE_CR NUMBER
-- successfull
create type tp_tbl_gl_balance as table of tp_gl_balance;
but i create a function for return some rows from gl_balances, i can't compile it
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
return
(select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period);
end;
I also try
create or replace function f_gl_balance(p_period varchar2) return tp_tbl_gl_balance pipelined
as
begin
select gb.period_name, gb.currency_code, gb.period_type, gb.period_year, gb.begin_balance_dr, gb.begin_balance_cr
from gl_balances gb
where gb.period_name = p_period;
return;
end;
Please help me solve this function.
thanks and best reguardhi,
Use TABLE FUNCTIONS,
[http://www.oracle-base.com/articles/9i/PipelinedTableFunctions9i.php]
Regards,
Danish -
What is the Function MOdule that returns the fields in database table order
Hello Folks
I have a dynamic internal table with fields ( which are not in order). I want to display them in the order of which they are present in the database table? Is there any function module that returns the fields in database order?
FAQ. Please search before posting your question.
Edited by: Suhas Saha on Oct 10, 2011 10:19 PMHi,
You can use this BAPI.
<b>BAPI_SALESORDER_GETLIST</b>
Reward if useful.
Regards,
Vimal -
Sending an Email with a cursor that returns multiple fields.
I was investigating about sending emails from apex, and I'd like to know if you can help me, I need to send an Email report with multiple fields, I m using this code :
DECLARE
CURSOR c1 is
select id,gk,creation_date,sr_count,issue_notes,sr_impacted,oldest_creation_date
from gk_report where id = (select max(id) from gk_report);
reg c1%ROWTYPE;
begin
IF (c1%ISOPEN = TRUE) THEN
CLOSE c1;
END IF;
OPEN c1;
FETCH c1 INTO reg;
CLOSE c1;
APEX_MAIL.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => 'Hourly GK Log',
p_body_html =>
'GK: '||to_char(reg.gk)||'<br>
CREATION DATE: '||to_char(reg.CREATION_DATE,'DD-MON-YYYY HH24:MI:SS')||'<br>
SR COUNT: '||to_char(reg.SR_COUNT)||'<br>
ISSUE NOTES: '||to_char(reg.ISSUE_NOTES)||'<br>
SRs IMPACTED: '||to_char(reg.SR_IMPACTED)||'<br>
OLDEST CREATION DATE: '||to_char(reg.OLDEST_CREATION_DATE,'DD-MON-YYYY HH24:MI:SS'),
p_SUBJ => 'Hourly GK Log: ' || to_char(reg.CREATION_DATE,'DD-MON-YYYY HH24:MI:SS'),
p_cc => NULL,
p_bcc => NULL ,
p_replyto => NULL
end;
In this code there is a cursor that returns just one field, But what about if the cursor returns multiple fields, How can I insert a Loop into this code.?
Thanks,
Pablo.Hi,
DECLARE
p_collection_name VARCHAR2(9000) := 'Report_collection';
begin
IF (apex_collection.collection_exists(p_collection_name => p_collection_name)) THEN
apex_collection.delete_collection(p_collection_name => p_collection_name);
END IF;
apex_collection.create_collection_from_query(
p_collection_name => 'Report_collection',
p_query => 'SELECT DISTINCT AUD_SR AS SR, C.USER_NAME AS AUDITOR, F.ERROR_NAM , A.AUD_OBSERV AS AUDIT_OBS,D.FEEDBK_OBSERV AS FEEDBACK_OBS , E.ANALYSIS_OBS ,A.AUD_STATUS
FROM AUDIT_PROCESS A, MICC_AT_DATA B, MICC_AT_USER C, FEEDBACK_PROCESS D, MICC_AT_ANALISYS E, MICC_AT_ERROR F
WHERE B.DATA_MONTH = :P27_MONTH AND B.DATA_SR = A.AUD_SR AND C.ID = B.DATA_AUDITOR AND F.ERROR_ID = A.AUD_ERROR AND A.FEEDBACK_COD = D.FEEDBACK_COD AND D.FEEDBK_AGREE = 'N' AND E.COD_ANALYSIS = A.COD_ANALYSIS ORDER BY AUDITOR');
APEX_MAIL.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => p_collection_name ,
p_body_html => '',
p_SUBJ => 'hi',
p_cc => NULL,
p_bcc => NULL ,
p_replyto => NULL
END;
Error
ORA-06550: line 18, column 176:
PLS-00103: Encountered the symbol " AND E.COD_ANALYSIS = A.COD_ANALYSIS ORDER BY AUDITOR" when expecting one of the following:
) , * & = - + < / > at in is mod remainder not rem
<> or != or ~= >= <= <> and or like like2
like4 likec between || multiset member submultiset
The symbol "," was substituted for " AND E.COD_ANALYSIS = A.COD_ANALYSIS ORDER BY AUDITOR" to continue.
1. DECLARE
2. p_collection_name VARCHAR2(9000) := 'Report_collection';
3. begin
I got out the 'N' quotes of the N :
DECLARE
p_collection_name VARCHAR2(9000) := 'Report_collection';
begin
IF (apex_collection.collection_exists(p_collection_name => p_collection_name)) THEN
apex_collection.delete_collection(p_collection_name => p_collection_name);
END IF;
apex_collection.create_collection_from_query(
p_collection_name => 'Report_collection',
p_query => 'SELECT DISTINCT AUD_SR AS SR, C.USER_NAME AS AUDITOR, F.ERROR_NAM , A.AUD_OBSERV AS AUDIT_OBS,D.FEEDBK_OBSERV AS FEEDBACK_OBS , E.ANALYSIS_OBS ,A.AUD_STATUS
FROM AUDIT_PROCESS A, MICC_AT_DATA B, MICC_AT_USER C, FEEDBACK_PROCESS D, MICC_AT_ANALISYS E, MICC_AT_ERROR F
WHERE B.DATA_MONTH = :P27_MONTH AND B.DATA_SR = A.AUD_SR AND C.ID = B.DATA_AUDITOR AND F.ERROR_ID = A.AUD_ERROR AND A.FEEDBACK_COD = D.FEEDBACK_COD AND D.FEEDBK_AGREE = N AND E.COD_ANALYSIS = A.COD_ANALYSIS ORDER BY AUDITOR');
APEX_MAIL.send(
p_to => '[email protected]',
p_from => '[email protected]',
p_body => p_collection_name ,
p_body_html => '',
p_SUBJ => 'hi',
p_cc => NULL,
p_bcc => NULL ,
p_replyto => NULL
END;
Error : ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ParseErr:ORA-00904: "N": invalid identifier
If you can help me would be great, and if you see another mistake please let me know i have not may reach out the solution about it.
Thanks,
Pablo. -
Calling a method that returns values in a map - using JSTL
Hi I have a method within an object that returns a List for a particular category
public List<String> getFieldsInCategory(String categoryName){
return _categoryFieldsMap.get(categoryName); //This is a map that returns a list
}Trying to call the above function in jsp, the object is available as "document",
how do i pass a key to the above function to return a List.
<c:forEach items="${document.fieldsInCategory('ABSTRACT')}" var="temp">How do i get the list by passing a string key to my method,
please let me know how to go about this.
ThanksJSTL can not directly call methods that take parameters.
All it can do is access javabean properties - ie via the revealed get/set methods.
You can fudge it by having a seperate variable to set:
Map _categoryFieldsMap;
String category = null;
public void setCategory(String category){
this.category = category;
public String getCategory(String category){
return category;
public List<String> getFieldsInCategory(){
return _categoryFieldsMap.get(categoryName); //This is a map that returns a list
}You would then do it like this in your JSP:
<c:set target="document.category" value="ABSTRACT"/>
<c:forEach items="${document.fieldsInCategory}" var="temp">
...The other alternative is to return the entire map to the page.
EL accesses maps quite handily.
so given a method that returns the map:
public Map getCategoryFieldsMap(){
return _categoryFieldsMap;
then the expression: ${document.categoryFieldsMap.ABSTRACT} returns what you are after.
Hope this helps,
evnafets -
Invoking a web service that returns binary
Hi,
Is it possible to invoke a web service that returns a binary object?
Its similar the following example but I need to return a binary object :
declare
v_url:='http://www.somesite.com/function_name?invoke=placeOrder&par1=val1'
v_output varchar2(4000);
begin
select utl_http.request(v_url)
into v_output from dual;
end;
Thanks in advanceNo "advantage" as there are two very different tools.
UTL_HTTP is basically an Oracle PL/SQL web browser. It uses the HTTP application protocol. It is just like your ordinary browser (IE, Firefox, Opera), but as it is server-side and display-less, it comes without a rendering engine.
UTL_DBWS is to interact with web services using the SOAP application protocol. -
BPEL build error when invoke an extrenal Web Service that returns an Array
Hello,
I built with JDeveloper a web service that returns an Array of Java Bean classes and I try to invoke this web service from a BPEL process. The wsdl file is automatically generated by the JDev. When I built the BPEl project I obtained the following error:
[bpelc] [Error] :-1:-1: src-resolve.4.2: Error resolving component 'SOAP-ENC:Array'. It was detected that 'SOAP-ENC:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema document 'http://malangiu-ro:8988/cde-Project-context-root/CdeFactoryWS?WSDL'. If this is the incorrect namespace, perhaps the prefix of 'SOAP-ENC:Array' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'http://malangiu-ro:8988/cde-Project-context-root/CdeFactoryWS?WSDL'.
[bpelc] [Error] :-1:-1: src-resolve.4.2: Error resolving component 'SOAPENC:Array'. It was detected that 'SOAPENC:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema document 'http://malangiu-ro:8988/cde-Project-context-root/Top300FactoryWS?WSDL'. If this is the incorrect namespace, perhaps the prefix of 'SOAPENC:Array' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'http://malangiu-ro:8988/cde-Project-context-root/Top300FactoryWS?WSDL'.
[bpelc] [Error] :-1:-1: src-resolve.4.2: Error resolving component 'SOAP-ENC:Array'. It was detected that 'SOAP-ENC:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema document 'http://malangiu-ro:8988/cde-Project-context-root/CdeFactoryWS?WSDL'. If this is the incorrect namespace, perhaps the prefix of 'SOAP-ENC:Array' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'http://malangiu-ro:8988/cde-Project-context-root/CdeFactoryWS?WSDL'.
Any hint? Thanks in advance!
Regards,
MarinelHi,
BPEL and BPEL PM do not have a good support for SOAPENC-Array: it would be very difficult to create such an array in BPEL or to receive it and manipulate it.
The (unfortunately very intrusive) work around is to change the WSDL of the service to use a XML type defined using XML schema. This is all the more painful that JDev 9.0.4 does not have strong support for complex types.
In general though, I would highly recommend this best practice:
1) Start by define the WSDL contract first
2) Then generate the server side skeleton to implement it
3) Use BPEL as the client to this contract.
By starting with the contract first, you make sure that 1) your interfaces are clean and coarse grained.
2) things like java objects, sessions, etc to not leak through the interface (which would be the worst thing that could happen because it would closely link the client and the server.
Sorry for not being more helpful. This will get radically cleaner in Oracle AS 10.1.3.
Edwin -
SOLVED: How can I use or call a function that returns %ROWTYPE?
Hi
edit: you can probably skip all this guff and go straight to the bottom...In the end this is probably just a question of how to use a function that returns a %rowtype. Thanks.
Currently reading Feuerstein's tome, 5th ed. I've downloaded and run the file genaa.sp, which is a code generator. Specifically, you feed it a table name and it generates code (package header and package body) that will create a cache of the specified table's contents.
So, I ran:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\OPP5.WEB.CODE\OPP5.WEB.CODE\genaa.sp"
749 /
Procedure created.
HR@XE> exec genaa('EMPLOYEES');which generated a nice bunch of code, viz:
create or replace package EMPLOYEES_cache is
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE) return HR.EMPLOYEES%ROWTYPE;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE) return HR.EMPLOYEES%ROWTYPE;
procedure test;
end EMPLOYEES_cache;
create or replace package body EMPLOYEES_cache is
TYPE EMPLOYEES_aat IS TABLE OF HR.EMPLOYEES%ROWTYPE INDEX BY PLS_INTEGER;
EMP_EMP_ID_PK_aa EMPLOYEES_aat;
TYPE EMP_EMAIL_UK_aat IS TABLE OF HR.EMPLOYEES.EMPLOYEE_ID%TYPE INDEX BY HR.EMPLOYEES.EMAIL%TYPE;
EMP_EMAIL_UK_aa EMP_EMAIL_UK_aat;
function onerow ( EMPLOYEE_ID_in IN HR.EMPLOYEES.EMPLOYEE_ID%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMPLOYEE_ID_in);
end;
function onerow_by_EMP_EMAIL_UK (EMAIL_in IN HR.EMPLOYEES.EMAIL%TYPE)
return HR.EMPLOYEES%ROWTYPE is
begin
return EMP_EMP_ID_PK_aa (EMP_EMAIL_UK_aa (EMAIL_in));
end;
procedure load_arrays is
begin
FOR rec IN (SELECT * FROM HR.EMPLOYEES)
LOOP
EMP_EMP_ID_PK_aa(rec.EMPLOYEE_ID) := rec;
EMP_EMAIL_UK_aa(rec.EMAIL) := rec.EMPLOYEE_ID;
end loop;
END load_arrays;
procedure test is
pky_rec HR.EMPLOYEES%ROWTYPE;
EMP_EMAIL_UK_aa_rec HR.EMPLOYEES%ROWTYPE;
begin
for rec in (select * from HR.EMPLOYEES) loop
pky_rec := onerow (rec.EMPLOYEE_ID);
EMP_EMAIL_UK_aa_rec := onerow_by_EMP_EMAIL_UK (rec.EMAIL);
if rec.EMPLOYEE_ID = EMP_EMAIL_UK_aa_rec.EMPLOYEE_ID then
dbms_output.put_line ('EMP_EMAIL_UK lookup OK');
else
dbms_output.put_line ('EMP_EMAIL_UK lookup NOT OK');
end if;
end loop;
end test;
BEGIN
load_arrays;
end EMPLOYEES_cache;
/which I have run successfully:
HR@XE> @"C:\Documents and Settings\Jason\My Documents\Work\SQL\EMPLOYEES_CACHE.sql"
Package created.
Package body created.I am now trying to use the functionality within the package.
I have figured out that the section
BEGIN
load_arrays;
end EMPLOYEES_cache;
/is the initialization section, and my understanding is that this is supposed to run when any of the package variables or functions are referenced. Is that correct?
With that in mind, I'm trying to call the onerow() function, but it's not working:
HR@XE> select onerow(100) from dual;
select onerow(100) from dual
ERROR at line 1:
ORA-00904: "ONEROW": invalid identifier
HR@XE> select employees_cache.onerow(100) from dual;
select employees_cache.onerow(100) from dual
ERROR at line 1:
ORA-06553: PLS-801: internal error [55018]
HR@XE> select table(employees_cache.onerow(100)) from dual;
select table(employees_cache.onerow(100)) from dual
ERROR at line 1:
ORA-00936: missing expressionHe provides the code genaa.sp, and a very brief description of what it does, but doesn't tell us how to run the generated code!
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
So I try wrapping the call in an exec:
HR@XE> exec select employees_cache.onerow(100) from dual;
BEGIN select employees_cache.onerow(100) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 30:
PLS-00382: expression is of wrong type
ORA-06550: line 1, column 7:
PLS-00428: an INTO clause is expected in this SELECT statement
HR@XE> exec select table(employees_cache.onerow(100)) from dual;
BEGIN select table(employees_cache.onerow(100)) from dual; END;
ERROR at line 1:
ORA-06550: line 1, column 14:
PL/SQL: ORA-00936: missing expression
ORA-06550: line 1, column 7:
PL/SQL: SQL Statement ignored
HR@XE> exec employees_cache.onerow(100)
BEGIN employees_cache.onerow(100); END;
ERROR at line 1:
ORA-06550: line 1, column 7:
PLS-00221: 'ONEROW' is not a procedure or is undefined
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredNo joy.
Of course, now that I'm looking at it again, it seems that the way to go is indicated by the first error:
PLS-00428: an INTO clause is expected in this SELECT statement
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
I've had a stab at this, but still, no joy:
create or replace procedure testcache is
emp employees%rowtype;
begin
select employees_cache.onerow(100) from dual into emp;
dbms_output.put_line('Emp id: ' || emp.employee_id);
end testcache;
show errors
HR@XE> @testcache.sql
Warning: Procedure created with compilation errors.
Errors for PROCEDURE TESTCACHE:
LINE/COL ERROR
4/9 PL/SQL: SQL Statement ignored
4/54 PL/SQL: ORA-00933: SQL command not properly ended
HR@XE>Have a feeling this should be really easy. Can anybody help?
Many thanks in advance.
Jason
Edited by: 942375 on 08-Feb-2013 11:45>
Ha, figured it out
>
Hopefully you also figured out that the example is just that: a technical example of how to use certain Oracle functionality. Unfortunately it is also an example of what you should NOT do in an actual application.
That code isn't scaleable, uses expensive PGA memory, has no limit on the amount of memory that might be used and, contrary to your belief will result in EVERY SESSION HAVING ITS OWN CACHE of exactly the same data if the session even touches that package.
Mr. Feuerstein is an expert in SQL and PL/SQL and his books cover virtually all of the functionality available. He also does an excellent job of providing examples to illustrate how that functionality can be combined and used. But the bulk of those examples are intended solely to illustrate the 'technical' aspects of the technology. They do not necessarily reflect best practices and they often do not address performance or other issues that need to be considered when actually using those techniques in a particular application. The examples show WHAT can be done but not necessarily WHEN or even IF a given technique should be used.
It is up to the reader to learn the advantages and disadvantages of each technicalogical piece and determine when and how to use them.
>
Now, I have just done some googling, and it seems that what I am trying to do isn't possible. Apparently %ROWTYPE is PL/SQL, and not understood by SQL, so you can't call onerow() from sql. Correct?
>
That is correct. To be used by SQL you would need to create SQL types using the CREATE TYPE syntax. Currently that syntax does not support anything similar to %ROWTYPE.
>
So am I supposed to create a type of EMPLOYEES%ROWTYPE in a PL/SQL procedure, and the idea of this code, is that the first call to onerow() runs the initialiation code, which populates the cache, and all subsequent calls to onerow() (whether by my session or any other) will use the cache?
>
NO! That is a common misconception. Each session has its own set of package variables. Any session that touches that package will cause the entire EMPLOYEES table to be queried and stored in a new associative array specifically for that session.
That duplicates the cache for each session using the package. So while there might be some marginal benefit for a single session to cache data like that the benefit usually disappears if multiple sessions are involved.
The main use case that I am aware of where such caching has benefit is during ETL processing of staged data when the processing of each record is too complex to be done in SQL and the records need to be BULK loaded and the data manipulated in a loop. Then using an associative array as a lookup table to quickly get a small amount of data can be effective. And if the ETL procedure is being processed in parallel (meaning different sessions) then for a small lookup array the additional memory use is tolerable.
Mitigating against that is the fact that:
1. Such frequently used data that you might store in the array is likely to be cached by Oracle in the buffer cache anyway
2. Newer versions of Oracle now have more than one cache
3. The SQL query needed to get the data from the table will use a bind variable that eliminates repeated hard parsing.
4. The cursor and the buffer caches ARE SHARED by multiple sessions globally.
So the short story is that there would rarely be a use case where ARRAYs like that would be preferred over accessing the data from the table. -
I have a function from a dll that return a double* string and an integer. How can I call this function from LabVIEW? There is a possibility to work in LabVIEW with a double* string?
pcbv wrote:
> Hello all,<br><br>The header of the function is:
>
> "HRESULT WRAPIEnumerateDevices(WRAPI_NDIS_DEVICE **ppDeviceList, long *plItems);"
>
> where WRAPI_NDIS_DEVICE have this form:
>
> typedef struct WRAPI_NDIS_DEVICE<br>{<br>
> WCHAR *pDeviceName;<br>
> WCHAR *pDeviceDescription;<br><br>}
> WRAPI_NDIS_DEVICE;<br><br>
>
> The function is from WRAPI.dll, used for communication with wireless card.
> For my application I need to call in LabVIEW this function.
Two difficulties I can see with this.
First the application seems to allocate the array of references
internally and return a pointer to that array. In that case there must
be another function which then deallocates that array again.
Then you would need to setup the function call to have a pointer to an
int32 number for the deviceList parameter and another pointer to int32
one for the plItems parameter.
Then create another function in your DLL similar to this:
HRESULT WRAPIEnumExtractDevice(WRAPI_NDIS_DEVICE *lpDeviceList, long i,
CHAR lpszDeviceName, LONG lenDeviceName,
CHAR lpszDeviceDesc, LONG lenDeviceDesc)
if (!lpDeviceList)
return ERROR_INV_PARAMETER;
if (lpDeviceList[i].pDeviceName)
WideCharToMultiByte(CP_ACP, 0,
pDeviceList[i].pDeviceName, -1,
lpszDeviceName, lenDeviceName,
NULL, NULL);
if (lpDeviceList[i].pDeviceName)
WideCharToMultiByte(CP_ACP, 0,
pDeviceList[i].pDeviceDescription, -1,
lpszDeviceDesc, lenDeviceDesc,
NULL, NULL);
return NO_ERROR;
Pass the int32 you got from the first parameter of the previous call as
a simple int32 passed by value to this function (and make sure you don't
call this function with a higher index than (plItems - 1) returned from
the first function.
Rolf Kalbermatter
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Problem with web service that returns an object with a String that have som
Hi everybody:
I have a problem with a web service I am doing, I have made a web service that returns a collection of objects, the objects have a set of properties, there is one property that is a String,this property consists in a text fragment that could have some characters that are considered special in XML like &, <, >, " and that's why when I execute the service from a client an exception is thrown:
{code}
Exception in thread "main" org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
at [row,col {unknown-source}]: [9,646]
org.codehaus.xfire.fault.XFireFault: Could not read XML stream.. Nested exception is com.ctc.wstx.exc.WstxParsingException: Expected a text token, got START_ELEMENT.
at [row,col {unknown-source}]: [9,646]
at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
at org.codehaus.xfire.client.Client.onReceive(Client.java:410)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:139)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:48)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:79)
at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:114)
at org.codehaus.xfire.client.Client.invoke(Client.java:336)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy0.search(Unknown Source)
at cu.co.cenatav.webservices.client.Client.main(Client.java:26)
{code}
I know that this is happening because special characters are sent by the soap message but I don't know how to solve this problem.
How could I avoid this exception ?
I hope you can help me.
Regards.
ArielHi,
BPEL and BPEL PM do not have a good support for SOAPENC-Array: it would be very difficult to create such an array in BPEL or to receive it and manipulate it.
The (unfortunately very intrusive) work around is to change the WSDL of the service to use a XML type defined using XML schema. This is all the more painful that JDev 9.0.4 does not have strong support for complex types.
In general though, I would highly recommend this best practice:
1) Start by define the WSDL contract first
2) Then generate the server side skeleton to implement it
3) Use BPEL as the client to this contract.
By starting with the contract first, you make sure that 1) your interfaces are clean and coarse grained.
2) things like java objects, sessions, etc to not leak through the interface (which would be the worst thing that could happen because it would closely link the client and the server.
Sorry for not being more helpful. This will get radically cleaner in Oracle AS 10.1.3.
Edwin -
Call RFC that return structure using VB
Hi, anyone has a sample code to call a custom RFC that returns table structure?
The RFC expect parameters to pinpoint the record and return it in a structure.
*Local Interface:
IMPORTING
VALUE(CUSTOMER) LIKE KNA1-KUNNR
VALUE(MATERIAL) LIKE MARA-MATNR
VALUE(POSTING_DATEFR) LIKE BKPF-BUDAT
VALUE(POSTING_DATETO) LIKE BKPF-BUDAT
TABLES
SALES_VOLUME STRUCTURE ZRRPS_SALES
Here's my vb code, but it return zero entries (I'm sure it should return records).
***Login Process Here***
Set objFunc = objSAPLogon.Add("Z_CUSTOM_SALES_DATA")
Set objSALES = objFunc.Tables("SALES_VOLUME")
With objFunc
.Exports("CUSTOMER") = "1234567"
.Exports("MATERIAL") = "1234"
.Exports("POSTING_DATEFR") = "10012005"
.Exports("POSTING_DATETO") = "10312005"
End With
If Not objFunc.Call Then
Debug.Print objFunc.Exception
Exit Sub
End If
Debug.Print objSALES.RowCount ==> 0
From here, I dont know what to do next. Am I missing something? Please help.
Thanks in advance!
/NoelYes, the RFC developer told me to use this format mmddyyyy.
I think the Exports portion is not working, and I dont know why. I tried remarking the Exports portion and it gives the same result, zero entries.
Thanks! -
Sort/filter datablock based on procedure that return table type
Hi All,
I’ve got datablock based on procedure that return table type. In the form I have to provide ‘filter and sort records’ functionality. Previously, using tables/views based datablocks, I’ve done that by using:
-- filter
SET_BLOCK_PROPERTY (L_BLOCK_NAME, DEFAULT_WHERE, L_WHERE_CLAUSE);
-- sort
SET_BLOCK_PROPERTY(L_BLOCK_NAME ,ORDER_BY, L_ORDER_BY_CLAUSE);
-- and then
EXECUTE_QUERY;
It doesn’t work with procedure that return table type. How I can do that?
BartekI agree with Andreas, from the sample you have given us, I don't see any reason why you could not merge these queries into a single UNION/UNION ALL query. Also, I would add your summation query to your main query to eliminate this extra step. The result would look something like:
SELECT DISTINCT
pih.id
,d.document_id
,pih.doc_serial_no
,pih.purch_invoice_date
,oh.company_name
,(SELECT NVL(SUM(amount),0)
FROM "YOUR TABLE HERE" yth
WHERE yth."YOUR COLUMN HERE" = pih.id) AS sum_amount
FROM "YOUR TABLES HERE"
WHERE "YOUR JOIN CONDITIONS HERE"
UNION ALL
SELECT DISTINCT
sih.id
,d.document_ind
,sih.doc_serial_no
,sih.sales_invoice_date
,sih.company_name
,(SELECT NVL(SUM(amount),0)
FROM "YOUR TABLE HERE" yth
WHERE yth."YOUR COLUMN HERE" = sih.id) AS sum_amount
FROM "YOUR TABLES HERE"
WHERE "YOUR JOIN CONDITIONS HERE"
[/code]
Hope this helps.
Craig...
+If a response is helpful or correct, please mark it accordingly+
Edited by: CraigB on Feb 23, 2010 1:39 PM
It appears the CODE tags are not working as well as the URL tags. :( -
Database control: how to read output of sproc that returns result set
I have a stored procedure that returns a result set. Should I use a RowSet control to wrap this, or a database control, or neither? Am I better off with straight JDBC in a Java control?
Thanks.Sorry for missing the point totally...
DOKTL also contains long text for FM parameters...
This is a modified version of your code that retrieves the long text and displays it...
DATA: parameter TYPE TABLE OF swotfupar,
ls_parameter LIKE LINE OF parameter,
search_string TYPE doktl-object,
texttab type table of doktl-doktext with header line.
PARAMETERS: fubaname TYPE swcontdef-abapname
DEFAULT 'POPUP_TO_CONFIRM',
pa_lang TYPE sy-langu.
START-OF-SELECTION.
CALL FUNCTION 'SWO_QUERY_FUNCTION_PARAMETERS'
EXPORTING
functionmodule = fubaname
TABLES
function_parameters = parameter
* EXCEPTIONS
* FUNCTION_NOT_FOUND = 1
* OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT parameter INTO ls_parameter.
CONCATENATE ` ` "30 spaces
ls_parameter-parameter INTO search_string.
OVERLAY search_string WITH fubaname.
SELECT doktext FROM doktl INTO TABLE texttab
WHERE id = 'FU'
AND langu = pa_lang
AND object = search_string.
WRITE:/ 'Long Text for', ls_parameter-parameter.
LOOP AT texttab.
NEW-LINE.
WRITE: AT 10 texttab COLOR COL_HEADING.
ENDLOOP.
ENDLOOP.
Hope this helps you
Regards,
Dushyant Shetty -
Web Service Method that returns an ArrayList
Hi guys,
I have to create a web service method that returns an ArrayList, but it's not working. My problem is:
With the "@XmlSeeAlso" annotation, my client prints the result, but the ArryaList is not from java.util, it's from org.me.calculator so I can't use it.
If I remove this annotation, I get no result, with this error message on Tomcat 6:
[javax.xml.bind.JAXBException: class java.util.ArrayList nor any of its super class is known to this context.]
I'm a newbie, and trying to understand web services (I read some posts here, but didn't get the point, from its answers), but this problem I just can't figure out how to solve....
WEb Service
package org.me.calculator;
import java.io.Serializable;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.util.*;
import java.util.ArrayList;
import javax.xml.bind.annotation.XmlSeeAlso;
* @author eduardo.domanski
@WebService()
@XmlSeeAlso({java.util.ArrayList.class}) // With this, I can see the result on client, but, the ArrayList is an org.me.calculator.ArrayList class.... Strange...
public class CalculatorWS {
@WebMethod(operationName = "valores")
public ArrayList valores(@WebParam(name = "a") int a,
@WebParam(name = "b") int b) {
ArrayList teste = new ArrayList();
ArrayList a1 = new ArrayList();
a1.add(a);
a1.add(b);
ArrayList a2 = new ArrayList();
a2.add(a+b);
a2.add(a-b);
teste.add(a1);
teste.add(a2);
return teste;
}CLient
package org.me.calculator.client;
import java.io.*;
import java.net.*;
import java.util.ArrayList;
import javax.servlet.*;
import javax.servlet.http.*;
public class ClientServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet ClientServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet ClientServlet at " + request.getContextPath() + "</h1>");
try { // Call Web Service Operation
org.me.calculator.CalculatorWSService service = new org.me.calculator.CalculatorWSService();
org.me.calculator.CalculatorWS port = service.getCalculatorWSPort();
// TODO initialize WS operation arguments here
int i = 8;
int j = -6;
// TODO process result here
ArrayList result = (ArrayList) port.valores(i, j);
out.println("Result = " + result);
} catch (Exception ex) {
System.out.println(ex);
// TODO handle custom exceptions here
out.println("</body>");
out.println("</html>");
out.close();
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}THank you all,
Eduardo
Edited by: EduardoDomanski on Apr 23, 2008 4:40 AMI forgot to say that, when I try to return an ArrayList of an object, for example, ClassA, which is on the package org.me.classes, on my Server App, the ArrayList is returned, but the objects are from type org.me.calculator.ClassA. It should be from org.me.classes.ClassA, right?
This package also exists on my client App, to use the object, but as the returned type is from another package, I can't even cast it. I tried some annotations @Xml... but it failed.
Packages
ServerApp
org.me.calculator
CalcWS.java
org.me.classes
ClassA.java
Client App
org.me.classes
ClassA.java
The return from my method should be an ArrayList of org.me.classes.ClassA, but when I print it, on client, it's from org.me.calculator.ClassA.
Does anybody knows, or had the same problem?
Thanks,
Eduardo -
Stored procedure that returns a cursor (result set)
Hi,
We have a stored procedure that returns a cursor (result set) but when I compliled it and catalouged (introspected) it in the OBPM I got all the primitive type parameters (either IN or OUT) in the proc call except the cursor type (the result set) which is the out param of the stored proc.
Any pointers please?
ThanksResult set is of RowType and is not supported as a Stored Procedure as far as I know.
HTH
Sharma
Maybe you are looking for
-
Logical path and syntax groups
WE know that we may define ligical file & logical file path. It is said that if we link a logical path to a logical file the logical file is valid for all syntax groups thgat have been maintained for that logical path? Could some one explain how
-
Issue with MacBook Pro trackpad and Adobe Lightroom 5
I'm using Lightroom 5 on a MacBook Pro (mid 2012). Whenever I'm in the development tab I am unable to click on anything within the center third of the screen. If I want to get to the 5th or 6th photo in the bottom pan, I have to use my mouse. I am
-
How to send mail to different text file
Hello experts. I follow the example in the manual under What I have discovered is that it will send email no matter which Organization a user is created in. e.g. Top or Top:MyOrg sent to text file ie Notification file( I use text file and not the SMT
-
Error in execution of query's from Query Designer
Hi, We have recently installed the BI 7 server, when i execute the query from query designer i got the following URL: http:///irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.b
-
Not allowing to save changes in program
When i try to make some changes in Standard program and then save it, i create a new request for it and then try to save. It flashes a msg : "SAP names file for TCS_ABAP locked by another process" ...and does not let me save changes.But it does creat