Hi,

I have been trying to pass a parameter from a WML to a WMLScript for weeks now, using servlets. I always get the error 405 (method not allowed). Can anybody help? I have included the simple code below. The WML calls the Crypto.signText for digital signing.




import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;



public class Contract extends HttpServlet {


public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException {

PrintWriter out = res.getWriter();
res.setContentType("text/vnd.wap.wml");


out.println("<?xml version=\"1.0\"?>");
out.println("<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">");

out.println("<wml>");
out.println("<card id=\"Card1\" title=\"Confirm Order\" newcontext=\"true\">");

out.println("<do type=\"accept\" label=\"Sign\">");
out.println("<go href=\"Sign#getSignText($toBeSigned)\"/>");

out.println("</do>");

out.println("<p>");
out.println("Enter data to be signed: <input name=\"toBeSigned\"/>");
out.println("</p>");
out.println("</card>");

out.println("<card id=\"Card2\" title=\"SignedText\">");
out.println("<p>");
out.println("You wrote: <br/> $(RESULT)");

out.println("</p>");
out.println("</card>");
out.println("</wml>");

}
}


/*Script code is below*/


import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class Sign extends HttpServlet {


public void doPost(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {


PrintWriter out = response.getWriter();
response.setContentType("text/vnd.wap.wmlscript");


out.println("extern function getSignText(stringToSign) {");
out.println("var signature = Crypto.signText(stringToSign, 5, 0, '');");
out.println("var returnString = String.toString(signature);");
out.println("WMLBrowser.setVar('RESULT', returnString);");
out.println("WMLBrowser.go('Contract#Card2');}");


}

}