axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Kumar K <sand...@genevasoftech.com>
Subject NoSOAPAction Error...!!!
Date Thu, 12 Jun 2008 04:37:39 GMT
I am trying to develop a simple SOAP application using Axis.

I deployed axis in Apache Tomcat 6.

My Server code is : *MessageService.jws
*(I have copied this file in CATALIA_HOME\webapps\axis folder).*
*import org.w3c.dom.Element;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPElement;

public class MessageService
{
    public Element[] echoElements(Element [] elems)
    {
        return elems;
    }
   
    public void process(SOAPEnvelope req, SOAPEnvelope resp) throws 
javax.xml.soap.SOAPException
    {
        try
        {
            SOAPBody body = resp.getBody();
            System.out.println("\n\n");
            System.out.println(body);
            System.out.println("\n\n");
            Name ns0 =  resp.createName("TestNS0", "ns0", 
"http://example.com");
            Name ns1 =  resp.createName("TestNS1", "ns1", 
"http://example.com");
            SOAPElement bodyElmnt = body.addBodyElement(ns0);
            SOAPElement el = bodyElmnt.addChildElement(ns1);
            el.addTextNode("TEST RESPONSE");
        }
        catch(Exception exp)
        {
            exp.printStackTrace();
        }
    }
}

And Client Code is : *TestClient.java

*import java.io.ByteArrayInputStream;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;
import javax.xml.soap.SOAPConnection;
import javax.xml.soap.MimeHeaders;
import javax.xml.soap.SOAPConnectionFactory;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPBody;

public class TestClient
{
    public static void main(String [] args)
    {
        try
        {
            String        xmlString        =    "<?xml version=\"1.0\" 
encoding=\"UTF-8\"?>\n" +
                                            "<soapenv:Envelope 
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
                                            "                   
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
                                            "                   
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
                                            " <soapenv:Header>\n" +
                                            "  <shw:Hello 
xmlns:shw=\"http://localhost:8080/axis/MessageService.jws\">\n" +
                                            "    
<shw:Myname>Tony</shw:Myname>\n" +
                                            "  </shw:Hello>\n" +
                                            " </soapenv:Header>\n" +
                                            " <soapenv:Body>\n" +
                                            "  <shw:process 
xmlns:shw=\"http://localhost:8080/axis/MessageService.jws\">\n" +
                                            "    
<shw:City>GENT</shw:City>\n" +
                                            "  </shw:process>\n" +
                                            " </soapenv:Body>\n" +
                                            "</soapenv:Envelope>";
           
            MessageFactory    mf            =    
MessageFactory.newInstance();
            SOAPMessage        smsg        =    mf.createMessage(new 
MimeHeaders(), new ByteArrayInputStream(xmlString.getBytes()));
            SOAPPart        sp            =    smsg.getSOAPPart();
            SOAPEnvelope    se            =    
(SOAPEnvelope)sp.getEnvelope();
           
            SOAPConnection    conn        =    
SOAPConnectionFactory.newInstance().createConnection();
            SOAPMessage        response    =    conn.call(smsg, 
"http://localhost:8080/axis/MessageService.jws");
           
            System.out.println("Response : " + response.getSOAPBody());
         }
        catch (Exception e)
        {
            System.err.println(e.toString());
        }
    }
}

And when I try to execute the program I am getting this Exception in 
Tomcat Console

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:710)
        at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        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:175)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        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:263)
        at 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
        at 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
        at 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
        at java.lang.Thread.run(Unknown Source)
        {http://xml.apache.org/axis/}hostname:GSPCW046
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:710)
        at 
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        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:175)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        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:263)
        at 
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
        at 
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
        at 
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
        at java.lang.Thread.run(Unknown Source)


Help Needed.

*-- 
Thanks & Regards
Sandeep Kumar K
Sr. Software Engineer
Geneva Software Technologies Limited,
# 82, Research Center II, I floor, EPIPA
Nallurhalli, Whitefield, Bangalore - 560066
Mob  :  +91-9880193454*


Mime
View raw message