subho saha

Ranch Hand
+ Follow
since Jun 15, 2005
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 subho saha

You can check out my link.I got a similar offer from them.I had collected some information. But I won't comment any thing here. send me a private message or contact me by supplying your mail - id.
15 years ago
Although I am ignorant about the internal facts of SYNTEL yet I should say it has a very low reputation in the market. This is taken from neutral point of view. There must be something very wrong with that company otherwise they wouldnot have earned such a bad reputation.People dosenot talk bad about TCS INFY or Kanbay and even Mind Tree. Then why should people talk bad about them.To an outsider like me it seems something dirty is going on inside
15 years ago
//=========================================================================
The programming job is very demanding, so most women have to leave jobs to manage homes and children of you guys who think women cannot program..


//=========================================================================


Donot tell this boring things over and over again. You girls put on this lame excuse every time you are questioned. I feel women are far more practical in these days, ask any of them about leaving a job for family and they do make huge cries and also do come up and put such excuses when needed.
[ April 24, 2006: Message edited by: subho saha ]
15 years ago
Perhaps you can use http analyser sort of software to find out whats really happening in the browser, whether any redirection is taking place or not.
cannot get clear understanding of your problem. May be you should display the url so that we can have a look. Also can try HttpURLConnection.
Thanks Ernest very much. Because of your ideas I changed the code and now its working perfectly.Thank You Very much.

Here is the code which worked Ok.
==============================================================

import java.net.*;
import java.io.*;
import java.net.HttpURLConnection.*;



public class testpost2 extends Object
{

public static void main(String[] args) throws Exception {


URL downeyjrURL = new URL("https://www.novgroup.com/securevault/reservations/canadcorp/srs/step2.php");
URLConnection c = downeyjrURL.openConnection();
//c.setRequestMethod("POST");
c.setDoOutput(true);
c.setDoInput(true);
c.setUseCaches(false);



c.setRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
c.setRequestProperty("Content-type",
"text/xml");

c.setRequestProperty("soapaction",
"\"http://tempuri.org/ObtenerImporte\"");
c.setRequestProperty("Host",
"www.novgroup.com");


DataOutputStream outStream = new DataOutputStream(
c.getOutputStream());


outStream.writeBytes("<wddxPacket version=\"1.0\">");
outStream.writeBytes("<header />");
outStream.writeBytes("<data>");
outStream.writeBytes("<struct>");
outStream.writeBytes("<var name=\"parameters\">");
outStream.writeBytes("<struct>");
outStream.writeBytes("<var name=\"discount\"><array length=\"5\"><null /><null /><null /><null /><null /></array></var>");
outStream.writeBytes("<var name=\"enddate\"><string>Jul 13, 2006</string></var>");
outStream.writeBytes("<var name=\"startdate\"><string>Jul 12, 2006</string></var>");
outStream.writeBytes("<var name=\"hotelid\"><string>10</string></var>");
outStream.writeBytes("<var name=\"roomid\"><string>38</string></var>");
outStream.writeBytes("<var name=\"adults\"><number>1</number></var>");
outStream.writeBytes("<var name=\"fields\"><array length=\"2\"><string>id</string><string>name</string></array></var>");
outStream.writeBytes("</struct>");
outStream.writeBytes("</var>");
outStream.writeBytes("<var name=\"funcName\"><string>getRoomPrice</string></var>");
outStream.writeBytes("</struct>");
outStream.writeBytes("</data>");
outStream.writeBytes("</wddxPacket>");


outStream.close();
BufferedReader in2 = new BufferedReader(new
InputStreamReader(c.getInputStream()));

String inputLine;
while((inputLine = in2.readLine()) != null)
System.out.println(inputLine);
in2.close();
}
}
[ April 21, 2006: Message edited by: subho saha ]
Hello Ernest, According to your suggestion I modified the code as shown below, but same error as before seems to come. Please make some suggestion.


CODE NOW
===========================================================================

import java.net.*;
import java.io.*;
import java.net.HttpURLConnection.*;



public class testpost
{

public static void main(String[] args) throws Exception {



URL downeyjrURL = new URL("https://www.novgroup.com/securevault/reservations/canadcorp/srs/step2.php");
HttpURLConnection c = (HttpURLConnection)(downeyjrURL.openConnection());
c.setDoOutput(true);
c.setRequestMethod("POST");
PrintWriter out = new PrintWriter(c.getOutputStream());


// Here's where the parameter is set.
out.println("Content-type: text/xml");
//out.println(htmlString);
out.println("<wddxPacket version=\"1.0\">");
out.println("<header />");
out.println("<data>");
out.println("<struct>");
out.println("<var name=\"parameters\">");
out.println("<struct>");
out.println("<var name=\"discount\"><array length=\"5\"><null /><null /><null /><null /><null /></array></var>");
out.println("<var name=\"enddate\"><string>Jul 13, 2006</string></var>");
out.println("<var name=\"startdate\"><string>Jul 12, 2006</string></var>");
out.println("<var name=\"hotelid\"><string>10</string></var>");
out.println("<var name=\"roomid\"><string>40</string></var>");
out.println("<var name=\"adults\"><number>1</number></var>");
out.println("<var name=\"fields\"><array length=\"2\"><string>id</string><string>name</string></array></var>");
out.println("</struct>");
out.println("</var>");
out.println("<var name=\"funcName\"><string>getRoomPrice</string></var>");
out.println("</struct>");
out.println("</data>");
out.println("</wddxPacket>");
out.close();

BufferedReader in2 = new BufferedReader(new
InputStreamReader(c.getInputStream()));

String inputLine;
while((inputLine = in2.readLine()) != null)
System.out.println(inputLine);
in2.close();
}
}
I am tring to get the response to a certain web page. I have tracked the request and response from the following page using http analyser. Its sending some kind of XML data with the post request. I have built a code that sends the same request, but getting error.perhaps the problem is with the format in which the xml data is send. Please , please do suggest.

I have attached correct request and response found out through http analyser along with the code down it.

Request
==========================================================
POST /securevault/reservations/canadcorp/srs/step2.php HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Host: www.novgroup.com
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Cache-Control: no-cache
Connection: Keep-Alive
Content-Length: 609
Content-Type: text/xml

<wddxPacket version="1.0"><header /><data><struct><var name="parameters"><struct><var name="discount"><array length="5"><null /><null /><null /><null /><null /></array></var><var name="enddate"><string>Jul 13, 2006</string></var><var name="startdate"><string>Jul 12, 2006</string></var><var name="hotelid"><string>10</string></var><var name="roomid"><string>40</string></var><var name="adults"><number>1</number></var><var name="fields"><array length="2"><string>id</string><string>name</string></array></var></struct></var><var name="funcName"><string>getRoomPrice</string></var></struct></data></wddxPacket>


==========================================================
Response which is comming.
==========================================================
<wddxPacket version='1.0'><header/><data><struct><var name='cNames'><array length='2'><string>adate</string><string>rate</string></array></var><var name='rates'><array length='1'><array length='2'><string>2006-07-12</string><string>109.00</string></array></array></var></struct></data></wddxPacket>
============================================================================================================================


My code to get the response page
===========================
import java.net.*;
import java.io.*;
import java.net.HttpURLConnection.*;



public class testpost{

public static void main(String[] args) throws Exception {


URL downeyjrURL = new URL("https://www.novgroup.com/securevault/reservations/canadcorp/srs/step2.php");
HttpURLConnection c = (HttpURLConnection)(downeyjrURL.openConnection());
c.setDoOutput(true);
c.setRequestMethod("POST");
PrintWriter out = new PrintWriter(c.getOutputStream());
String xmlString;

String htmlString = "<wddxPacket version=1.0><header /><data><struct><var name=parameters><struct><var name=discount><array length=5><null /><null /><null /><null /><null /></array></var><var name=enddate><string>Jun 23, 2006</string></var><var name=startdate><string>Jun 22, 2006</string></var><var name=hotelid><string>10</string></var><var name=roomid><string>38</string></var><var name=adults><number>1</number></var><var name=fields><array length=2><string>id</string><string>name</string></array></var></struct></var><var name=funcName><string>getRoomPrice</string></var></struct></data></wddxPacket>";

// Here's whether the parameter is set.
out.println("xmldoc=" + URLEncoder.encode(htmlString));
//out.println("xmldoc=" + htmlString);
out.close();

BufferedReader in2 = new BufferedReader(new
InputStreamReader(c.getInputStream()));

String inputLine;
while((inputLine = in2.readLine()) != null)
System.out.println(inputLine);
in2.close();
}
}
//====================================================================================================================
but is giving error --no function called (). I think I am not able tosend the Xml in Right format.Exact error-----------------------------------------------------------------------------------------------------------------------------------------------

br />
<b>Notice</b>: Undefined index: HTTP_RAW_POST_DATA in <b>/var/www/htdocs/novgr
oup.com/securevault/reservations/canadcorp/srs/step2.php</b> on line <b>27</b><b
r />
<br />
<b>Notice</b>: Undefined variable: HTTP_RAW_POST_DATA in <b>/var/www/htdocs/no
vgroup.com/securevault/reservations/canadcorp/srs/step2.php</b> on line <b>30</b
><br />
<br />
<b>Fatal error</b>: Call to undefined function: () in <b>/var/www/htdocs/novgr
oup.com/securevault/reservations/canadcorp/srs/step2.php</b> on line <b>42</b><b
r />


//==================================================================================================================
Please help me. any code or suggestion will be helpful.
Wishing all ranchers and members of this extended java ranch family a happy and a prosperous bengali new year.(Subho nababarsha-- as we call it in bengali).May the year bring joy and happiness in all your life.
[ April 14, 2006: Message edited by: subho saha ]
15 years ago
May be you should clear your browsers cookies and temporary files and then type localhosta:8080 and see the effect, after closing tomcat.
15 years ago
I would be visiting my mom and dad at weekends at calcutta suburb's
15 years ago
wishing happy holi to all members of javaranch family. May the festival of color bring joy and happiness in all your lives
[ March 14, 2006: Message edited by: subho saha ]
15 years ago
thanks for the suggestion paul.
15 years ago
just by typing
ant in the command promt of the directory containing the build.xml.
15 years ago
I expect the "rebuild" target to work first which will call targets clean and then compile. But by default only compile is happening.
rebuild and clean is not getting called.
It is a bit problematic to download and work with 1.6 version from where i run this ant.
[ February 21, 2006: Message edited by: subho saha ]
15 years ago