Produce Message to AQ Queue using standalone Java client in Oracle 11g FMW
I have a Java client that creates a TextMessage and tries to post it to AQ queue using the server context. Please find the sample code below:
QueueSession jmsSession = null;
QueueConnection queueConnection = null;
try {
Properties parm = new Properties();
parm.setProperty("java.naming.factory.initial","weblogic.jndi.WLInitialContextFactory");
parm.setProperty("java.naming.provider.url","t3://10.209.125.23:8001");
parm.setProperty("java.naming.security.principal","weblogic");
parm.setProperty("java.naming.security.credentials","weblogic1");
Context ctx = new InitialContext(parm);
System.out.println("Weblogic Initial Context obtained : " + ctx);
//DataSource ds = (DataSource)ctx.lookup(datasourceJNDI);
QueueConnectionFactory queueConnfactory = (QueueConnectionFactory)ctx.lookup(QCF) ;
System.out.println("QueueConnectionFactory from QCF jndi lookup : " + queueConnfactory);
queueConnection = queueConnfactory.createQueueConnection();
System.out.println("QueueConnection obtained : " + queueConnection);
//Make QueueSession
jmsSession = queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
System.out.println("QueueSession obtained : " + jmsSession);
//Start QueueConnection else no messages will be delivered
queueConnection.start();
Queue aqQueue = (Queue)ctx.lookup(QUEUE_JNDI);
System.out.println("Queue obtained from lookup: " + aqQueue);
QueueSender sender = ((AQjmsSession)jmsSession).createSender(aqQueue);
System.out.println("QueueSender obtained: " + sender);
File file = new File("C:
Documents and Settings\\Apara\\Desktop\\EH_Mig\\development
Resub.xml");
XmlObject object = XmlObject.Factory.parse(file);
String payloadString = object.toString();
System.out.println("Message to be sent : " + payloadString);
Message message = jmsSession.createTextMessage(payloadString);
sender.send(message);
jmsSession.commit();
System.out.println("Message sent : " + message.toString());
catch(Exception ex) {
ex.printStackTrace();
finally {
if (jmsSession != null)
jmsSession.close();
if (queueConnection != null)
queueConnection.stop();
queueConnection.close();
The code gives a runtime exception when it reaches the statement sender.send() as below :
weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_1032_WLStub.physicalConnectionWithin(Unknown Source)
at weblogic.jdbc.rmi.SerialConnection_weblogic_jdbc_rmi_internal_ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_1032_WLStub.physicalConnectionWithin(Unknown Source)
at oracle.sql.TypeDescriptor.setPhysicalConnectionOf(TypeDescriptor.java:817)
at oracle.sql.TypeDescriptor.<init>(TypeDescriptor.java:622)
at oracle.sql.StructDescriptor.<init>(StructDescriptor.java:317)
at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:200)
at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:168)
at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:137)
at oracle.jpub.runtime.MutableStruct.toDatum(MutableStruct.java:113)
at oracle.jms.AQjmsGenMessage_C.toDatum(AQjmsGenMessage_C.java:46)
at oracle.jms.AQjmsProducer.jdbcEnqueue(AQjmsProducer.java:1027)
at oracle.jms.AQjmsProducer.send(AQjmsProducer.java:747)
at oracle.jms.AQjmsProducer.send(AQjmsProducer.java:517)
at co.uk.morrisons.errorhospital.util.QueueTest.sendMessageUsingServerContextAndQCF(QueueTest.java:245)
at co.uk.morrisons.errorhospital.util.QueueTest.main(QueueTest.java:293)
Caused by: java.rmi.MarshalException: error marshalling return; nested exception is:
java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:234)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:223)
... 15 more
Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1156)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:326)
at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:618)
at weblogic.utils.io.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:63)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_WLSkel.internalInvoke2(Unknown Source)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_WLSkel.internalInvoke1(Unknown Source)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
I am using a ForeignServer configuration which is targeted to a JMS Server. This a Weblogic 10.3.2 feature. Please see if you can help me to enqueue the message.
Thanks,
Aparajeeta
It finally got resolved with help from Edwin Biemond and Oracle docs. I have made a blog out of it @
http://technicknacks.blogspot.com
Edited by: oraaps on Mar 26, 2010 5:33 PM
Similar Messages
-
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 -
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 -
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 -
How can I send and receive a message from a queue using standalone program
Hi,
I want to write a standalone Java program which has to post a message to a queue and receive a message from a queue thats specified as a replyto queue.I want to have my application to be completely standalone without the need of a Application server.What all the Jars do I need to include in the application.My aim is to have the application standalone and portable so that the application runs on any machine that has a JRE.
Thanks in advance,
PrathimaHi,
You can get quite simple standalone MQ Java programs from this site http://www.capitalware.biz/mq_code_java.html.
Also regarding the jars required for your application depends on the API being used. If you use MQI API few jars are required and if you decide to use JMS API you'll require few other jars. But you got to either install Websphere MQ Java Client, which will copy the jars to the respective location, or you can choose to copy the jars from some other machine manually.
Eventually, all the jars related to MQI and JMS API will reside under /usr/mqm/java/lib/ or /var/mqm/java/lib/ UNIX Environment. And in case of WINTEL, you should find the jars under C:\Program Files\IBM\WebSphere MQ\Java\lib.
Trust it clarifies...
Naren -
Generate standalone java client for weblogic (11g) webservice
Hi All,
I am a newbie to web logic family. I am using web logic 11g server and deployed JAX-WS web service on it using the documentation given for the same. I have created one complex object to return some data from the server as web service. I am able to build, deploy and run the web service using ant task on same machine.
But I need to deploy client classes on another machine and call web service from machine other than I am using for creating and deploying web service. Can you please tell me how can I achieve this ? Which jar files are needed to run a web service client generated through ant task and how can I create web service client differently using Eclipse IDE?
I have generated Client classes as jar using eclipse OEPE but I dont have any idea how can I use it because it changes the package name and class names also :(
Please help me out any hint would be greatly appreciated. :)Hi All,
I have found all the answers regarding my query from the link below :
[Overview of Web Services Invocation|http://download.oracle.com/docs/cd/E12840_01/wls/docs103/webserv/client.html#wp229351]
May be this would be helpful to the newbie who is just like me :) yippy :) -
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 -
Unable to get 'InitialContext' using Java Client in Oracle App 10.0.2.0
Scenario & Problem Description: Unable to get 'Initial Context' using Simple Java Client in Oracle Application Server 10.0.2.0
I'm having an issue while I try to initialize the Initial Context for an EJB lookup from a simple Java Client [local lookup], but the same code snippet works fine when I try from Servlet. I have enclosed the Exception Stack Trace and the Code Snippet for your reference.
1. .NET Client ---> Servlet --> LookupUtility --> EJB --> DB - Issue
2. .NET Client ---> Servlet --> EJB --> DB - Works
Exception: java.lang.InstantiationException: Error communicating with server: Lookup error: javax.naming.AuthenticationException: Invalid username/password for Config (guest); nested exception is: nested exception is: Exception in InitialContext: javax.naming.NamingException: Lookup error: javax.naming.AuthenticationException: Invalid username/password for Config (guest) at com.evermind.server.ApplicationClientInitialContextFactory.getInitialContext(ApplicationClientInitialContextFactory.java:149)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at com.seagate.edcs.config.util.LookupUtility.getInitialContext(LookupUtility.java:123)
at com.seagate.edcs.config.util.LookupUtility.getConfiguration (LookupUtility.java:69)
at com.seagate.edcs.config.util.LookupUtility.main(LookupUtility.java:135)
Code Snippet:
* This method returns the Configuration for the properties set.
public ArrayList getConfiguration ( ) throws Exception {
ArrayList arrayList = null;
try {
Context context = getInitialContext();
System.out.println("Context : " + context);
Object home = context.lookup("java:comp/env/ejb/com.seagate.edcs.config.ejb.ConfigSessionEJBHome");
System.out.println("Object home : " + home);
ConfigSessionEJBHome configSessionEJBHome = (ConfigSessionEJBHome)PortableRemoteObject.narrow(home, ConfigSessionEJBHome.class);
System.out.println("ConfigSessionEJBHome configSessionEJBHome : " + configSessionEJBHome);
ConfigSessionEJB configSessionEJB =(ConfigSessionEJB)PortableRemoteObject.narrow(configSessionEJBHome.create(), ConfigSessionEJB.class);
System.out.println("ConfigSessionEJB configSessionEJB : " + configSessionEJB);
arrayList = configSessionEJB.getAllConfig();
System.out.println("Context : " + context);
} catch (Exception ex) {
System.out.println("Exception Occured");
throw ex;
return arrayList;
* Get an initial context from the JNDI tree.
private Context getInitialContext() throws NamingException {
try {
Hashtable hashtable = new Hashtable();
hashtable.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory");
hashtable.put("java.naming.provider.url", "ormi://seagate.mil-shivas-270.am.ad.seagate.com/home"); // if we won't specify the port, it considers the default port
hashtable.put("java.naming.security.principal","ias_admin");
hashtable.put("java.naming.security.credentials","ias123");
return new InitialContext(hashtable);
} catch (NamingException ne) {
System.out.println("Exception in InitialContext.");
throw ne;
Note:
1. The user "ias_admin" & password "ias123" are the credential provided for the 'Admin' while installing the Oracle App Server and using these credentials I'm able to bring the Admin Console. Also, added new user 'guest/guest' - assigned this user to the 'admin' group ...
2. Since its a local lookup, there is no need to specify the credentials, but at runtime a dialog box pops up prompting to enter the 'userid/password' and when I enter the crendtials, I get the exception as stated. [In case of Servlet - EJB lookup, I'm not specifying any credentials]
Are there are any configuration parameters which I need to provide in any of the .xml? Could you please let me know the fix for the same.
Regards,
Kafeel/-Please use the OS {forum:id=210}
-
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 . -
Can we call a webservice using standalone java application ?
Hi friends,
Can we call configurd webservice in xi , using standalone java application by just giving url of webservice ?
OR
Only by means of WEBDynapro we can call ?
Can you please tell me the answer for this .
Regards .,
V.RangarajanHI Ranga Rajan
well, If at all if you have webservice...you can import that werbserivce as External definition in to IR.
How to import:
1) Go to IR and and move to your requied component and there you can see the option called imported objects...select on imported objects where you can give the name and you can select the webservices which you want to use it.
2) Hope you are aware of that a werbservice will have the request and response.
3) Create the mapping program accroding to your requirement.
Go through blogs of Bhavesh and Naveen which talks about calling webservice in a specific condition:
Webservice Calls From a User Defined Function - /people/bhavesh.kantilal/blog/2006/11/20/webservice-calls-from-a-user-defined-function
Consuming/Calling webservices from DataBases - /people/sap.user72/blog/2005/10/20/consumingcalling-webservices-from-databases
Also check this help file on Web Services:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/336365d3-0401-0010-9884-a651295aeaa9
Cheers..
Vasu
<i>** Reward Points if found useful **</i> -
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> -
Problems while doing a rollback on MQSeries using a java client
Hi,
I'm new to using MQSeries with Java client. I have a kind of similar problem. I have a set of messages in a Queue. When i'm doing a rollback on certain message it's returing to the same pointer where it had come from in the queue. When i'm iterating through the messages in the queue using a for loop, the same message is again retireved. So, i tried to set the setMQGMO_MARK_SKIP_BACKOUT flag to true. But i'm getting an RequestException with error code 2046: MQRC_OPTIONS_ERROR
Any help on this would be highlly appreciated.
I'm pasting the code snippet below.
Class X {
public void receive(
com.stc.connector.webspheremqadapter.message.IMessage input, com.stc.connector.webspheremqadapter.message.IMqOtd
MQSeries_1){
int msginqueue = MQSeries_1.getCurrentDepth();
String corrID = "";
byte[] corrIDInputArray = input.getMsgHeader().getCorrelationId();
String corrInputID = (new String( corrIDInputArray )).trim();
for (int i = 0; i < msginqueue; i = i + 1) {
MQSeries_1.getQueue().getGMO().setMQGMO_SYNCPOINT( true );
MQSeries_1.getQueue().getWithOptions();
byte[] corrIDArray = MQSeries_1.getMessage().getMsgHeader().getCorrelationId();
corrID = (new String( corrIDArray )).trim();
if (corrID.equalsIgnoreCase( corrInputID )) {
MQSeries_1.commit();
} else {
MQSeries_1.getQueue().getGMO().setMQGMO_MARK_SKIP_BACKOUT( true );
MQSeries_1.backout();
}I agree that you should check for a specific axis / tomcat forum (maybe on apache website??;)) anyway ... check the path and classpath you use while building the wsdd file and when running the adminclient, and check the syntax of its invokation
-
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(); -
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
-
I have a strange problem. When I am using headphones the Mic that is built into the system works FINE. However when I start outputing with a 3.5 mm to red/white composite to my sound system, the Mic stops working. On my T61p the mic/speaker jacks wer
-
Hi, I would love any help on the following... I am after an equivalent to this product (http://www.nicolaudie.com/downloads/files/brochure_esa2010.pdf) for Apple Mac. It is a DMX USB Controller Interface called 'Easy Stand Alone' which is required to
-
Fusion HCM Compensation: which table stores Individual Award and approvals?
Hi - Not seeing any Fusion app forum so I'm asking for leads here about DB sources for Fusion HCM's Individual Award (IA) transaction to customize in OTBI. If there's a better forum to post, please advise. I looked at OBIEE and OBIA but this question
-
Hello Users, about 3 hours ago iCal delete all my dates. The dates are on my iPhone but i can't synchronize them from iPhone to iCal it always synchronize the empty iCal-calendars from mac to iPhone. These calendars are very import for me, how can i
-
HT2489 How do I fix this error when trying to install a software update?
The digital signature for this package is incorrect. The package may have been tampered with or corrupted since being signed by "Apple".