J2ME standalone AQ client
hi all!
i'm working on developing a standalone client for a handheld device running under a J2ME/PersonalJava 3.1 environment connecting to oracle 10.2.0.1.0
my goal is to:
# create a topic subscriber that will handle notifications broadcast on the topic (obviously many devices will be subscribing to the topic)
# keep the client code as portable as possible by using JMS interfaces
these are the classes that i have in my classpath:
* $ORACLE_HOME/jdbc/lib/classes12.jar
* $ORACLE_HOME/jdk/jre/lib/ext/jta.jar
* $ORACLE_HOME/jlib/jndi.jar
* $ORACLE_HOME/rdbms/jlib/aqapi12.jar
* $ORACLE_HOME/rdbms/jlib/jmscommon.jar
here is a sample class to listen to the topic:
import oracle.jms.AQjmsOracleDebug;
import oracle.jms.AQjmsSession;
import oracle.jms.AQjmsTopicConnectionFactory;
import oracle.AQ.AQDriverManager;
import org.apache.log4j.Logger;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import javax.jms.Topic;
import javax.jms.TopicConnection;
import javax.jms.TopicSession;
import javax.jms.TopicSubscriber;
import java.io.Serializable;
import java.net.InetAddress;
import java.sql.Connection;
import java.sql.DriverManager;
public class TopicAttachment implements MessageListener {
private final Logger log = Logger.getLogger(getClass());
private final Connection dbConnection;
public TopicAttachment(Connection dbConnection) {
this.dbConnection = dbConnection;
public void attach() throws Exception {
TopicConnection connection = AQjmsTopicConnectionFactory.createTopicConnection(dbConnection, true);
connection.setClientID(InetAddress.getLocalHost().getHostAddress());
TopicSession session = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
Topic orderCounts = ((AQjmsSession) session).getTopic("STOREORD", "T_ORDER_COUNTS");
TopicSubscriber subscriber = session.createSubscriber(orderCounts);
subscriber.setMessageListener(this);
connection.start();
public void onMessage(Message message) {
try {
ObjectMessage om = (ObjectMessage) message;
Serializable notification = om.getObject();
log.info("Received notification: " + notification);
// TODO: Handle notification in background thread
} catch (Exception ex) {
log.error("Failure processing notification", ex);
public static void main(String[] args) throws Exception {
System.setProperty("oracle.jms.useEmulatedXA", "false");
System.setProperty("oracle.jms.useNativeXA", "false");
AQDriverManager.disableOciAQ();
AQjmsOracleDebug.setDebug(true);
AQjmsOracleDebug.setTraceLevel(AQjmsOracleDebug.AQ_ORA_TR6);
Class.forName("oracle.jdbc.driver.OracleDriver");
TopicAttachment attachment = new TopicAttachment(DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:xxxx", "storeord", "xxxx"));
attachment.attach();
}there are two points where my portability constraints are violated, but that's ok for now.
when i run the example, this is what i get:
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr ctor (user jdbc conn): connection: oracle.jdbc.driver.T4CConnection@d1fa5
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: enter
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: The connection class: oracle.jdbc.driver.T4CConnection
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.extraInit: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr ctor (user jdbc conn): exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnectionn ctor (user jdbc conn): connection: oracle.jdbc.driver.T4CConnection@d1fa5 type: 20
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnection.setCompliant: Current <compliant> is set to:true
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.getConnection: use the external connection with usage check
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsDBConnMgr.getConnection: passed usage check, creating from exteranl connection
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.constructor: dbversion=10201
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setDBRatio: enter
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setRatio: The DB csid = 178
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.setRatio: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: entry
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: oracle.jms.useEmulatedXA is off
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.inGlobalTrans: exit
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.constructor1: oci enabled = false
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsConnection:createTopicSession: Created session
main AQOracleSession.getQueue: Secure queue table: NO
main AQOracleQueue.getProperty: return cached prop
main AQOracleSession.getQueueTable: Payload type: RAW
main AQOracleSession.getQueueTable: Secure queue table: NO
main [Mon Sep 08 15:12:57 CDT 2008] AQjmsSession.chopit: TSUB_1_b2b5787a678d40f0a2e589f89e6348fc -> TSUB_1_b2b5787a678d40f0a2e589f
java.lang.NullPointerException
at oracle.jms.AQjmsSession.getAQJmsSelector(AQjmsSession.java:2550)
at oracle.jms.AQjmsSession.createDurableSubscriber(AQjmsSession.java:2520)
at oracle.jms.AQjmsSession.forceCreateOldSubscriber(AQjmsSession.java:2924)
at oracle.jms.AQjmsSession.createSubscriber(AQjmsSession.java:2240)
at com.containerstore.device.notification.TopicAttachment.attach(TopicAttachment.java:35)
at com.containerstore.device.notification.TopicAttachment.main(TopicAttachment.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Exception in thread "main" i've tried many different incarnations of this basic setup with the same results. it always fails with a NPE when creating the subscriber. i've even used the more AQ specific classes/methods like TopicReceiver with the same results.
is what i'm trying to accomplish even possible?
thanks!
Don't let the fact that I've been doing AQ for years and no one else has responded throw you. <g>
When I see things like this:
public static void main(String[] args) throws Exception {
System.setProperty("oracle.jms.useEmulatedXA", "false");
System.setProperty("oracle.jms.useNativeXA", "false");it is hard to not read it as Java.
Similar Messages
-
Problem creating J2ME web service client
Hi,
I am using netbeans (5 and 5.5 beta 2). I have created a web service which works fine. I also created a regular web service client as a standalone application which also works fine and connects to my web service with no problem.
BUT, when I want to create a J2ME web service client (under a J2ME application) I have to locate my WSDL file. but the wizard shows me the error "WSDL file does not contain port information".
By looking at the WSDL file I can see that port is created - or maybe I'm wrong.
piece from WSDL file:
<service name="myServiceName">
<port name="myServiceSPort" binding="tns:TranslatorWSPortBinding">
<soap:address location="myURLLocation"/>
</port>
</service>
Please note that I have replaced the actual values in above piece
I tried to use wsgen manually but it didn't help.
Can anyone help me in generating the correct WSDL format as J2ME web service client expects?
Thanks a lot,
S.well stubs are generated separately using WTK 2.5 stub generator but the problem is with the WSDL at this point.
S. -
How to use standalone java client with an enterprise bean in J2EE 1.4
Hi All,
I am have deployed a stateless session bean in Sun's J2EE 1.4 Application Server. i am trying to call the bean using a standalone java client. but the client cannot access the bean.
The error coming is:
Jan 21, 2004 7:48:27 PM com.sun.corba.ee.impl.legacy.connection.SocketFactoryCo
nectionImpl <init>
WARNING: ORBUTIL.connectFailure
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
javax.naming.CommunicationException: Can't find SerialContextProvider
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:66)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:12
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at StatelessSessionClient.main(StatelessSessionClient.java:17)
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed
No
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1739)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(
RBUtilSystemException.java:1757)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:74)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryContactInfoImpl
createConnection(SocketFactoryContactInfoImpl.java:88)
at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.begi
Request(CorbaClientRequestDispatcherImpl.java:146)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(Corba
lientDelegateImpl.java:121)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaCli
ntDelegateImpl.java:212)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:112)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.jav
:69)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.ja
a:58)
... 3 more
Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection re
used: connect
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:390)
at com.sun.corba.ee.impl.legacy.connection.SocketFactoryConnectionImpl.
init>(SocketFactoryConnectionImpl.java:58)
... 10 more
Caused by: java.net.ConnectException: Connection refused: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:457)
at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSoc
etFactory.java:381)
... 11 more
My java client uses the following code to access the bean:
Hashtable props = new Hashtable();
String URL="iiop://localhost:3700";
props.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");
props.put("java.naming.provider.url", URL) ;
InitialContext ctx = new InitialContext();
Object ref = ctx.lookup("ejb/StatelessSessionHome");
StatelessSessionHome home = (StatelessSessionHome)PortableRemoteObject.narrow(ref,StatelessSessionHome.class);
StatelessSessionRemote statelessSession = home.create();
plz help me to locate the error.
Regards,
MohitHi Amol,
thanks for your suggestion.
i have deployed the converter application in J2EE1.4 tutorial in Sun AppServer J2EE1.4. the deployment process works smoothly. but accessing the deployed converter bean using standalone client as given in the tutorial gives the following error.
Caught an unexpected exception!
javax.naming.NoInitialContextException: Need to specify class name in environmen
t or system property, or as an applet parameter, or in an application resource f
ile: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
40)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
a:280)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at ConverterClient.main(ConverterClient.java:14)
I have set the InitialHost and InitialPort as suggested by you in the client code. the client gets successfully compiled but gives error when executed.
The client code is:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String[] args) {
System.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
System.setProperty("org.omg.CORBA.ORBInitialPort","3700");
try {
Context initial = new InitialContext();
Object objref = initial.lookup
("java:comp/env/ejb/SimpleConverter");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount =
currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
Please suggest so that i can run the standalone client successfully.
Regards,
Mohit Kapoor -
How to insert message in OC4J JMS from standalone java client.
Hi,
I have been following available examples for creating standalone java clients to insert messages in JMS queues.
I am able to insert using java client when the SOA suite and the standalone java code are on same machine.
package producerconsumerinjava;
import javax.jms.*;
import javax.naming.*;
import java.util.Hashtable;
public class QueueProducer
public static void main(String[] args)
String queueName = "jms/demoQueue";
String queueConnectionFactoryName = "jms/QueueConnectionFactory";
Context jndiContext = null;
QueueConnectionFactory queueConnectionFactory = null;
QueueConnection queueConnection = null;
QueueSession queueSession = null;
Queue queue = null;
QueueSender queueSender = null;
TextMessage message = null;
int noMessages = 5;
* Set the environment for a connection to the OC4J instance
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "oracle.j2ee.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "mypass");
env.put(Context.PROVIDER_URL,"ormi://myserver.company.com:12402"); //12402 is the rmi port
* Set the Context Object.
* Lookup the Queue Connection Factory.
* Lookup the JMS Destination.
try
jndiContext = new InitialContext(env);
queueConnectionFactory =
(QueueConnectionFactory) jndiContext.lookup(queueConnectionFactoryName);
queue = (Queue) jndiContext.lookup(queueName);
catch (NamingException e)
System.out.println("JNDI lookup failed: " + e.toString());
System.exit(1);
* Create connection.
* Create session from connection.
* Create sender.
* Create text message.
* Send messages.
* Send non text message to end text messages.
* Close connection.
try
queueConnection = queueConnectionFactory.createQueueConnection();
queueSession =
queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queue);
message = queueSession.createTextMessage();
for (int i = 0; i < noMessages; i++)
message.setText("Message " + (i + 1));
System.out.println("Producing message: " + message.getText());
queueSender.send(message);
queueSender.send(queueSession.createBytesMessage());
catch (JMSException e)
System.out.println("Exception occurred: " + e.toString());
finally
if (queueConnection != null)
try
queueConnection.close();
catch (JMSException e)
System.out.println("Closing error: " + e.toString());
But when the SOA Suite is remote, I am struggling to get the settings correct
Till now, here is what I have figured out from looking at blogs/tars etc on the Net:
1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactory (http://download.oracle.com/docs/cd/E14101_01/doc.1013/e13975/jndi.htm)
2. The project should have a META-INF/application-client.xml file, which may be dummy (http://www.wever.org/java/space/Oracle/JmsTar1). Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.
Errors:
When trying to run exact same code on local server that tries to enqueue JMS on remotee serverer
Exception occurred: javax.jms.JMSException: Unable to create a connection to "xxxxxxx.yyyyyy01.dev.com/10.42.456.11:12,602" as user "null".
Any help is greatly welcome.
As an exercise, I copied this complete code on the server and then ran locally using a telnet client...it worked. So the problem is coming when accessing the server remotely.
Rgds,
Amit1. I need to use ApplicationClientInitialContextFactory instead of RMIInitialContextFactoryNot necessarily.
2. The project should have a META-INF/application-client.xml fileThat's only necessary if going the ApplicationClientInitialContextFactory route.
There are two types of JMS client applications you can write -- a pure/plain Java app, and an "AppClient". That first is your everyday run-of-the-mill Java application, nothing special. That latter is a special, complicated beast that tries to act as a part of the whole client/server/J2EE architecture which provides you with a semi-managed environment. Either can be made to work, but if all you need is JMS access (using plain OC4J JMS factory/queue names and not JMS Connector names), then the first is easier to get working (and performs a tiny bit better as well due to being a lighter-weight solution).
I think the problem you are having might be: When you use the plain Java client solution, you do not have any type of management, and that includes user management. With no user management (and if the JMS server is not configured to allow anonymous connections) you need to include the username and password in the call to createConnection. (I think it may be that this is actually true in the AppClient case as well -- I avoid using the AppClient model as much as possible so my memory there is weaker.)
If you prefer to go the AppClient route, I would point you to a demo I wrote which had a functioning example, but Oracle seems to have removed it (and all of the 10.1.3 demos?) from OTN. :-(
Hmm, it seems to still be available on the wayback machine:
http://web.archive.org/web/20061021064014/www.oracle.com/technology/tech/java/oc4j/1013/how_to/index.html
(Just look down the page for "With OEMS JMS (In-Memory and File-Based)" -- there is an .html document with info, and there is a .zip file with source code.)
Question is, my code is there in a single absolutely standalone code..how I can use this application-client.xml and where it has to be placed.The app client in my demo had the following directory structure:
myjavaclient.class
jndi.properties
META-INF\MANIFEST.MF
META-INF\application-client.xml
META-INF\orion-application-client.xml
When you use ApplicationClientInitialContextFactory I think it just looks under .\META-INF for the .xml files.
-Jeff -
Error in oim Role creation using Role Manager Service API from Standalone Java client
Hi,
Facing the following error when trying to create Role using Role Manager Service API from a standalone java client .
Tried with the solution of changing ,
Login into the Web Logic Admin Console --> Servers --> OIM Server --> Protocols --> Modify the Maximum Message from 100000000 to 1000000000, but still the problem persists.
Exception in thread "main" org.omg.CORBA.BAD_PARAM: vmcid: 0x0 minor code: 0 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2.getSystemException(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl.getSystemExceptionReply(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.processResponse(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.invoke(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._invoke(Unknown Source)
at com.sun.org.omg.SendingContext._CodeBaseStub.meta(Unknown Source)
at com.sun.corba.se.impl.encoding.CachedCodeBase.meta(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.getOrderedDescriptions(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.inputObjectUsingFVD(Unknown Source)
at com.sun.corba.se.impl.io.IIOPInputStream.simpleReadObject(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValueInternal(Unknown Source)
at com.sun.corba.se.impl.io.ValueHandlerImpl.readValue(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream_1_0.read_value(Unknown Source)
at com.sun.corba.se.impl.encoding.CDRInputStream.read_value(Unknown Source)
at oracle.iam.identity.rolemgmt.api._RoleManager_ogut7n_RoleManagerRemoteRIntf_Stub.createx(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
at $Proxy2.createx(Unknown Source)
at oracle.iam.identity.rolemgmt.api.RoleManagerDelegate.create(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
at weblogic.security.subject.SubjectProxy.doAs(SubjectProxy.java:64)
at weblogic.security.subject.SubjectManager.runAs(SubjectManager.java:262)
at weblogic.security.Security.runAs(Security.java:48)
at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
at $Proxy3.create(Unknown Source)
at com.idm.role.CreateRole.createRole(CreateRole.java:113)
at com.idm.role.CreateRole.main(CreateRole.java:167)
Thanks In AdvanceHi , I have used OIM 11g R2.
Please find below the code we have used,
package com.idm.role;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import java.util.logging.Logger;
import javax.security.auth.login.LoginException;
import oracle.iam.identity.exception.NoSuchRoleException;
import oracle.iam.identity.exception.RoleAlreadyExistsException;
import oracle.iam.identity.exception.RoleCreateException;
import oracle.iam.identity.exception.RoleLookupException;
import oracle.iam.identity.exception.RoleModifyException;
import oracle.iam.identity.exception.SearchKeyNotUniqueException;
import oracle.iam.identity.exception.ValidationFailedException;
import oracle.iam.identity.rolemgmt.api.RoleManager;
import oracle.iam.identity.rolemgmt.api.RoleManagerConstants;
import oracle.iam.identity.rolemgmt.vo.Role;
import oracle.iam.platform.OIMClient;
import oracle.iam.platform.authz.exception.AccessDeniedException;
public class CreateRole {
private final static Logger LOGGER = Logger.getLogger(CreateRole.class .getName());
OIMClient oimClient = null;
public OIMClient connectToOIM() {
LOGGER.info("In connectToOIM ");
Hashtable env = new Hashtable();
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL,
"weblogic.jndi.WLInitialContextFactory");
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL,
"t3://V-hydidm1.itig.co.in:14000");
System.setProperty("java.security.auth.login.config",
"F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\authwl.conf");
System.setProperty("java.security.policy",
"F:\\Projects\\IDM\\Team\\Env_setup\\OIM_Setup\\designconsole\\config\\xl.policy");
System.setProperty("OIM.AppServerType", "wls");
System.setProperty("APPSERVER_TYPE", "wls");
System.setProperty("weblogic.Name", "oim_server1");
oimClient = new OIMClient(env);
try {
oimClient.login("xelsysadm", "Passw0rd".toCharArray());
} catch (LoginException e) {
e.printStackTrace();
System.out.println("Connected");
return oimClient;
public void readRoleMetadata() {
LOGGER.info("in readRoleMetadata ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
try {
Role roleVo = roleManagerService.getDetails(
RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);
Set attributeNameSet = roleVo.getAttributeNames();
Iterator it = attributeNameSet.iterator();
while (it.hasNext()) {
System.out.println("Attribute Name :: " + it.next());
// roleVo.setAttribute("ADentitlements", "Security Admin access");
String adEntitlements = "" + roleVo.getAttribute("ADentitlements");
System.out.println("AD Entitlements :: " + adEntitlements);
System.out.println("DB Entitlements :: " + ""
+ roleVo.getAttribute("DBEntitlements"));
System.out.println("Unix Entitlements :: " + ""
+ roleVo.getAttribute("UnixWindows"));
System.out.println("VPN :: " + "" + roleVo.getAttribute("VPN"));
} catch (SearchKeyNotUniqueException e) {
e.printStackTrace();
} catch (NoSuchRoleException e) {
e.printStackTrace();
} catch (RoleLookupException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
public void createRole() {
LOGGER.info(" in Create role ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
roleCreationAttrMap.put(RoleManagerConstants.ROLE_NAME, "API Role1");
roleCreationAttrMap.put(RoleManagerConstants.ROLE_DESCRIPTION,
"This Role is created using API Role1");
roleCreationAttrMap.put(RoleManagerConstants.ROLE_DISPLAY_NAME,
"API Role1");
roleCreationAttrMap.put("ADentitlements", "API Role1 AD Entitlements");
roleCreationAttrMap.put("DBEntitlements", "API Role1 DB Entitlements");
roleCreationAttrMap.put("VPN", "No");
roleCreationAttrMap.put("UnixWindows", "API Role1 Unix Entitlements");
Role roleVo = new Role(roleCreationAttrMap);
try {
System.out.println(" Before Create role *********************************************");
roleManagerService.create(roleVo);
System.out.println("Role Created .. ");
} catch (ValidationFailedException e) {
e.printStackTrace();
} catch (RoleAlreadyExistsException e) {
e.printStackTrace();
} catch (RoleCreateException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
public void modifyRole() {
LOGGER.info(" in modifyRole ");
RoleManager roleManagerService = oimClient
.getService(RoleManager.class);
Role roleVo;
try {
roleVo = roleManagerService.getDetails(
RoleManagerConstants.ROLE_DISPLAY_NAME, "API Role1", null);
String roleKey = roleVo.getEntityId();
HashMap<String, Object> roleCreationAttrMap = new HashMap<String, Object>();
roleCreationAttrMap.put("ADentitlements",
"Updated API Role1 AD Entitlements");
Set roleKeySet = new HashSet<String>();
roleKeySet.add(roleKey);
Role roleVoNew = new Role(roleCreationAttrMap);
roleManagerService.modify(roleKeySet, roleVoNew);
System.out.println("Role Modified ..");
} catch (SearchKeyNotUniqueException e) {
e.printStackTrace();
} catch (NoSuchRoleException e) {
e.printStackTrace();
} catch (RoleLookupException e) {
e.printStackTrace();
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (ValidationFailedException e) {
e.printStackTrace();
} catch (RoleModifyException e) {
e.printStackTrace();
public static void main(String args[]) {
CreateRole miscObj = new CreateRole();
miscObj.connectToOIM();
miscObj.createRole();
//miscObj.readRoleMetadata();
Thanks In Advance . -
I have implemented a transformation server as a JMS client. This is not
written as a EJB bean, partly because I'm not very familiar with EJB beans.
I'm being told MDB is the way to go (I'm a bit reluctant in front of the
additional work) for the usual reasons : transaction-control (not really an
issue right now for me but may become one), ease of deployment and
centralized monitoring. Fair enough.
My standalone JMS client creates a lot of variables at initialization (such
as a precompiled XSLT stylesheet to substantially improve the speed of each
transformation).
Where should this be created if I were to convert my standalone JMS client
into an MDB ? In ejbCreate() ?
I'm also a bit worried about a few aspects :
1) Performance, the size of requests may vary tremendously and I currently
use a synchronous receive on my input queue, is this more efficient (I pull
messages when I'm ready) than using beans and onMessage() ? In other words,
will the container try to push message notifications to MDB bean instances
that are not ready ?
2) My standalone JMS consumer is also a producer to several destinations
(including temporary queues, permanent queues and topics), is there any
limitation to the use of JMS destinations in an MDB (what about selectors ?)
vs a standalone java JMS application?
3) My standalone JMS consumer creates a few threads per request. Any gotchas
in a MDB vs a standalone Java JMS application ? Are MDB passivated at any
time ?
Many thanks for any answer,
Rosalie
RosalieRosalie Mignon wrote:
I have implemented a transformation server as a JMS client. This is not
written as a EJB bean, partly because I'm not very familiar with EJB beans.
I'm being told MDB is the way to go (I'm a bit reluctant in front of the
additional work) for the usual reasons : transaction-control (not really an
issue right now for me but may become one), ease of deployment and
centralized monitoring. Fair enough.There's a number of MDB advantages over writing your own JMS consumers.
I would recommend MDBs for JMS consumers running within WLS. If you
have a JMS consumer that is a separate (say client) process, then
vanilla JMS is still the way to go.
The MDB container takes care of things like reconnecting you to JMS if
it fails. It supports foreign JMS providers so your MDBs will work with
"foreign" messaging systems like MQ-Series.
>
My standalone JMS client creates a lot of variables at initialization (such
as a precompiled XSLT stylesheet to substantially improve the speed of each
transformation).
Where should this be created if I were to convert my standalone JMS client
into an MDB ? In ejbCreate() ?Yes, ejbCreate would be fine.
>
I'm also a bit worried about a few aspects :
1) Performance, the size of requests may vary tremendously and I currently
use a synchronous receive on my input queue, is this more efficient (I pull
messages when I'm ready) than using beans and onMessage() ? In other words,
will the container try to push message notifications to MDB bean instances
that are not ready ?I'm not sure I understand. You will have a pool of MDB instances all
receiving from the queue. When an instance is available and there is a
message pending, the EJB/JMS containers will call your MDB's onMessage
implementation.
>
2) My standalone JMS consumer is also a producer to several destinations
(including temporary queues, permanent queues and topics), is there any
limitation to the use of JMS destinations in an MDB (what about selectors ?)
vs a standalone java JMS application?Not that I can think of.
>
3) My standalone JMS consumer creates a few threads per request. Any gotchas
in a MDB vs a standalone Java JMS application ? You are not really allowed to create threads from an EJB. Why do you
need to create threads? In general, we wouldn't recommend that
server-side applications create new threads on each request.
Are MDB passivated at any
time ?
No
Many thanks for any answer,Your domain name is an unusual one for the J2EE world. If you can tell
us, I'd be interested to know what you're doing.
-- Rob
>
Rosalie
Rosalie -
Problem in accessing the Web Service using standalone Java Client
Dear Friends,
Hi,
I have an active web service and I have tested the same with XML Spy and Apache Axis and is giving me the output perfectly. For the same, I have developed a standalone Java client but getting problem in fetching the output.
The Exception is :
<Jan 4, 2006 5:54:16 PM GMT+05:30> <Info> <WebService> <BEA-220025> <Handler weblogic.webservice.core.handler.ClientHandler threw
an exception from its handleResponse method.
The exception was:
javax.xml.rpc.JAXRPCException: java.io.IOException: Received a response from url: http://10.20.15.59:18004/amountToWords which did
not have a valid SOAP content-type: text/html;charset=ISO-8859-1. .>
SOAP Fault **************** Exception during processing: java.io.IOException: Received a response from url: http://10.20.15.59:18
004/amountToWords which did not have a valid SOAP content-type: text/html;charset=ISO-8859-1.
(see Fault Detail for stacktrace)
javax.xml.rpc.soap.SOAPFaultException: Exception during processing: java.io.IOException: Received a response from url: http://10.2
0.15.59:18004/amountToWords which did not have a valid SOAP content-type: text/html;charset=ISO-8859-1.
(see Fault Detail for sta
cktrace)
at weblogic.webservice.core.ClientDispatcher.receive(ClientDispatcher.java:313)
at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDispatcher.java:144)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:457)
at weblogic.webservice.core.DefaultOperation.invoke(DefaultOperation.java:443)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:566)
at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:419)
at HelloClient.main(HelloClient.java:100)
I have tried some ways to set the content type explicitly but the results are same(throwing an exception).
I appreciate you all for helping me out of this.
Thanks
VRHi Amit
We also have this issue with weblogic webservices. Did you get any resolution for this issue.
When the service is executed for lesser number of hits, all the responses are processed properly. But as load (Number of hits for the same service) increases, few responses are failed to be parsed in the web service client. We could confirm that the producer responds with proper content type (text/xml)
Any help or pointers will be greatly appreciated.
Thanks,
Finny -
Trying SAML sender-vouches, standalone Java client call to service bus.
I've built a standalone Java client using Jax-ws. It produces a wsse header containing both a SAMLAttribute and an optional SAMLAuthentication statement.
I've tried to configure a proxy service on the servicebus (10gR3) using ws-policy (weblogic version, not ws-1.2), configured a SAMLIdentityAsserter (v2), an identity provider partner and a SAMLIdentityNameMapper.
I get the message weblogic.xml.crypto.wss.SecurityTokenValidateResult@ca32f2[status: false][msg The SAML token is not valid.]
when sending SAML assertions which looks valid to me.
If you see something missing or invalid in the SAML, something missing in the configuration or something else, I would be really glad.
All examples are using a SAMLCredentialmapper, but I'm building a standalone client, so a weblogic SAMLCredentialMapper is out of the question (?).
request header:
<S:Header>
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" S:mustUnderstand="1">
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:exc14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:xs="http://www.w3.org/2001/XMLSchema" AssertionID="1246342701761" IssueInstant="2009-06-30T06:18:21.683Z" Issuer="http://openuri.org/service/customer/contact/contactInformationService" MajorVersion="1" MinorVersion="1">
<saml:Conditions NotBefore="2009-06-30T06:17:21.683Z" NotOnOrAfter="2009-06-30T07:18:21.683Z"/>
<saml:AuthenticationStatement AuthenticationInstant="2009-06-30T06:18:21.683Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:unspecified">
<saml:Subject>
<saml:NameIdentifier Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName" NameQualifier="sb1sk">uid=vsb,ou=smn</saml:NameIdentifier>
<saml:SubjectConfirmation>
<saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</saml:ConfirmationMethod>
</saml:SubjectConfirmation>
</saml:Subject>
</saml:AuthenticationStatement>
</saml:Assertion>
</wsse:Security>
response:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<faultcode>wsse:InvalidSecurityToken</faultcode>
<faultstring>Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenValidateResult@1061c5e[status: false][msg The SAML token is not valid.]</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
If the client leaves out the wsse:security element in the header, the service complains
<faultstring>No Security header in message but required by policy.</faultstring>
The SAMLIdentity name mapper is never loaded at all (checked by logging at class loading)
The configuration in the Identity provider partner:
audience uri: target:*:/
issuer uri: /service/customer/contact/contactInformationService (also tried with a unique string equal to what the client sends)
virtual user: enabled
confirmation method: sender-vouches
I am not using any certificates (tryed both with and without)
Policy in use for the proxy service:
<?xml version="1.0"?>
<wsp:Policy
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wssp="http://www.bea.com/wls90/security/policy"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wls="http://www.bea.com/wls90/security/policy/wsee#part"
wsu:Id="samlSV"
>
<wssp:Identity>
<wssp:SupportedTokens>
<wssp:SecurityToken TokenType="http://docs.oasis-open.org/wss/2004/01/oasis-2004-01-saml-token-profile-1.0#SAMLAssertionID">
<wssp:Claims>
<wssp:ConfirmationMethod>sender-vouches</wssp:ConfirmationMethod>
</wssp:Claims>
</wssp:SecurityToken>
</wssp:SupportedTokens>
</wssp:Identity>
</wsp:Policy>
Stacktrace:
weblogic.xml.crypto.wss.WSSecurityException: Security token failed to validate. weblogic.xml.crypto.wss.SecurityTokenVal
idateResult@a4fc20[status: false][msg The SAML token is not valid.]
at weblogic.xml.crypto.wss.SecurityImpl.unmarshalAndProcessSecurityToken(SecurityImpl.java:630)
at weblogic.xml.crypto.wss.SecurityImpl.unmarshalChildren(SecurityImpl.java:556)
at weblogic.xml.crypto.wss.SecurityImpl.unmarshalInternal(SecurityImpl.java:448)
at weblogic.xml.crypto.wss.SecurityImpl.unmarshal(SecurityImpl.java:416)
at weblogic.xml.crypto.wss.api.WSSecurityFactory.unmarshalAndProcessSecurity(WSSecurityFactory.java:66)
at weblogic.wsee.security.WssServerHandler.processRequest(WssServerHandler.java:35)
at weblogic.wsee.security.WssHandler.handleRequest(WssHandler.java:74)
at com.bea.wli.sb.security.wss.WssInboundHandler.processRequest(WssInboundHandler.java:116)
at com.bea.wli.sb.security.wss.WssHandlerImpl.doInboundRequest(WssHandlerImpl.java:201)
at com.bea.wli.sb.context.BindingLayerImpl.addRequest(BindingLayerImpl.java:257)
at com.bea.wli.sb.pipeline.MessageProcessor.processRequest(MessageProcessor.java:66)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:508)
at com.bea.wli.sb.pipeline.RouterManager$1.run(RouterManager.java:506)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(Unknown Source)
Edited by: user6080617 on Jun 29, 2009 11:39 PMThank you for the tip. I've tried it, the result is below. It suspect something missing in my configuration, but I do not know what.
<WSEE:17>Class of cred is: class weblogic.xml.saaj.SOAPElementImpl<SAMLCredentialImpl.<init>:85>
<WSEE:17>Instantiating SAMLAssertionInfoFactory<SAMLCredentialImpl.<init>:87>
<WSEE:17>Getting SAMLAssertionInfo from DOM Element<SAMLCredentialImpl.<init>:97>
<WSEE:17>Got SAMLAssertionInfo<SAMLCredentialImpl.<init>:117>
<WSEE:17>Assertion ID: 1246358297862<SAMLCredentialImpl.verbose:69>
<WSEE:17>Assertion CM: urn:oasis:names:tc:SAML:1.0:cm:sender-vouches<SAMLCredentialImpl.verbose:70>
<WSEE:17>Assertion Subject: uid=vsb,ou=smn<SAMLCredentialImpl.verbose:71>
<WSEE:17>Assertion Version: 1.1<SAMLCredentialImpl.verbose:72>
<WSEE:17>Attempting assertIdentity<CSSUtils.assertIdentity:310>
<WSEE:17>SAML_TARGET_RESOURCE is: /service/customer/contact/contactInformationService<CSSUtils.assertIdentity:312>
<WSEE:17>Got Principal Authenticator<CSSUtils.assertIdentity:314>
<WSEE:17>Cred type is: SAML.Assertion.DOM, Node: [saml:Assertion: null]<CSSUtils.assertIdentity:320>
<WSEE:17>Exception while asserting identity: javax.security.auth.login.LoginException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090380]Identity Assertion Failed, Unsupported Token Type: SAML.Assertion.DOM<CSSUtils.assertIdentity:325>
<WSEE:17>javax.security.auth.login.LoginException: [Security:090377]Identity Assertion Failed, weblogic.security.spi.IdentityAssertionException: [Security:090380]Identity Assertion Failed, Unsupported Token Type: SAML.Assertion.DOM<CSSUtils.assertIdentity:326> -
Problem consuming web service created by ABAP via standalone java client
I'm trying to consume web service created by ABAP in R3 system via standalone java client. I should be getting a string reply after consumed the web service (ZSMS_INBOUND), but so far i received null. I cant find any exception or log to trace the problem. Any help would be appreciated. Is there anything wrong with my client calling the web service?
public void myMethod{
// TODO : Implement
try{
Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap- client=100&wsdl=1.1&mode=sap_wsdl");
inboundService = (ZSMS_INBOUND) stub;
BAPIRET2 str = inboundService.ZSMS_INBOUND(date, message, modemId, smsId, tel, time);
ackDeliveryArray<i> = str.toString();
}catch (Exception e) {
e.printStackTrace();
Generated following SAP help standalone proxy creation steps.
***files fr SEIs
ZSMS_INBOUND.java (interface)
ZSMS_INBOUNDService.java (interface)
ZSMS_INBOUNDServiceImpl.java
ZSMS_INBOUNDSoapBindingStub.java
***files fr Proxy classes
ZSMS_INBOUND.java
ZSMS_INBOUNDResponse.java
BAPIRET2.java
.... many more files
the wsdl is as below (generated by ABAP):
<?xml version="1.0" encoding="utf-8" ?>
- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:rfc:functions" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:n0="http://www.sap.com/webas/630/soap/features/authentication/" xmlns:sap="http://www.sap.com/webas/630/wsdl/features" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:sap-com:document:sap:rfc:functions" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:sap-com:document:sap:rfc:functions" targetNamespace="urn:sap-com:document:sap:rfc:functions" elementFormDefault="unqualified" attributeFormDefault="qualified">
- <xsd:simpleType name="char1">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="1" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char10">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char17">
+ <xsd:restriction base="xsd:string">
<xsd:maxLength value="17" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char170">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="170" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char20">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="20" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char220">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="220" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char30">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="30" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char32">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="32" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="char50">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="50" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="date">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="10" />
<xsd:pattern value="\d\d\d\d-\d\d-\d\d" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="numeric3">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="3" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="numeric6">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="6" />
<xsd:pattern value="\d*" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:simpleType name="time">
- <xsd:restriction base="xsd:string">
<xsd:maxLength value="8" />
<xsd:pattern value="\d\d:\d\d:\d\d" />
</xsd:restriction>
</xsd:simpleType>
- <xsd:complexType name="BAPIRET2">
- <xsd:sequence>
<xsd:element name="TYPE" type="tns:char1" />
<xsd:element name="ID" type="tns:char20" />
<xsd:element name="NUMBER" type="tns:numeric3" />
<xsd:element name="MESSAGE" type="tns:char220" />
<xsd:element name="LOG_NO" type="tns:char20" />
<xsd:element name="LOG_MSG_NO" type="tns:numeric6" />
<xsd:element name="MESSAGE_V1" type="tns:char50" />
<xsd:element name="MESSAGE_V2" type="tns:char50" />
<xsd:element name="MESSAGE_V3" type="tns:char50" />
<xsd:element name="MESSAGE_V4" type="tns:char50" />
<xsd:element name="PARAMETER" type="tns:char32" />
<xsd:element name="ROW" type="xsd:int" />
<xsd:element name="FIELD" type="tns:char30" />
<xsd:element name="SYSTEM" type="tns:char10" />
</xsd:sequence>
</xsd:complexType>
- <xsd:element name="ZSMS_INBOUND">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="DATE" type="tns:date" />
<xsd:element name="MESSAGE" type="tns:char170" />
<xsd:element name="MODEMID" type="tns:char10" />
<xsd:element name="SMSID" type="tns:char17" />
<xsd:element name="TEL" type="tns:char20" />
<xsd:element name="TIME" type="tns:time" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
- <xsd:element name="ZSMS_INBOUNDResponse">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element name="RETURN" type="tns:BAPIRET2" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</wsdl:types>
- <wsdl:message name="ZSMS_INBOUND">
<wsdl:part name="parameters" element="tns:ZSMS_INBOUND" />
</wsdl:message>
- <wsdl:message name="ZSMS_INBOUNDResponse">
<wsdl:part name="parameters" element="tns:ZSMS_INBOUNDResponse" />
</wsdl:message>
- <sap:Feature name="design_0" uri="http://www.sap.com/webas/630/soap/features/authentication/">
- <sap:Property qname="n0:AuthenticationLevel">
<sap:Option value="n0:None" />
</sap:Property>
</sap:Feature>
- <wsdl:portType name="ZSMS_INBOUND">
<sap:useFeature feature="tns:design_0" />
- <wsdl:operation name="ZSMS_INBOUND">
<wsdl:input message="tns:ZSMS_INBOUND" />
<wsdl:output message="tns:ZSMS_INBOUNDResponse" />
</wsdl:operation>
</wsdl:portType>
- <wsdl:binding name="ZSMS_INBOUNDSoapBinding" type="tns:ZSMS_INBOUND">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ZSMS_INBOUND">
<soap:operation soapAction="" />
- <wsdl:input>
<soap:body use="literal" />
</wsdl:input>
- <wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
- <wsdl:service name="ZSMS_INBOUNDService">
- <wsdl:port name="ZSMS_INBOUNDSoapBinding" binding="tns:ZSMS_INBOUNDSoapBinding">
<soap:address location="http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>I'm now able to consume the web service, but with the error as below:
Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
Error Message is :com/sap/guid/GUIDGeneratorFactory
BAPIRET2 mappingInfo:
TYPE TYPE false false 11
ID ID false false 11
NUMBER NUMBER false false 11
MESSAGE MESSAGE false false 11
LOG_NO LOG_NO false false 11
LOG_MSG_NO LOG_MSG_NO false false 11
MESSAGE_V1 MESSAGE_V1 false false 11
MESSAGE_V2 MESSAGE_V2 false false 11
MESSAGE_V3 MESSAGE_V3 false false 11
MESSAGE_V4 MESSAGE_V4 false false 11
PARAMETER PARAMETER false false 11
ROW ROW false false 11
FIELD FIELD false false 11
SYSTEM SYSTEM false false 11
My java code is :
public class MyTest {
public static void main(String[] args){
try{
Stub stub = (Stub)new ZSMS_INBOUNDServiceImpl().getLogicalPort();
stub._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,"http://mytest:8080/sap/bc/srt/rfc/sap/ZSMS_INBOUND?sap-client=100");
ZSMS_INBOUND inboundService = (ZSMS_INBOUND) stub;
BAPIRET2 str = inboundService.ZSMS_INBOUND(param1,param2,param3,param4,param5,param6);
System.out.println(str.toString());
}catch (Exception e) {
e.printStackTrace(); -
SPNEGO in WLS with standalone java client
Hello All,
Do WLS support SSO with SPNEGO using standalone java client?
/Edok I found the answer.
You can use either MS IE or WebServies...but not standalone java client.
/Ed -
NetBeans 5.5 j2me web service client...how to?
Hi,
I am new to web services and j2me, so this question might be very simple.
I have created a project (simple web service) and tested it and all work ok...
I try to create a midlet to consume this web service so I do the following:
(1) Create a mobile->Mobile Application project
(2) Add a new file-> j2me web service client
(3) On running web service I insert the url of the wsdl of the previous web service
(4) Press retrieve WSDL (everything seem to work ok up to this point)
(5) I keep the check box Create Simple midlet checked
A packet with two files is created: blablah.wsclient, blablablah.wsdl
No midlet is created and when I try to create my own nothing I dont know how to access the web services methods...
Is it a bug of netbeans 5.5?
Can someone provide a link for a simple tutorial or at least make clear how to access the method of the web service?
Thanx in advance!I'm facing the same problem with NetBeans 5.5.1 while I had no trouble with NetBeans 5.5 (I wonder why I updated :-( )
I hope someone can help us.
Best regards
edit:
It should be due JDK 1.6; I will try and I'll let you have my results.
Rread this:
http://www.netbeans.org/issues/show_bug.cgi?id=90112
Edited by: NikJ2ME on Oct 13, 2007 5:05 AM -
Standalone proxy client, uknown source!
Hello experts,
I am working on a simple standalone java client to test a web service. When I run, I get following stack trace:
at $Proxy18.salesOrderCreateOut(Unknown Source)
at test.StandaloneClient.main(StandaloneClient.java:58)
Caused by: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)Here is the code:
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
SalesOrderCreateOutService service = new SalesOrderCreateOutService();
SalesOrderCreateOut servicePort = service.getSalesOrderCreate_Out_Port();
javax.xml.ws.BindingProvider bp = (javax.xml.ws.BindingProvider) servicePort;
Map<String, Object> context = bp.getRequestContext();
// context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "<URL>.wsdl");
context.put(BindingProvider.USERNAME_PROPERTY, "USER");
context.put(BindingProvider.PASSWORD_PROPERTY, "PWD");
SalesOrderResponse response = null;
Project salesOrderCreateRequest = new Project();
Header header = new Header();
header.setTitle("EAST COAST SHEET METAL MOTOR WARRANTY");
salesOrderCreateRequest.setHeader(header);
try {
response = servicePort.salesOrderCreateOut(salesOrderCreateRequest);
} catch (SalesOrderError_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
TRETURN treturn = response.getTRETURN();
Iterator ls = treturn.getItem().iterator();
while(ls.hasNext()){
TRETURN.Item tempItem = (TRETURN.Item)ls.next();
System.out.println(tempItem.getMESSAGE());
break;
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Exception is at the bold line.
Any clues, how to fix this...Hi,
Deployable versus Standalone Proxies
SAP Web AS Java provides two types of Web service proxies:
deployable proxy u2013 a Web service client that must be deployed on the J2EE Engine as an application.
standalone proxy u2013 a Web service client that generates stubs and runs without the J2EE Engine. This proxy can be used only with the release for which it has been generated.
Although both proxies have similar functions, there are some fundamental differences.
For the standalone proxy, a stub must be generated and the names and class names of the transport bindings, protocols, and transports that are used must be provided. The drawbacks of this approach are that if a name of a component is changed or requires some modifications, the stub is no longer valid and the whole proxy needs to be regenerated.
On the other hand, with the deployable proxy all information is either generated during deployment or is retrieved at runtime. Therefore, the deployable proxies are to a certain degree protected from runtime changes.
For both types of proxies, ServiceInterface and ServiceImpl classes are generated. Their names are derived from the service name of the WSDL that is used to generate the particular proxy.
For the deployable proxies, only the ServiceInterface is generated at the design time. The client assigns a JNDI name under which the ServiceImpl instace is bound at runtime. The JNDI name is relative to the java:comp/env/ context, which is the default for all J2EE components.
// for Deployed WS Clients
import javax.naming.InitialContext;
InitialContext ctx = new InitialContext();
FooServiceInterface fsi = (FooServiceInterface)ctx.lookup(u201Cjava:comp/env/FooServiceu201D);
At deployment, the service implementation and the service stub are generated. To take the service implementation for the standalone proxy, the generated class must be instantiated:
FooServiceInterface fsi = new FooServiceInterfaceImpl();
Regards
Surender Dahiya -
Automatically Running a Standalone Java Client
I have an application running on Orion with a standalone Java client, and I want this client to run as soon as the server is started. To complicate matters this client has an argument. After studying the documentation, I have made the following entries in the deployment descriptors (my apologies for the poor formatting):
In server.xml:
<application name="myApp" path="../applications/myApp.ear" auto-start="true" />
In application.xml:
<application>
<display-name>myApp</display-name>
<module>
<ejb>./myApp-ejb.jar</ejb>
<java>./myApp-client.jar</java>
</module>
<security-role>
<description>myApp system admin</description>
<role-name>admin</role-name>
</security-role>
</application>
and in orion-application.xml:
<ejb-module path="./myApp-ejb.jar" remote="false" />
<client-module path="./myApp-client.jar" auto-start="true" user="admin">
<arguments>
<argument value="theArgument" />
</arguments>
</client-module>
After all this nothing happens when the server starts. I still must manually run the client (with java -jar myApp-client.jar theArgument). I have been studying this for two days, and I cannot determine why this is the case.
One interesting thing I did notice was that the entire <client-module> tag (and therefore the <arguments> tag inside it) was missing in the orion-application.xml file located in the application-deployments directory. Of course I have no idea if that is significant.
Any insight into this perplexing problem is appreciated. Thanks.I am curious if this is an issue with the paths I have placed in any or all of the descriptors. Should the paths in orion-application.xml be relative to itself? In other words, if you have this in the EAR:
myApp.ear
META-INF
orion-application.xml
application.xml
myApp-ejb.jar
myApp-client.jar
then should the <client-module> path be this:
<client-module path="../myApp-client.jar" >
Or should it be relative to something other than the descriptor itself?
Any insight is appreciated.
Thanks again. -
OJMS and Standalone Java Client
Hi ,
any one had luck in accessing the ojms queue from a standalone java application.I am using oc4j standalone 9.0.0.3 container.I was able to do it from a jsp page .
But when i tried the same from standalone java client , its giving me javax.naming.NameNotFoundException: "No object bound for java:comp/resource/TestRP/QueueConnectionFactories/RPTable". The same lookup succeeds inside the jsp.Is there any additional configuration to be there for the standalone java client ?
thanks in advance ..
premPerhaps too obvious a point, but your standalone java client is running in a process different from that of oc4j. How do your java client process connect to oc4j?
Note that a jsp is running inside oc4j. -
RMI - EJB Standalone Java client
Hello,
We have a standalone Java client attempting to invoke a EJBs running on OC4J. We get a user not allowed to access namespace...check orion-application.xml file... Any ideas what could be the problem.
Regards.Hi,
In access namespace tag of your orion-application.xml, you should specify the same user as the one used by your java client.
Hope that helps
regards
Maybe you are looking for
-
How to read contents of TCP packets in Internet
i want to get the IP address of a packet from the remote host in Internet and read what each fields mean for designing a firewall with address and service filters and acting as a applicaiton gateway? so i want to read headers and other fields of the
-
Just got ipad2 for Christmas. Totally love it but am a little computer challenged. Can't figure out the camera. Not photo booth but just to take a pic. Yes, I'm an idiot.
-
Sequence of events and handlers in webdynpro
Hi, I am confused with the sequence of events triggered in webdynpro. What is the sequence of the events like WDDOINIT of window, view, Inbound plug handlers etc. I am more looking into the details like for example I have a window that opens a view.
-
phone is locked up. turned off and tried tried reset several times, phone displays larger font date/time screen but no slide to unlock control is visible
-
OSX or Logitech driver incompatibility with sounds from web
If sound comes from certain websites, OSX (or Logitech driver) have a problem outputting it to the proper port. I sent feedback to Apple, but I wonder if anyone else has experienced this or have any comments? Giovanni ====== DETAILS======== For sound