java - Calling Axis webservice from jquery -
i call axis webservice using following code
var wsurl = "http://localhost:8080/testserv/services/testcls?wsdl"; var soapreq = "<soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cod=\"http://codon.com\">+"<soapenv:header/>"+"<soapenv:body>"+"<cod:testmethod>"+"<cod:name>hai</cod:name>"+"</cod:testmethod>"+"</soapenv:body>"+"</soapenv:envelope>"; var soapaction = "http://codon.com/testmethod"; jquery.support.cors = true; $.ajax({ type: "post", url: wsurl, contenttype: 'text/xml; charset=utf-8' , datatype: "xml", data: soapreq , soapaction: soapaction, //async: false, //processdata: false, crossdomain: true, success: processsuccess, error: processerror }); but getting following error @ weservice side...
may 10, 2013 12:18:52 pm org.apache.axis.transport.http.axisservlet getsoapaction severe: generating fault class axisfault faultcode: {http://xml.apache.org/axis/}client.nosoapaction faultsubcode: faultstring: no soapaction header! faultactor: faultnode: faultdetail: {http://xml.apache.org/axis/}stacktrace:no soapaction header! @ org.apache.axis.transport.http.axisservlet.getsoapaction(axisservlet.java:1013) @ org.apache.axis.transport.http.axisservlet.dopost(axisservlet.java:678) @ javax.servlet.http.httpservlet.service(httpservlet.java:637) @ org.apache.axis.transport.http.axisservletbase.service(axisservletbase.java:327) @ javax.servlet.http.httpservlet.service(httpservlet.java:717) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:290) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:233) @ but sending soapaction header also.. please me out..thanks in advance
working code
//webservice calling var xmlhttp = new xmlhttprequest(); var wsurl = "http://localhost:8080/webser/services/emailclient?wsdl"; xmlhttp.open('post', wsurl, false); var soapaction = "http://codon.com/login"; // available in wsdl file var soaprequest = "<soapenv:envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:cod=\"http://codon.com\">"+"<soapenv:header xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\"/>"+"<soapenv:body>"+"<cod:login>"+"<acc_name>"+account+"</acc_name>"+"<uname>"+username+"</uname>"+"<pass>"+pwd+"</pass>"+"</cod:login>"+"</soapenv:body>"+"</soapenv:envelope>"; // soap ui tool xmlhttp.onreadystatechange = function () { if (xmlhttp.readystate == 4) { if (xmlhttp.status == 200) { } // send post request xmlhttp.setrequestheader('content-type', 'text/xml'); xmlhttp.setrequestheader('soapaction', soapaction); xmlhttp.send(soaprequest);
Comments
Post a Comment