Results 1 to 1 of 1
- 09-21-2010, 05:48 AM #1
Member
- Join Date
- Jul 2008
- Location
- india
- Posts
- 35
- Rep Power
- 0
not getting response from web service within time window
Hi
There is an urgent activity i have to perform...please help
i am trying to call webservice method by making an http connection .i am willing to set time out parameter if i there is no response withing certain time.please help me out to achieve this.
following is the code
System.setProperty("javax.xml.soap.MessageFactory" ,"com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessa geFactory1_1Impl");
System.setProperty("javax.xml.soap.SOAPConnectionF actory","weblogic.wsee.saaj.SOAPConnectionFactoryI mpl");
url = PluginConstants1.CRMWSURL;
messageFactory = MessageFactory.newInstance();
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = factory.createConnection();
URL endpoint = new URL(url);
//System.out.println(" URL is "+url);
SOAPMessage message = messageFactory.createMessage();
try {
setMessageContent(message, transformXML);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
message.saveChanges();
//This must come before the mime header changes below!
//Need to add a start section to the Content-Type MIME header.
//This allows identification of the start part of this multipart SOAP message
//The value of the start section must match the Content-Id set for the SOAPPart earlier.
String[] mimeHeaders = message.getMimeHeaders().getHeader("Content-Type");
//Assuming there's only one Content-Type header
String headerValue = mimeHeaders[0];
//Add a start part id reference.
headerValue += "; start=\"<startPart>\"";
//Replace existing Content-Type;
message.getMimeHeaders().setHeader("Content-Type", headerValue);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
SOAPMessage response = connection.call(message, endpoint);
ByteArrayOutputStream bao = new ByteArrayOutputStream();
response.writeTo(bao);
responseString = new String(bao.toByteArray());
log.info("CreateOrderBySpecification response:");
log.info(responseString);
please help me out..its very urgent
Similar Threads
-
Java application as window service
By sijitg in forum Advanced JavaReplies: 2Last Post: 09-06-2010, 10:06 AM -
Creating a time sliding window..urgent
By sm123 in forum New To JavaReplies: 1Last Post: 03-12-2010, 03:12 AM -
Need to pass a value from a parent window to a pop up or child window
By blackpanther in forum Advanced JavaReplies: 4Last Post: 01-10-2010, 07:48 AM -
how to call service method inside another service
By kirtichopra2003 in forum Web FrameworksReplies: 1Last Post: 10-24-2009, 02:19 AM -
How to set a max response time in webservice client
By sudheerbasu.k@gmail.com in forum Advanced JavaReplies: 1Last Post: 05-11-2008, 02:25 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks