Connecting Tech Pros Worldwide Help | Site Map

Calling .Net web service from my JSP page

Newbie
 
Join Date: Jul 2007
Posts: 10
#1: Jul 10 '07
Hi,

I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user hit login button, my Action class will validate the user information and send his information to the other site by calling .Net web service, so the other site can extract these information. So, in my jsp, I am using Javascript and webservice.htc to call .Net web service method. I am using Oracle 10g Jdeveloper. The whole works smoothly on my local computer. However, when I deploy them on our test server. I always get "service unavailabe" error. We are on Unix system, J2ee enviroment, with Oracle application server as web server.

Here is part of my JSP page. By the way, webservice.htc is in the same directory as this JSP.
Expand|Select|Wrap|Line Numbers
  1. <%@ page contentType="text/html;charset=windows-1252"%>
  2. <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
  3. <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
  4. <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
  5.  
  6.  
  7. <html:html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  10.  
  11. <TITLE>ExpressPlus</TITLE>
  12. </head>
  13.  
  14. <%
  15. String userid = request.getParameter("userid");
  16. String firstname = request.getParameter("firstname");
  17. String lastname = request.getParameter("lastname");
  18.  
  19. %>
  20.  
  21. <script language="JavaScript">
  22. <!--
  23. var iCallID = 0;
  24. var userid = "<%=userid%>";
  25. var firstname="";
  26. var lastname="";
  27.  
  28. function loadService() {
  29.  
  30.  explusService.useService("http://www.mytest.com/Login_service.asmx?wsdl","pushData");
  31.  iCallID = explusService.pushData.callService(explusResults,"Push_Data",userid,firstname,lastname);
  32.  
  33.   }
  34.  
  35.  
  36. function explusResults(result) {
  37.  
  38.    if (iCallID == result.id)
  39.    {
  40.       if (result.error)
  41.       {
  42.         var xfaultcode = result.errorDetail.code;
  43.         var xfaultstring = result.errorDetail.string;
  44.         var xfaultsoap = result.errorDetail.raw;
  45.           alert ("fault: " + xfaultcode + ": " + xfaultstring + ": "+ xfaultsoap) 
  46.       }
  47.       else {
  48.         alert("result: " + result.value);
  49.              }   }
  50. }
  51.  
  52. //-->
  53.  
  54. </script>
  55. <body onload="loadService()" >
  56.  
  57. <div ID="explusService" style="behavior:url(<%=request.getContextPath()%>/explus/webservice.htc)">
  58.  
  59. </div>
  60. </body>
  61. </html:html>
Please help. It is kind of urgent.

Thank you very much in advance.
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#2: Jul 11 '07

re: Calling .Net web service from my JSP page


Since the code works properly on your development machine, I am going to rule out a coding error. This leaves open two options in my mind, configuration and networking.
What is the physical topology of your network? I'm looking for information about the dev box, the test box, and the webservice box.
Are there any differences between your development machine and your test machine? Are the application servers configured identically?
Is there a firewall in place? Are the computers (test and webservice) on the same subnet?
Newbie
 
Join Date: Jul 2007
Posts: 10
#3: Jul 11 '07

re: Calling .Net web service from my JSP page


Hi,

Thanks for your reply.

After intensive internet searching, I think I know the problem. We are facing cross domain issue when using Web service behavior, because .Net webservice is hosted on ISS server. My web page is on oracle application server. We have different domain. I need to create proxy web service to make these two servers talk.

Do you have any sample code for this?

Thank you very much.
Motoma's Avatar
Moderator
 
Join Date: Jan 2007
Location: Maine, USA
Posts: 2,904
#4: Jul 11 '07

re: Calling .Net web service from my JSP page


Quote:

Originally Posted by gengyue

Hi,

Thanks for your reply.

After intensive internet searching, I think I know the problem. We are facing cross domain issue when using Web service behavior, because .Net webservice is hosted on ISS server. My web page is on oracle application server. We have different domain. I need to create proxy web service to make these two servers talk.

Do you have any sample code for this?

Thank you very much.

You shouldn't need an application proxy. Talk to your network guys and explain the problem. They will likley have a different, easier solution for you.
Newbie
 
Join Date: Oct 2009
Posts: 1
#5: Oct 9 '09

re: Calling .Net web service from my JSP page


Hi,

My web service is on one server and jsp page is on other server. So i cant access web service using webservice.htc file.Also i need it to call in mozilla. So i dont know about proxy cration and how to call from proxy.So can anybody tell steps how to call web service in javascript(jsp) using roxy


Thanks,

Mahendra
Reply