kalpana Kumar

Ranch Hand
+ Follow
since Jul 03, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by kalpana Kumar

Deepak,

I did try the option. Please find the below
For the version that I am using the implementation class is SOAPConnectionImpl, but this does not have any method to set the timeout.

Thanks.


14 years ago
Thanks Deepak. The webservice call is done within another application that uses only JDK 1.4. I cannot use higher versions. So, this is another restriction.
14 years ago
Hi,

I am using Axis 1.4 and JDK 1.4. I am also facing the same issue where I have to set the timeout. Please find code snippet below.


MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();

//Custom
SOAPHeaderElement authElement;
SOAPElement authTokenElement;


// Create and populate the body

Name ns = envelope.createName("Authentication", "","urn:test.com");

Name ns1 = envelope.createName("AuthenticationToken", "","urn:test.com");

//Name ns = new
SOAPHeader soaph = envelope.getHeader();
authElement = soaph.addHeaderElement(ns);
authTokenElement = authElement.addChildElement("AuthenticationToken");
authTokenElement.addTextNode( authenticationToken );

SOAPBody body = envelope.getBody();




SOAPElement bodyElement = body.addChildElement(
envelope.createName("GetValue", "", "urn:WS.service.test.com"));
SOAPElement bodyElementMat = bodyElement.addChildElement("First"); // bodyElement.add;
SOAPElement testing = bodyElementMat.addChildElement("second");
testing.addTextNode("TestData");
envelope = soapPart.getEnvelope();

MimeHeaders headers = message.getMimeHeaders();
headers.addHeader("SOAPAction", "urn:WS.service.test.com/GetValue");


// Save the message
message.saveChanges();


SOAPConnectionFactory soapConnFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnFactory.createConnection();

--In this thread it is mentioned that the soapconnection was downcasted to soapconnectionImpl, to achieve the timeout

URL url = new URL("http://localhost:8001/ws/services/TestService");


SOAPMessage msg = message;
msg.writeTo(System.out);

SOAPMessage reply = connection.call(msg,url );
//reply.writeTo(System.out); // this is the acutal output of the webservice.

//Getting the values from response
StringWriter writer = new StringWriter();
StreamResult result = new StreamResult(writer);
if (reply !=null){
Source src = reply.getSOAPPart().getContent();

TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();

transformer.transform(src, result);
}


System.out.println("finally"+writer.toString());
}

In this thread it is mentioned that the soapconnection was downcasted to soapconnectionImpl, to achieve the timeout. Could you please provide your suggestions. Any suggestion is highly appreciated.

Thanks in Advance.


14 years ago
Hi,

Code snippet is as below. I have to use JDK 1.4. I am using axis 1.4.

SOAPConnection connection = soapConnFactory.createConnection();

I would like to do is dynamically set the connection timeout. I read in forums that I can use SOAPConnectionImpl but tried doing the same but always ended in exceptions. Please provide your suggestions as to how this can be resolved.

Thanks in Advance for any suggestions.

Thanks.
14 years ago
Hi all,

Need help with the below.
I am trying to add header(authentication token) to a webservice client call as part of the header. This is done by a single line of code in JDK 5 and higher versions as below. But how to accomplish the below equivalent in JDK 1.4 and Axis 1.4.

headers.add(com.sun.xml.ws.api.message.Headers.create( authenticationElement) );
( (WSBindingProvider) wsClientEndpoint).setOutboundHeaders( headers );

The Soapmessage is as below.

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<env:Header>
<Authentication>
<Token>123</Token>
</Authentication>
</env:Header>
<env:Body>
<GetValue>
<Name>TrialTest</Name>
</GetValue>
</env:Body>
</env:Envelope>


com.sun.xml.ws.api.message.Headers - This is given as part of JDK 6.0. But I cannot use JDK 6.0 and should do the above in JDK 1.4.

Since I could not find the above equivalent in JDK 1.4, I tried creating a SOAPMessage and tried posting the same using SOAPConnection - javax.xml.soap.SOAPConnection to the destination.

as below
SOAPMessage reply = connection.call(soapmsg,destination);
System.out.println(reply.toString());

But the reply gives SOAPMessageImpl[SOAPPartImpl[null]] as output.

Not sure what is happening. I am trying to achieve the same in both the cases, posting a message to the destination. Please suggest.

Thanks in Advance.
14 years ago
Hi all,

I am using JDK 1.4. I need all the supported jar's for creating a soapheader and adding it to the soap message. I created a sample client as below, but I get the jar mismatch errors, all the jars I downloaded are JDK 5.0 or 6.0 compatible. Currently it is a test client but I have to include this as part of another application, where I cannot install anything new but just place the jar's in the classpath of the application.

The sample below from J2EE Webservices by richard monson haefel, is also not working since there is mismatch of the jars.
I get the below exception which says dom.jar is not present in the classpath - Please help out in finding the appropriate jar for JDK 1.4 compatibility.

java.lang.NoClassDefFoundError: org/w3c/dom/TypeInfo

Please let me know the list of jar's that need to include which should be JDk 1.4 compatible alone so that I can compile the below test client.

import java.util.ArrayList;

import javax.xml.soap.*;
import javax.xml.soap.MessageFactory;


public class SoapConnectionCreate {

public static void main(String args[]) {

try {

//First create the connection
// SOAPConnectionFactory soapConnFactory =
// SOAPConnectionFactory.newInstance();
// SOAPConnection connection =
// soapConnFactory.createConnection();

//connection.call(arg0, arg1)
//Next, create the actual message
javax.xml.soap.MessageFactory msg = MessageFactory.newInstance();
javax.xml.soap.MessageFactory msgFac = MessageFactory.newInstance();
SOAPMessage message = msgFac.createMessage();

message.getSOAPHeader().detachNode();
SOAPBody body = message.getSOAPBody();
SOAPElement getBook = body.addChildElement("getBookPrice","mh","http://www.Monson-Haefel.com/jwsbook/BookQuote");
getBook.setEncodingStyle(SOAPConstants.URI_NS_SOAP_1_2_ENCODING);
// javax.xml.soap.SOAPElement isbn = getBook.addChildElement("isdb");
getBook.addTextNode("232424");
System.out.println("\nREQUEST:\n");
message.writeTo(System.out);
System.out.println();

} catch(Exception e) {
System.out.println(e.getMessage());
}
}
}

Any help is greatly appreciated.
14 years ago
Hi all

We have a requirement where a backend job starts and calls the SSB via a webservice and places the messages in the queue. This backend job would run every 5 minutes and we have to make sure that the same message is not picked up twice.

The SSB which puts the message into the queue has a transaction attribute of Required.
To accomplish the above we are planning to set a flag in the database against each message after the message is put in the arraylist within the SSB.

Since lot of XML parsing is involved internally, the time taken to process 1000 messages is 20 minutes. So, here are my doubts. To accomplish the above

1. Since the entire process takes 20 minutes and the backend job runs every 5 minutes there is a high probability that the same record could be picked up.
2. So, Can I define one more method in SSB and do a updation in the database by setting the flag against each messages that was selected? and make this method not a part of the actual transaction by setting the transaction attribute to be NotSupported.

Or is there a different way to do do.

Please any suggestions is appreciated.
Hi all

Where can I find good understanding notes on bit shift operators. Please guide me.

Thanks
Thanks a lot for all the replies.
18 years ago
Marilyn,
Thanks a lot for the response.
But in the above code b is defined to be final. it is initialised in the next line.
I wanted to know if there is any difference in this type of initialization.

Thanks
18 years ago
Hi all,
In the following code
public static void main(String args[]){
final int a=1;
final int b;
b=20;//is this b not final
int x=0;
switch(x){
case a:
case b: //compiler error


}
}
I want clarification as to why is b not considered to be a compile time constant???.

Thanks
18 years ago
Thanks a lot for the information Jeff. I did not know about it.
18 years ago
I need to know where can I find the samples and complete examples which details the steps involved in parsing an XML with schema definition.

Please any links or book details would be very helpful.

Thanks
18 years ago
I fixed the problem. I redeployed the jms-xa-adp.rar connector module.

Thanks
18 years ago
Hi
I am getting this error while trying to post message a message via weblogic MQ Bridge. I am not able to figure out why??..Help need please..

.Exception: javax.resource.ResourceException: Failed to setup the connection fo
r transaction enlistment
at weblogic.connector.common.internal.XATransConnectionHandler.enListRes
ource()V(XATransConnectionHandler.java:140)
at weblogic.connector.common.internal.ConnectionWrapper.invoke(Ljava.lan
g.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object Ljava.lang.Object;(Connec
tionWrapper.java:145)
at $Proxy8.createMessage(Ljavax.jms.Message Ljavax.jms.Message;(Unknown
Source)
at weblogic.jms.bridge.internal.MessagingBridge.processMessages()V(Messa
gingBridge.java:1378)
at weblogic.jms.bridge.internal.MessagingBridge.beginForwarding()V(Messa
gingBridge.java:943)
at weblogic.jms.bridge.internal.MessagingBridge.execute(Lweblogic.kernel
.ExecuteThread V(MessagingBridge.java:1021)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest
V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread V(Unknown Sourc
e)
-------------- Linked Exception ------------
javax.transaction.SystemException: start() failed on resource 'mydomain.myserver
.Weblogic Messaging Bridge Adapter (XA)_eis/jms/WLSConnectionFactoryJNDIXA': XAE
R_PROTO : Routine was invoked in an inproper context
javax.transaction.xa.XAException: XAResource closed
at com.ibm.mq.MQXAResource.start(Ljavax.transaction.xa.Xid;I)V(MQXAResou
rce.java:425)
at weblogic.transaction.internal.XAServerResourceInfo.start(Lweblogic.tr
ansaction.internal.ServerTransactionImpl;Ljavax.transaction.xa.Xid;I)V(XAServerR
esourceInfo.java:1103)
at weblogic.transaction.internal.XAServerResourceInfo.xaStart(Lweblogic.
transaction.internal.ServerTransactionImpl;I)V(XAServerResourceInfo.java:1035)
at weblogic.transaction.internal.XAServerResourceInfo.enlist(Lweblogic.t
ransaction.internal.ServerTransactionImpl Z(XAServerResourceInfo.java:213)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Lj
avax.transaction.xa.XAResource Z(ServerTransactionImpl.java:461)
at weblogic.connector.common.internal.ResourceRegistrationManager.enlist
Resource(Lweblogic.connector.common.internal.TransactionalConnHandler;Ljavax.tra
nsaction.Transaction V(ResourceRegistrationManager.java:95)
at weblogic.connector.common.internal.XATransConnectionHandler.enListRes
ource()V(XATransConnectionHandler.java:81)
at weblogic.connector.common.internal.ConnectionWrapper.invoke(Ljava.lan
g.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object Ljava.lang.Object;(Connec
tionWrapper.java:145)
at $Proxy8.createMessage(Ljavax.jms.Message Ljavax.jms.Message;(Unknown
Source)
at weblogic.jms.bridge.internal.MessagingBridge.processMessages()V(Messa
gingBridge.java:1378)
at weblogic.jms.bridge.internal.MessagingBridge.beginForwarding()V(Messa
gingBridge.java:943)
at weblogic.jms.bridge.internal.MessagingBridge.execute(Lweblogic.kernel
.ExecuteThread V(MessagingBridge.java:1021)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest
V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread V(Unknown Sourc
e)

at weblogic.transaction.internal.XAServerResourceInfo.xaStart(Lweblogic.
transaction.internal.ServerTransactionImpl;I)V(XAServerResourceInfo.java:1059)
at weblogic.transaction.internal.XAServerResourceInfo.enlist(Lweblogic.t
ransaction.internal.ServerTransactionImpl Z(XAServerResourceInfo.java:213)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(Lj
avax.transaction.xa.XAResource Z(ServerTransactionImpl.java:461)
at weblogic.connector.common.internal.ResourceRegistrationManager.enlist
Resource(Lweblogic.connector.common.internal.TransactionalConnHandler;Ljavax.tra
nsaction.Transaction V(ResourceRegistrationManager.java:95)
at weblogic.connector.common.internal.XATransConnectionHandler.enListRes
ource()V(XATransConnectionHandler.java:81)
at weblogic.connector.common.internal.ConnectionWrapper.invoke(Ljava.lan
g.Object;Ljava.lang.reflect.Method;[Ljava.lang.Object Ljava.lang.Object;(Connec
tionWrapper.java:145)
at $Proxy8.createMessage(Ljavax.jms.Message Ljavax.jms.Message;(Unknown
Source)
at weblogic.jms.bridge.internal.MessagingBridge.processMessages()V(Messa
gingBridge.java:1378)
at weblogic.jms.bridge.internal.MessagingBridge.beginForwarding()V(Messa
gingBridge.java:943)
at weblogic.jms.bridge.internal.MessagingBridge.execute(Lweblogic.kernel
.ExecuteThread V(MessagingBridge.java:1021)
at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest
V(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread V(Unknown Sourc
e)
18 years ago