I have installed the Service sing AdminClient as follows

I have copied MessageService.class to : CATALINA_HOME/webapps/axis/WEB-INF/classes.

Then I copied deploy.wsdd & undeploy.wsdd to : CATALINA_HOME/webapps/axis/WEB-INF.

deploy.wsdd:
<deployment xmlns="http://xml.apache.org/axis/wsdd/ <http://xml.apache.org/axis/wsdd/>" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java <http://xml.apache.org/axis/wsdd/providers/java>">

<service name="MyService" provider="java:RPC">
 <parameter name="className" value="MessageService"/>
 <parameter name="allowedMethods" value="*"/>
</service>
</deployment>

undeploy.wsdd:
<undeployment xmlns="http://xml.apache.org/axis/wsdd/ <http://xml.apache.org/axis/wsdd/>">
<service name="MessageService"/>
</undeployment>

Step 1: java -cp %CATALINA_HOME%\lib\axis.jar;%CATALINA_HOME%\lib\jaxrpc.jar;%CATALINA_HOME%\lib\commons-logging-1.1.jar;%CATALINA_HOME%\lib\commons-discovery-0.2.jar;%CATALINA_HOME%\lib\activation.jar;%CATALINA_HOME%\lib\mail.jar; org.apache.axis.client.AdminClient deploy.wsdd Step 2 : REM java -cp %CATALINA_HOME%\lib\axis.jar;%CATALINA_HOME%\lib\jaxrpc.jar;%CATALINA_HOME%\lib\commons-logging-1.1.jar;%CATALINA_HOME%\lib\commons-discovery-0.2.jar;%CATALINA_HOME%\lib\activation.jar;%CATALINA_HOME%\lib\mail.jar; org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService <http://localhost:8080/axis/services/AdminService> deploy.wsdd

Now I am getting this Error :
SEVERE: SAAJ0008: Bad Response; /axis/MessageService
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (404/axis/MessageService

users.lst file contains :

   *user1 pass1*
   *user2 *
   *user3 pass3*


Should I have to specify anything in web.xml file??
Or is it the problem with the Web Service Deployment Descriptor (wsdd) ??

Here is my source Code :

Server Code : MessageService.java
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)
               {
                       System.out.println("Exception while receiving the 
request");
                       exp.printStackTrace();
               }
       }
}

Client Code : 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;
import javax.xml.soap.SOAPFactory;
import javax.xml.soap.Name;

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\";>\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\";>\n" +
                                                                           "    
<shw:City>GENT</shw:City>\n" +
                                                                           "  
</shw:process>\n" +
                                                                           " 
</soapenv:Body>\n" +
                                                                           
"</soapenv:Envelope>";
MessageFactory mf = MessageFactory.newInstance(); SOAPConnection conn = SOAPConnectionFactory.newInstance().createConnection();
                       MimeHeaders             h                       =       
new MimeHeaders();
                       SOAPMessage             smsg            =       
mf.createMessage(h, new ByteArrayInputStream(xmlString.getBytes()));
                       h.addHeader(Call.SOAPACTION_USE_PROPERTY, "true");
                       h.addHeader(Call.SOAPACTION_URI_PROPERTY, 
"http://localhost:8080/axis/MessageService";);
                       SOAPMessage             response        =       conn.call(smsg, 
"http://localhost:8080/axis/MessageService";);
                       System.out.println("Response : " + 
response.getSOAPBody());
               }
               catch (Exception e)
               {
                       System.err.println(e.toString());
               }
       }
}

Awaiting for your reply..

*-- 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*

Reply via email to