Pass complex types from Java to C++
Hi,
I am new to JNI and I read some online documentation. I was wondering how difficult it is to pass complex Java types to C++ functions. I guess I need to map the Java class to a C++ class somehow. I could not find any useful examples that do this. For example, I have the Java classes:
class SomeClassA
double someFieldA;
class SomeClassB
ArrayList<SomeClassA> collA;
double someFieldB;
}Now I would like to map this to the following C++ class:
class some_class_a
double _some_field_a;
class some_class_b
vector<some_class_a> _coll_a;
double _some_field_b;
};I do not need to access Java objects from my C++, I just want the objects to be "serialized" into C++ objects.
Is there an example that does something like this? Or should I use something different than JNI?
Thank you,
Andrej
I do not need to access Java objects from my C++, I just want the objects to be "serialized" into C++ objects.Then you need to access java objects.
Is there an example that does something like this? Write java code to access the data of the object (and via that the sub collection).
That code represents exactly the same thing that you must do in JNI calls in your C code. Naturally excluding populating the C structures themselves of course. Most a matter of calling methods and accessing attributes. That is all in the JNI docs and there are plenty of examples of both of those.
Similar Messages
-
Passing a structure from Java to PL/SQL Procedure
Environment: Oracle DB, Tomcat/Apache
How do we pass a structure (Table Record Type) from Java to a PL/SQL Stored Procedure?
We are doing JSP-->JavaClass/Bean to communicate to DB. We have an existing PL/SQL packages/Procedure to insert records into table (These procedures have record types as in/out parameters). So is there a way to call these from Java?
Thanks in advance.
RameshOracle9 i JDBC Developers Guide and Reference(page 21-16):
It is not feasible for Oracle JDBC drivers to support calling arguments or return
values of the PL/SQL RECORD, BOOLEAN, or table with non-scalar element types.
However, Oracle JDBC drivers support PL/SQL index-by table of scalar element
types. For a complete description of this, see "Accessing PL/SQL Index-by Tables"
on page 16-21.
As a workaround to PL/SQL RECORD, BOOLEAN, or non-scalar table types, create
wrapper procedures that handle the data as types supported by JDBC. For example,
to wrap a stored procedure that uses PL/SQL booleans, create a stored procedure
that takes a character or number from JDBC and passes it to the original procedure
as BOOLEAN or, for an output parameter, accepts a BOOLEAN argument from the
original procedure and passes it as a CHAR or NUMBER to JDBC. Similarly, to wrap a
stored procedure that uses PL/SQL records, create a stored procedure that handles
a record in its individual components (such as CHAR and NUMBER) or in a structured
object type. To wrap a stored procedure that uses PL/SQL tables, break the data
into components or perhaps use Oracle collection types. -
Passing Tables back from Java Stored Procedures
Thomas Kyte has written (in reference to
trying to pass an array back from a stored
function call):
You can do one of two things (and both require the use of
objects). You cannot use PLSQL table types as JDBC cannot bind to
this type -- we must use OBJECT Types.
[snip]
Another way is to use a result set and "select * from
plsql_function". It could look like this:
ops$tkyte@8i> create or replace type myTableType as table of
varchar2 (64);
2 /
Type created.
ops$tkyte@8i>
ops$tkyte@8i>
ops$tkyte@8i> create or replace
2 function demo_proc2( p_rows_to_make_up in number )
3 return myTableType
4 as
5 l_data myTableType := myTableType();
6 begin
7 for i in 1 .. p_rows_to_make_up
8 loop
9 l_data.extend;
10 l_data(i) := 'Made up row ' | | i;
11 end loop;
12 return l_data;
13 end;
14 /
Function created.
ops$tkyte@8i>
ops$tkyte@8i> select *
2 from the ( select cast( demo_proc2(5) as mytableType )
3 from dual );
COLUMN_VALUE
Made up row 1
Made up row 2
Made up row 3
Made up row 4 [Image]
Made up row 5
So, your JDBC program would just run the query to get the data.
If the function "demo_proc2" cannot be called from SQL for
whatever reason (eg: it calls an impure function in another piece
of code or it itself tries to modify the database via an insert
or whatever), you'll just make a package like:
ops$tkyte@8i> create or replace package my_pkg
2 as
3
4 procedure Make_up_the_data( p_rows_to_make_up in
number ); 5 function Get_The_Data return myTableType;
6 end;
7 /
Package created.
ops$tkyte@8i>
ops$tkyte@8i> create or replace package body my_pkg
2 as
3
4 g_data myTableType;
5
6 procedure Make_up_the_data( p_rows_to_make_up in number )
7 as
8 begin
9 g_data := myTableType();
10 for i in 1 .. p_rows_to_make_up
11 loop
12 g_data.extend;
13 g_data(i) := 'Made up row ' | | i;
14 end loop;
15 end;
16
17
18 function get_the_data return myTableType
19 is
20 begin
21 return g_data;
22 end;
23
24 end;
25 /
Package body created.
ops$tkyte@8i>
ops$tkyte@8i> exec my_pkg.make_up_the_data( 3 );
PL/SQL procedure successfully completed.
ops$tkyte@8i>
ops$tkyte@8i> select *
2 from the ( select cast( my_pkg.get_the_data as mytableType
) 3 from dual );
COLUMN_VALUE
Made up row 1
Made up row 2
Made up row 3
And you'll call the procedure followed by a query to get the
data...
I have tried this, and it works perfectly.
My question, is what does the wrapper look
like if the stored function is written
in java instead of PL/SQL? My experiments
with putting the function in java have been
dismal failures. (I supposed I should also
ask how the java stored procedure might
look also, as I suppose that could be where
I have been having a problem)
nullThanks for the response Avi, but I think I need to clarify my question. The articles referenced in your link tended to describe using PL/SQL ref cursors in Java stored procedures and also the desire to pass ref cursors from Java to PL/SQL programs. Unfortunately, what I am looking to do is the opposite.
We currently have several Java stored procedures that are accessed via select statements that have become a performance bottleneck in our system. Originally the business requirements were such that only a small number of rows were ever selected and passed into the Java stored procedures. Well, business requirements have changed and now thousands and potentially tens of thousands of rows can be passed in. We benchmarked Java stored procedures vs. PL/SQL stored procedures being accessed via a select statement and PL/SQL had far better performance and scaleable. So, our thought is by decouple the persistence logic into PL/SQL and keeping the business logic in Java stored procedures we can increase performance without having to do a major rewrite of the existing code. This leads to the current problem.
What we currently do is select into a Java stored procedure which has many database access calls. What we would like to do is select against a PL/SQL stored procedure to aggregate the data and then pass that data via a ref cursor (or whatever structure is acceptable) to a Java stored procedure. This would save us a significant amount of work since the current Java stored procedures would simple need to be changed to not make database calls since the data would be handed to them.
Is there a way to send a ref cursor from PL/SQL as an input parameter to a Java stored procedure? My call would potentially look like this:
SELECT java_stored_proc(pl/sql_stored_proc(col_id))
FROM table_of_5000_rows;
Sorry for the lengthy post. -
Accessing table type from JAVA
Hi Experts,
We are making a custom copy of the std FM COM_BPUS_ORG_CONTPERS_REGISTER .
It is observed that Tables are obsolete and we should not use them in custom function modules.
I can pass a table type in import parameter and export parameter.
Can we access a table type from java layer.
Also, note that this STANDARD function module has parameter IT_BUSINESSPARTNERROLE_ORG which has table type BU_ROLE_T.
Is it possible to access this?
Note:- This Function module is not getting called in standard web shops.
Please let me now how i can access this table type for hava while calling FM so as to input or retrieve valus from it.
Regards
AntonyThe issue with you is more than accessing a table type.
You said:
This Function module is not getting called in standard web shops.
For function modules that are not called as a part of the standard flow, you have to develop your own simple BOM, BO, BEI, BE classes and methods to call the custom RFC - the whole nine yards. See the extension guide and see the Extension Demos 2 and 3 for reference.
See the sample JCO calls from Java to understand how to access the table types. -
Passing a String from Java to Javascript
Does anybody know how to pass a string from Java class to Javascript ? Can it be done?
If you are talking in terms of web terminology...
People do intialization of page in the following way.
var java_script_variable = <%=String_variable%> -
Serializing derived complex types from XML
Hi all,
I am having a hard time serializing derived complex types
from XML. I used the "Import Web Service" wizard to create proxy
classes for the SOAP described elements.
The XML that I am consuming comes from a .NET backed and
include typing statements like this:
<AssetType xsi:type="CarAssetType" />
This element is always serialized as an instance of AssetType
not an instance of CarAssetType.
Does flex not support derived typing during XML
serialization?
Thanks for the help,
Derek BaschYou may need consume wsdl file or web service using the following steps to generate the corrected schemas:
Right click to you BizTalk project
Add->Add Generated Items..
Consume WCF Service
Select Metadata Exchange
Add wsdl path
When you see answers and helpful posts, please click Vote As HelpfulPropose As Answer, and/or Mark As Answer -
Example of passing String Array from java to C using JNI
hi all
i searched net for passing string array from java to C but i dont get anything relevent
i have
class stu
int rollno
string name
String [] sub
i want to pass all as String array from java to C and access it C side1. Code it as though it were being passed to another method written in java.
2. Redefine the method implementation to say "native".
3. Run jnih to generate a C ".h" file. You will see that the string array
is passed into C as a jobject, which can be cast to a JNI array.
4. Write the C code to implement the method and meet the interface
in the generated .h file. -
Passing complex object from JavaScript to Flex
Is it possible to call a Flex function (defined with ExternalInterface.addCallback) and pass a complex object from Javascript? The properties of the object are all simple types, but the object itself is an array of objects. For example:
<script type="text/javascript">
var arrayOfObj = [ { one: "one", two: 2, three: "blah" }, { one: "xyz", two: "abc", three: 3.141 } ];
callSomeFunctionInFlex(arrayOfObj);
</script>
What would I do on the Flex side to make this happen?Complex object passing works as expected in Blazeds.
There are certain cases where you need to write custom bean proxy classes to marshall an object, but your case is very simple and will not require it.
Make sure that you set the full java package and class name in your remote alias statement on your client value object. The class has to be fully qualified. The AS value object also needs the correct import of the nested value object or you will get a compile error.
Make sure that the blazeds server has the full class path set to your java objects.
To debug, you can turn on Blazeds logging in the services-config.xml file like this:
<logging>
<!-- You may also use flex.messaging.log.ServletLogTarget -->
<target class="flex.messaging.log.ConsoleTarget" level="DEBUG">
<properties>
<prefix>[BlazeDS]</prefix>
<includeDate>false</includeDate>
<includeTime>false</includeTime>
<includeLevel>true</includeLevel>
<includeCategory>false</includeCategory>
</properties>
</target>
</logging> -
Passing an array from Java to Pl/SQL Procdures
I am relatively new to the Java world and I am unable to pass back an array from Java back to the calling PL/SQL procedure. I have read many of the posts that deal with this issue and in specificly have viewed Ask Tom. My main issue is trying to get the data types matched up. I am able to return varchar2, numbers, and the like, but an array of filenames is not happening. I have tried a variety of "types" but unable to accomplish the task. Please help.
I have my Java class basically defined as:
public static oracle.sql.ARRAY[] getCollection(String directory)
throws SQLException
{ // provide a directory and get a listing of files
File path = new File( directory );
String[] list = path.list();
return list;
SQL Type and PL/SQL Procedure is:
CREATE OR REPLACE TYPE PTO_FILE IS TABLE OF VARCHAR2(100);
create or replace function get_dir_collection( p_directory in varchar2 ) RETURN PTO_FILE
as language java
name 'DirCollection.getCollection( java.lang.String ) return oracle.sql.ARRAY[]';
/I know that it is not an ARRAY. It is however an "array" and I am attempting to map Java's String[][ to some "object" on the oracle side. I have looked at the link you sited and was not able to find the data mapping. I have found that mapping data types between different "languages" is some of the most difficult aspects of working with multiple languages.
Any suggestions? Thanks -
Referencing package table type from Java
Hi,
In my package spec, I have a table type defined. I just want to refer this from Java program in order to pass ARRAY object to a procedure inside the package. But I keep getting an errory saying "Invalid name pattern".
But If I declare the type outside of the package, it works fine. Can anyone help me on this?
Regards,
Poornachandran RHi,
create or replace package msproot.spear$util as
-- UUID table type
type varchar32_t is table of varchar2(32) index by binary_integer;
* Function name: getUUID
* Desc: Retreive a unique id.
* IN: maxNumOfUUID - integer, the quentity of UUID to generate, optional default 1.
* OUT: UUID - an array of 32 characters string of UUID
function getUUID(maxNumOfUUID number :=1 ) return varchar32_t;
end spear$util;
create or replace package body msproot.spear$util as
-- get uuid - retun more the one UUID
function getUUID(maxNumOfUUID number) return varchar32_t is
uuidArr varchar32_t;
begin
-- generate the array of uuid up to maxNumOfUUID
for i in 1..maxNumOfUUID loop
select sys_guid into uuidArr(i) from dual;
end loop;
return (uuidArr);
end getUUID;
end spear$util;
private String[] retrieveUuid(int maxNumOfUUID) throws Exception
String[] arr = null;
try {
// generate a free spear ids array from the database
// Use a PL/SQL block to open the stored procedure
OracleCallableStatement ocstmt =
(OracleCallableStatement) conn
.prepareCall("begin ? := spear$util.getUUID(?); end;");
// index-by table element type
int elemSqlType = OracleTypes.CHAR;
// index-by table element length in case the element type
// is CHAR, VARCHAR or RAW. This value is ignored for other
// types
int elemMaxLen = 32;
// register the return parameter
ocstmt.registerIndexTableOutParameter(1, maxNumOfUUID, elemSqlType,
elemMaxLen);
// register the number of UUIDes to generate
ocstmt.setInt(2, maxNumOfUUID);
// run the stored procedure
ocstmt.execute();
// access the value using JDBC default mapping
arr = (String[]) ocstmt.getPlsqlIndexTable(1);
// close the cursor
ocstmt.close();
} catch (SQLException x) {
System.out.println(errorMessage + x.toString());
throw new Exception(errorMessage + x.getMessage());
return arr;
Best,
EA -
Pass 2D array from java to PLSQL
HI,
My requirement is that I have to pass dynamic parameters to be stored in a table. The table I have is
CODE || TAG_LABEL || TAG_COLMN_NAME
023 || Registration || CHAR_TAG1
023 || Agreement Number || NUM_TAG1
023 || Agency || NUM_TAG2
023 || Start Date || DATE_TAG1
this table A. gives me the list of all possible parametes
CODE || CHAR_TAG1 || CHAR_TAG2 || NUM_TAG1 || NUM_TAG2 .. ..
023 || 420/09 || -- || 100023 || 1002
021 || -- || 400030 || -- || --
023 || 450/10 || -- || 100025 || --
this table B gives the place where the values for this parameter has to be stored.So for code 023 if I have parameters say Registration='240/10' and start_date = '10/02/2010' then, how do I pass these dynamic paramters to the plsql and from there how do i handle storing this in my final Table B.
I searched the net for Dynamic sql and I am very basic in PLSQLs. Can anyone please help or atleast if there is a documentation that does exactly this, it would be very helpful.
Thanks
RacheFrom the pl/sql side you need to create your object types
create or replace type sample_array_obj
as object( firstitem varchar2(20 char),
seconditem varchar2(10 char)
create or replace
type sample_array_type is table of sample_array_objand then you need to grant execute access on both the object and type
grant execute on sample_array_obj to public;
grant execute on sample_array_type to public;you have to declare these to java then. (I'm not a java programmer, but the java then has to get its collection type from the database) -
Passing String Array from Java to PL/SQL
Hi,
We are having couple of packages which have been written in PL/SQL . I would like to know how i can send arrays as input parameters from Java to any stored proc in Oracle. I am having Oracle 8i as the DB and am using Websphere RSA for deployment purposes.
please find below Java , PL/SQL code and exception
PL/SQL Code :
PACKAGE PKG_SURCHARGE
IS
TYPE commodity_key IS TABLE OF VARCHAR2(500) INDEX BY BINARY_INTEGER;
PROCEDURE RETRIEVE_CHARGES
in_Commodity_tab IN commodity_key,
IS
BEGIN
dbms_output.put_line('in_Commodity_tab(' || '0' || ') : ' || in_Commodity_tab(0) );
Java Code :
CallableStatement cstmt=null;
Connection conn=null;
try{
conn=getConnection();
System.out.println("++++++connected");
String sqlStr = "{call Pkg_Surcharge.RETRIEVE_CHARGES(?) }";
cstmt = conn.prepareCall(sqlStr );
//1.
String[] javaArray={"20081117","20081117"};
ArrayDescriptor dateDescripter = ArrayDescriptor.createDescriptor( "commodity_key", conn );
oracle.sql.ARRAY dateArray = new oracle.sql.ARRAY(dateDescripter, conn, javaArray);
System.out.println("++++++registered-1");
Catch (Exception e){
e.printStackTrace();
Exception Occured:
java.sql.SQLException: Invalid Pattern Name <Schema Name>.commodity_key
Appreciate your help in this regard
Thanks
Srini
Edited by: [email protected] on Nov 25, 2008 4:55 AMAvi is correct. You must create a varray or nested table instead of using a PL/SQL index-by table.
SQL> create type commodity_key as varray(#) of varchar2(500);
or
SQL> create type commodity_key as table of varchar2(500);
Use the varray if you know the number of items in the array. Otherwise, use the nested table. -
Passing (byref) String from Java to C++ via JNI
I wish to pass a string to a C++ Dll as a parameter in a function. The problem is that I don't know howto receive back the data after it is filled in the C++ dll. I am trying to do what is called passing parameters by reference.
Java Code:
public class ABKeyBoard {
public native long leerBanda(int pista, String datos);
public static void main(String[] args) {
String datos=new String();
System.loadLibrary("ABKeyBoard");
new ABKeyBoard().leerBanda(1,datos);
System.out.println(datos); //the content of datos here is empty.
C++ Code:
Java_ABKeyBoard_leerBanda(JNIEnv *env, jobject obj,jint pista, jstring datos)
char buffer[2024];
memset(buffer, 0x00, sizeof(buffer));
strcpy(buffer, "xxxx");
datos = env->NewStringUTF(buffer);
return;
Thanks for your help.In java every parameter are always passed by value.
The datos parameter is a local copy of the string
reference you pass to the method.This is wrong. The String passed to the native method is the same String object you use in Java. Although everything is passed by value in Java, what is actually passed by value is the reference to the String. This means that you can modify the object you pass, but you are not allowed to change the reference to point to a totally different object. That is where the problem is coming in.
The trouble is that it is illegal to modify a String, even from native code. If you need to make changes in-place to the text, pass an array of chars (if your native code uses Unicode), an array of bytes (if it uses normal 8-bit characters) or a StringBuffer. You can legally modify any of these data structures with the new data. But the StringBuffer object is the only one whose length can be changed after it is created. Unfortunately it is also the hardest to use from JNI.
Generally I think you should always pass arrays of bytes/chars to native code instead of Strings when possible. They can be modified in place, and you can use String's methods to get a byte-array in the platform's proper encoding. Using the GetStringUTFChars method is problematic because UTF only maps directly onto ASCII in the case of characters which are in the set of 7-bit ASCII characters. Your code will do wrong things if your String happens to contain some other character, unless your native code expects UTF format strings.
The good news is that C(++) functions which return results in their arguments do not ordinarily change the length. So you should be able to allocate a byte[] or char[] ahead of time of the appropriate size (don't forget to add the trailing null, which is not a component of Java strings). I think byte[] or char[] is the best answer because you can easily map those onto C-style arrays with Get[Primitive]ArrayRegion; the return of that is suitable for passing directly to native code, as long as you have remembered the null-terminator. For instance you could do (*env)->GetByteArrayRegion(env, javaArray, 0, arrayLength, CArray) and then your CArray would be changed to point at the contents of the javaArray (note: it does not copy data into CArray, it changes CArray to point at the array contents, so do not allocate memory for CArray first). Then when you do ReleaseByteArrayRegion the results will be propagated back to Java. -
Re: Passing a string from Java class to JSP
How can I pass a string from a function within my bean class to my JSP page?
I would like to pass something like this with the necessary params filled in:
String myString ="Successful <b>" + Sales.getActionType() + "</b> was made on <b>" + (new Date()).toString();
The ActionType will be either a BUY or SELL and the current date need to be added in.
Thank you in advance!SOLVED THE PROBLEM!!!
-
Passing complex object from bpel process to web service
I have deployed my web service on apache axis.The wsdl file looks like as follows,
<?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://bpel.jmetro.actiontech.com" xmlns:intf="http://bpel.jmetro.actiontech.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="ADLevelBpelWS">
- <sequence>
<element name="adLevelStr" nillable="true" type="xsd:string" />
<element name="id" type="xsd:int" />
</sequence>
</complexType>
- <complexType name="TransResultWS">
- <sequence>
<element name="description" nillable="true" type="xsd:string" />
<element name="id" type="xsd:long" />
<element name="responseType" type="xsd:int" />
<element name="status" type="xsd:boolean" />
</sequence>
</complexType>
- <complexType name="NamespaceDataImplBpelWS">
- <sequence>
<element name="ADLevel" nillable="true" type="impl:ADLevelBpelWS" />
<element name="appdataDef" nillable="true" type="apachesoap:Map" />
<element name="description" nillable="true" type="xsd:string" />
<element name="name" nillable="true" type="xsd:string" />
</sequence>
</complexType>
- <complexType name="CreateSharedNamespaceBpelWS">
- <sequence>
<element name="actor" nillable="true" type="xsd:string" />
<element name="comment" nillable="true" type="xsd:string" />
<element name="from" nillable="true" type="xsd:string" />
<element name="namespaceData" nillable="true" type="impl:NamespaceDataImplBpelWS" />
<element name="priority" type="xsd:int" />
<element name="processAtTime" nillable="true" type="xsd:dateTime" />
<element name="replyTo" nillable="true" type="xsd:string" />
<element name="responseRequired" type="xsd:boolean" />
</sequence>
</complexType>
</schema>
- <schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
- <complexType name="mapItem">
- <sequence>
<element name="key" nillable="true" type="xsd:string" />
<element name="value" nillable="true" type="xsd:string" />
</sequence>
</complexType>
- <complexType name="Map">
- <sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
</sequence>
</complexType>
</schema>
</wsdl:types>
+ <wsdl:message name="createNamespaceRequest">
<wsdl:part name="createNs" type="impl:CreateSharedNamespaceBpelWS" />
</wsdl:message>
- <wsdl:message name="createNamespaceResponse">
<wsdl:part name="createNamespaceReturn" type="impl:TransResultWS" />
</wsdl:message>
- <wsdl:portType name="JMetroWebService">
- <wsdl:operation name="createNamespace" parameterOrder="createNs">
<wsdl:input message="impl:createNamespaceRequest" name="createNamespaceRequest" />
<wsdl:output message="impl:createNamespaceResponse" name="createNamespaceResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="NAMESPACEWITHMAPSoapBinding" type="impl:JMetroWebService">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="createNamespace">
<wsdlsoap:operation soapAction="" />
- <wsdl:input name="createNamespaceRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
</wsdl:input>
- <wsdl:output name="createNamespaceResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://bpel.jmetro.actiontech.com" use="encoded" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="JMetroWebServiceService">
- <wsdl:port binding="impl:NAMESPACEWITHMAPSoapBinding" name="NAMESPACEWITHMAP">
<wsdlsoap:address location="http://localhost:7001/axis/services/NAMESPACEWITHMAP" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
My NamespaceDataObjectImplBpelWS object contains element appDataDef which is of type java.util.Map.My bpel wsdl file is as below,
<?xml version="1.0"?>
<definitions name="NsWithMap"
targetNamespace="http://bpel.jmetro.actiontech.com"
xmlns:tns="http://bpel.jmetro.actiontech.com"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TYPE DEFINITION - List of services participating in this BPEL process
The default output of the BPEL designer uses strings as input and
output to the BPEL Process. But you can define or import any XML
Schema type and us them as part of the message types.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<types>
<schema targetNamespace="http://bpel.jmetro.actiontech.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<element name="createNamespace" type="tns:CreateSharedNamespaceBpelWS"/>
<element name="transResult" type="tns:TransResultWS"/>
<complexType name="TransResultWS">
<sequence>
<element name="description" type="string" />
<element name="id" type="long" />
<element name="responseType" type="int" />
<element name="status" type="boolean" />
</sequence>
</complexType>
<complexType name="ADLevelBpelWS">
<sequence>
<element name="adLevelStr" type="string" />
<element name="id" type="int" />
</sequence>
</complexType>
<complexType name="NamespaceDataImplBpelWS">
<sequence>
<element name="ADLevel" type="tns:ADLevelBpelWS" />
<element name="description" type="string" />
<element name="name" type="string" />
<element name="appdataDef" type="apachesoap:Map" />
</sequence>
</complexType>
<complexType name="CreateSharedNamespaceBpelWS">
<sequence>
<element name="namespaceData" type="tns:NamespaceDataImplBpelWS" />
</sequence>
</complexType>
<element name="desc" type="string"/>
</schema>
<schema targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<complexType name="mapItem">
<sequence>
<element name="key" type="string" />
<element name="value" type="string" />
</sequence>
</complexType>
<complexType name="Map">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem" />
</sequence>
</complexType>
</schema>
</types>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MESSAGE TYPE DEFINITION - Definition of the message types used as
part of the port type defintions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<message name="NsWithMapRequestMessage">
<part name="payload" element="tns:createNamespace"/>
</message>
<message name="NsWithMapResponseMessage">
<part name="payload" element="tns:transResult"/>
</message>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PORT TYPE DEFINITION - A port type groups a set of operations into
a logical service unit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- portType implemented by the NsWithMap BPEL process -->
<portType name="NsWithMap">
<operation name="initiate">
<input message="tns:NsWithMapRequestMessage"/>
</operation>
</portType>
<!-- portType implemented by the requester of NsWithMap BPEL process
for asynchronous callback purposes
-->
<portType name="NsWithMapCallback">
<operation name="onResult">
<input message="tns:NsWithMapResponseMessage"/>
</operation>
</portType>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PARTNER LINK TYPE DEFINITION
the NsWithMap partnerLinkType binds the provider and
requester portType into an asynchronous conversation.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<plnk:partnerLinkType name="NsWithMap">
<plnk:role name="NsWithMapProvider">
<plnk:portType name="tns:NsWithMap"/>
</plnk:role>
<plnk:role name="NsWithMapRequester">
<plnk:portType name="tns:NsWithMapCallback"/>
</plnk:role>
</plnk:partnerLinkType>
</definitions>
I am trying to set this map data using java code ,
HashMap procADMap1 = new HashMap(5);
PropertyTypeWS pType = new PropertyTypeWS();
pType.setTypeIndex(2);
AppdataDefImplWS appData1 = new AppdataDefImplWS();
appData1.setName("Project");
appData1.setType(pType);
appData1.setMaxSize(400);
appData1.setLOB(false);
appData1.setDefaultValue("Project Default value");
procADMap1.put(appData1.getName(), appData1);
setVariableData("request","createNs","/createNs/namespaceData/appdataDef",procADMap1);
Then I am passing request object to the method which I want to invoke from bpel process.
I am able to deploy the application but when I do post message I am getting following exception,
NamespaceWithMap (createNamespace) (faulted)
[2004/09/09 18:35:54] "{http://schemas.oracle.com/bpel/extension}bindingFault" has been thrown. Less
faultName: {{http://schemas.oracle.com/bpel/extension}bindingFault}
messageType: {{http://schemas.oracle.com/bpel/extension}RuntimeFaultMessage}
code: {Server.userException}
summary: {org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.}
detail: {null}
Is there any other way to handle Map type in bpel process?
Thanks in advance,
SanjayThanks for the quick reply.Actually the web service is already deployed on the server.What I want to do is use existing wsdl file of the deployed web service and invoke the method of the same using oracle PM.
If I remove element which uses apachesoap:Map type it just works fine also I am getting the complex object returned by the web service method.But when I try to set appDataDef which is of type apachesoap:Map(Axis conversion for java.util.Map and it uses namespace xmlns:apachesoap="http://xml.apache.org/xml-soap") I am getting the error.
Can you give me some direction to use this exising wsdl file to set map object or it is not possible.
Maybe you are looking for
-
24" iMac Video Problem on Window XP
I brought 2 units of 24" iMac last month and using boot camp to install windows xp. Both iMac are completed the installation of window xp and one of the iMac run normally but video problem found on second iMac. After running in window xp about 5 – 10
-
IPV6 DHCP stateful doesn't insert local subnet in route table
I am setting up IPV6 on a LAN using satic IPs for Win2008 servers and DHCP stateful mode for Win7 clients. All static assigned servers can ping each other and if I setup a static on the Win7 clients they can also ping the servers. However when I as
-
Delete P-P CS6 after CC installation?
New to the Premiere-Pro and video side of things ... Lightroom's last few iterations have installed themselves and 'de-installed' my previous programs, nicely saving computer space (though I know some don't like that behavior). I just up-dated to CC
-
EAX on players or operating system without games in Win 7
Can I turn on EAX in music or videoplayers or at the usual time with no games but on Win 7? In Win XP it was possible with the aid of a tool but in Win 7 no. Without EAX sounds like with worst quality as a bad sound card and would like to include the
-
I renamed the AdobeUpdaterPrefs.dat file like in CS6. No luck