Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Java PHP WebService
Actually i've a page named(vehicle.php) inside apache server and Java api page (someheader://someip:someport/track/Track?page=map.fleet) inside tomcat server. I created a Restful Webservice in PHP using this link http://viralpatel.net/blogs/restful-web-service-tutorial-introduction-rest-restful/
And then i sent a username and password from apache server to the java api through webservice, it sends the request correctly and the Java api verifies the username and password and sends back the response page to the webservice. When i call a response function inside webservice from my php page and echoed , it simply prints the values from the api without any scripts and images and links and If i click on any of the link it shows page not found.
 
I checked the headers using Firebug it shows the response code 404 not found for js and images. It actually checks for those files and images in apache server but they are inside tomcat.
 
Can anyone tell how to open the response in the browser after am sending the request. Response should load the images and scripts from Java api not from apache server.
 
If there is any way to solve my problem let me know guys.
 
Help me.....
 
Thanks,
 
SJ
Posted 11-Mar-13 0:25am
HOSTGUY347
Comments
Prasad Khandekar at 11-Mar-13 6:07am
   
REST services generally returns the data and this data (XML/JSON) is used by the caller to render the UI. In your scenario it seems that your service is returning an HTML response, Which I believe is returned by your PHP page to the client. For this scheme to work correctly make sure that your HTML response is using relative names for css, js & images. Duplicate these static artifacts on your PHP site (Apache) it should work. Although this is not the correct way of using & implementing services.
 
Regards,
HOSTGUY at 11-Mar-13 6:14am
   
@prasad Thanks for your reply.. as am new to this webservice i dont know exactly how to implement it. Tell me how to send the request to the api to take control over the browser after verifying the request.
Prasad Khandekar at 24-Mar-13 14:23pm
   
Please have a look at JQuery API documentation. Their documentation contains some really nice examples. You can use a call something like $('#some_div').html(RESPONSE);. Here some_div is an id of a div in which you want to show the returned HTML. RESPONSE represents the response you have got.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 304
1 Sergey Alexandrovich Kryukov 255
2 Shweta N Mishra 216
3 Maciej Los 210
4 PIEBALDconsult 184
0 OriginalGriff 7,630
1 Sergey Alexandrovich Kryukov 7,022
2 DamithSL 5,586
3 Manas Bhardwaj 4,946
4 Maciej Los 4,525


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100