Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Eshwin Sukhdeve

Ranch Hand
+ Follow
since Mar 15, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eshwin Sukhdeve

Hi ,

I have xml file which contains

<Minutes_of_Meeting_Detail>
<Attendees>Presenter<br/> Test<br/></Attendees>
</Minutes_of_Meeting_Detail>

and the XSLT code is:-

<xsl:value-of select="Minutes_of_Meeting_Detail/Attendees"/></SPAN> </TD>

Output is :-
Presenter<br/>Test<br/>

So here output should come like this
Presenter Test

I want to remove <br/> tag from output ,

can someone help on this.Thanks in advance
Hi Anjaneya ,

I have resolved the connection time out issue ,it was some proxy problem.

But now I a getting 500 error in

if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_CREATED) {
throw new RuntimeException("Failed : HTTP error code : "
+ httpConnection.getResponseCode());
}

I have used the below code.even though I am getting same error.

OutputStreamWriter writer =new OutputSreamWriter(httpConnection.getOutputStream());
writer.write(input);


I have tested the service through REST client broswer ,there I am getting correct result ,but through java I am getting 500 error
3 years ago
Hi ,

I want to write one REST client program for POST request ,request and response is in JSON Format.



Line OutputStream os = httpConnection.getOutputStream();
I am getting connection time out problem
3 years ago

Hi Mahendran,

Thanks for response ,I resolved the connection time out issue. but now I am getting the "Authentication failure" exception

{"responseCode":"100","responseMsg":"Authentication failure."}



can you or any one help me out this.
3 years ago



I am getting the connection time out error in below line :-


System.out.println("response code"+httpConnection.getResponseMessage());

Note:-I need to pass user id and pwd in header parameter.
and I am using https connection.
3 years ago
Hi Rob,
Thanks for reply,

Actuly I want to read the mail from my webmail(official mail).

to get from gmail we use below code.

Properties props = new Properties();
props.setProperty("mail.store.protocol", "imaps");

Session session = Session.getInstance(props, null);
Store store = session.getStore();
store.connect("imap.gmail.com", "@gmail.com", "e*****");
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
Message msg = inbox.getMessage(inbox.getMessageCount());

but if i want to connect my webmail ,wht are the changes I need to update in the below line of code.

store.connect("imap.gmail.com", "@gmail.com", "e*****");

URL :- https://webmail.companyname.com.my/owa/
username :- test
password:-test123

my objective is to read mail from my webmail account
3 years ago
Hi ,

Can any one tell me how to download emails from gmail and save into any local directory using java mail API.

I just know how to download the attachment from mail but I need to download the complete email.

Thanks in advance .
3 years ago
Hi ,

I have a POST REST API witch returns the JSON object array.

URL:- /inbox/msg/tag/list

Header Parameter :- user id, password

Response :-

Format:
{
"responseCode":"<response_code>",
"responseMsg":"<response_message>",
"data": [
{
"messageID": "<message_ID>",
"orgID": "<org_id>"
"contentType: "<content_type>",
"filesize": "<file_size>",
"checksum": "<checksum>"
},
{
"messageID": "<message_ID>",
"orgID": "<org_ID>"
"contentType: "<content_type>",
"filesize": "<file_size>",
"checksum":"<checksum>"
},
..
]
}


when I hit the above mentioned url with header parameter .
I get the above response .


I just want how to write the client program for this ,bcse I dont have idea how to mention the header parameter in client java program.

can anyone please help me on this.
3 years ago
Hi ,

I am iterating below XML using for each loop.

<Test>
<Fab>1</Fab>
<Priority>Test1</Priority>
</Test>
<Test>
<Fab>2</Fab>
<Priority>Test2</Priority>
</Test>



XSLT code:-
<xsl:for-each select="Test">
<tr>
<td><xsl:value-of select="Fab" /></td>
<td ><xsl:value-of select="Priority" /></td>
</tr>
</xsl:for-each>



This XSLT is giving correct output to me.

But Can I get get the same output for below xml.

<Test>
<Fab>1</Fab>
<Priority>Test1</Priority>

<Fab>2</Fab>
<Priority>Test2</Priority>
</Test>

can we iterate this xml for "Fab" and "Priority" value in xslt.
and if yes what would be the code changes for that.






Hi,
I have wrriten a qtp automation using VBScript.
I am automating a web application where I need to open a 2 tab.
In first tab its should open my mail account and another tab it should open
application.

Problem:- some time I am getting expected result,means it is opening in correct tab,
but sometime application is getting open in first tab,which should be open in second tab.
without changing any code I am getting this unexpected behavior.

Is it any Internet explorer setting problem.

can some one please respond me ASAP .

Thanks in advance
3 years ago
Hi,
I am creating one simple script in selenium using HtmlUnitDriver() API.

driver = new HtmlUnitDriver(capabilities);
driver.get(url);

its working fine with correct URL.but when I give worng url it is getting strucked.
so I want if it is wrong url..then it should wait for some time.and thorw
some exception. it should not hang or strucked

Thanks
4 years ago
Hi,
I have written one java code where I am have the xml file
myrunner.setProjectFile("C:/xxxxxx.xml");
prop[0]="key1=newvalue1";
prop[1]="key2=newvalue2";
myrunner.setProjectProperties(prop);
myrunner.setTestSuite("pro_inttilazaion");
myrunner.setTestCase("TestCase");
myrunner.run();
here I am trying to set the prop using setProjectPropert method

but after running this code it is not updating the string value(prop).
it is showing me the old property value.becase it is getting the old value
from script "TestCase" in soapui.
testenv=testRunner.testCase.testSuite.project.getPropertyValue("key1");
log.info testenv

when I run the java code ..it calles this line too.but when the above line of
code executed I am getting the old values(from properties file)..instead of getting "newvalue1"
which I have set from java code.please tell me how to update the property from external java file


Thanks in advance






5 years ago
Thanks for reply,
actuly my perpose is that I have to read one file in the first webapp servlet and after reading I need to pass the content
of the file from first servlet to another webapp servlet.can you please tell me how to do that.

Thanks

5 years ago
Hi,
I have 2 webapplication (web1,web2)
in web1 I have 1 servlet class from that servlet class I want to call another servlet which is inside the web2. I have written the
following code

RequestDispatcher dispatcher =getServletContext().getRequestDispatcher("http://localhost:8080/web2/Servlet2");
dispatcher.forward(req,resp);

but it is giving me the error

java.lang.IllegalArgumentException: Path http://localhost:8080/web2/Servlet2 does not start with a "/" character

please can you tell me how to call that servlet.its urgent..I have seen this same que in this form..but not able to get it.


Thanks
5 years ago