calling .Net web service from JSP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gengyue
    New Member
    • Jul 2007
    • 10

    #1

    calling .Net web service from JSP

    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.

    <%@ page contentType="te xt/html;charset=wi ndows-1252"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>


    <html:html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <TITLE>ExpressP lus</TITLE>
    </head>

    <%
    String userid = request.getPara meter("userid") ;
    String firstname = request.getPara meter("firstnam e");
    String lastname = request.getPara meter("lastname ");

    %>

    <script language="JavaS cript">
    <!--
    var iCallID = 0;
    var userid = "<%=userid% >";
    var firstname="";
    var lastname="";

    function loadService() {

    explusService.u seService("http ://www.mytest.com/Login_service.a smx?wsdl","push Data");
    iCallID = explusService.p ushData.callSer vice(explusResu lts,"Push_Data" ,userid,firstna me,lastname);

    }


    function explusResults(r esult) {

    if (iCallID == result.id)
    {
    if (result.error)
    {
    var xfaultcode = result.errorDet ail.code;
    var xfaultstring = result.errorDet ail.string;
    var xfaultsoap = result.errorDet ail.raw;
    alert ("fault: " + xfaultcode + ": " + xfaultstring + ": "+ xfaultsoap)
    }
    else {
    alert("result: " + result.value);
    } }
    }

    //-->

    </script>
    <body onload="loadSer vice()" >

    <div ID="explusServi ce" style="behavior :url(<%=request .getContextPath ()%>/explus/webservice.htc) ">

    </div>
    </body>
    </html:html>

    Please help. It is kind of urgent.

    Thank you very much in advance.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Can you explain how you're deploying it and at stage you're getting the error?

    Comment

    • gengyue
      New Member
      • Jul 2007
      • 10

      #3
      Hi,

      I am just adding this new feature to an existing struts application, so I just copy all related files, including JSP, action form class, action class and modified struts-config.xml to different directories ( I can access test server from my local machine) . Finally, I restarted the server.

      The validation part is successful, which means struts part is no problem. In action class, it forwards page to the JSP, which calls web service. Then the screen brings up alert message box and tells me service unavaliable. the value is null.

      Thank you.

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by gengyue
        Hi,

        I am just adding this new feature to an existing struts application, so I just copy all related files, including JSP, action form class, action class and modified struts-config.xml to different directories ( I can access test server from my local machine) . Finally, I restarted the server.

        The validation part is successful, which means struts part is no problem. In action class, it forwards page to the JSP, which calls web service. Then the screen brings up alert message box and tells me service unavaliable. the value is null.

        Thank you.
        I know you'll think I'm an idiot but have you made sure that the .NET webservice is running?

        Comment

        • gengyue
          New Member
          • Jul 2007
          • 10

          #5
          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 IIS 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.

          Comment

          Working...