How to call apache axis webservice using javascript for evothings app

Ask, and ye shall receive.
smad
Posts: 2
Joined: 12:38, 26 Mar 2015

How to call apache axis webservice using javascript for evothings app

Postby smad » 12:57, 26 Mar 2015

HI,

I want to call a webservice from my javascript code to get data from my service. I have tried this coding .


Code: Select all

var soapaction = "http://codon.com/login";
      
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>";
 
$.ajax({
      type: 'POST',
      dataType: 'xml',
      SOAPAction: soapaction,
      timeout: 3000,
      crossDomain: true,
      url: 'http://192.168.0.0:8080/WebSer/services/EmailClient?wsdl',
      data: soapRequest,
      success: function(data) {
         alert("=sss=");
      successFun(data) },
      error: function(a, err) { failFun(err) }
   });



but am getting the following exception stacktrace at my webservice server side.



Code: Select all

2015-03-26 16:18:23,893 ERROR - 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!
   at org.apache.axis.transport.http.AxisServlet.getSoapAction(AxisServlet.java:1013)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:678)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Unknown Source)

   {http://xml.apache.org/axis/}hostname:CHANDRAGIRI

no SOAPAction header!
   at org.apache.axis.transport.http.AxisServlet.getSoapAction(AxisServlet.java:1013)
   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:678)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Unknown Source)
   



Can you Give me an idea about this? Thanks in advance

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: How to call apache axis webservice using javascript for evothings app

Postby Fredrik » 13:14, 26 Mar 2015

Your server seems to require what it calls a "SOAPAction header". Your client code uses jquery ajax. A quick google search shows this page. It indicates that you should include this code among your ajax parameters:

Code: Select all

headers: {
    SOAPAction: soapaction,
},


I hope that helps.

smad
Posts: 2
Joined: 12:38, 26 Mar 2015

Re: How to call apache axis webservice using javascript for evothings app

Postby smad » 14:01, 26 Mar 2015

I have tried that one also


Code: Select all

 $.ajax({
      type: 'POST',
      dataType: 'xml',
      //SOAPAction: soapaction,
      timeout: 3000,
      //contentType: 'text/xml; charset=utf-8',
      crossDomain: true,
      url: 'http://192.168.0.119:8080/WebSer/services/EmailClient?wsdl',
      headers: {
            SOAPAction: soapaction
            },
      data: soapRequest,
      success: function(data) {
         alert("=sss=");
      successFun(data) },
      error: function(a, err) { failFun(err) }
   });




In this case even the server is not getting called by this code. Not getting any exception or result

Fredrik
Site Admin
Posts: 196
Joined: 15:00, 18 Nov 2013

Re: How to call apache axis webservice using javascript for evothings app

Postby Fredrik » 14:43, 26 Mar 2015

Sorry, I am now out of ideas. You need jQuery support. They suggest their forums or StackOverflow.


Return to “Questions and answers”

Who is online

Users browsing this forum: No registered users and 10 guests