Server-Side Instructions
You need to ensure that the server classpath contains all of the above components. In addition, to implement services in scripting languages (such as the calculator sample), add bsf.jar from BSF and js.jar from Rhino to your classpath.Testing Your Server-Side Installation
Point your browser to:http://localhost:port/soap/servlet/rpcrouter andhttp://localhost:port/soap/servlet/messagerouter where port is 8080, or 4040, or whatever port your particular HTTP server is listening on. The browser should display the following:SOAP (RPC|Message) Router
Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me. If you don't see this message, your server is not configured correctly. 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A servlet deployment properties file with this modification would look like the following:
      <context-param>
        <param-name>ConfigFile</param-name>
        <param-value>config-file</param-value>
      </context-param>
      <servlet>
        <servlet-name>rpcrouter</servlet-name>
        <display-name>Apache-SOAP RPC Router</display-name>
        <description>no description</description>
        <servlet-class>
            org.apache.soap.server.http.RPCRouterServlet
        </servlet-class>
        <init-param>
          <param-name>faultListener</param-name>
          <param-value>org.apache.soap.server.DOMFaultListener</param-value>
        </init-param>
        <init-param>
          <param-name>ConfigFile</param-name>
          <param-value>config-file</param-value>
        </init-param>
      </servlet>
where config-file is the path (either fully qualified or relative) and filename of the SOAP configuration file===============================
Most of the samples have README files which describe their usage. Many also have batch files (testit.cmd and testit.sh) that will deploy and run the demos for you; these batch files assume your soap server is available at http://localhost:8080. Please see the directory each sample is contained in for the README files and for the "testit" batch files.
=============================

解决方案 »

  1.   

    Managing Services
    Apache-SOAP provides an administration tool to manage services. There are two clients to service manager: an HTML one used via a browser and a command-line tool. NOTE: If you had previously deployed services to an older version of Apache-SOAP, then this version may not recognize those services because the class that was being serialized to represent services has changed since then.Running the Server Side Admin Tool to Manage Services
    With the Apache-SOAP Administration Tools it is possible to use a Web browser to deploy and un-deploy services and to review the list and the definitions of the services deployed on a given SOAP server. Point your browse to http://hostname:port/soap/admin (see above) and you will get 
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    the "Apache-SOAP Admin" screen with three options:Deploy to deploy a new service. 
    Un-deploy to remove a deployed service. 
    List shows the list of services currently deployed in the server. 
    The usage of these functions is immediate once one understands the nature of the information required for deploying a service. In the next section we describe this information. Service Deployment InformationWe review here the information that defines a deployed service. This information must be provided when using the Deploy function, and can be browsed using the List function. We refer to this information as "properties" of the service. ID. An URN uniquely identifies the service to clients. It must be unique among the deployed services, and be encoded as a URI. We commonly use the format: urn:UniqueServiceID . It corresponds to the target object ID, in the terminology of the SOAP specification. 
    Scope. Defines the lifetime of the object serving the invocation request. This corresponds scope attribute of the <jsp:useBean> tag in the JavaServer Pages. It may thus have the following possible values: 
    page: the object is available until the target JSP page (in this case the rpcrouter.jsp) sends a response back or the request is forwarded to another page (if you are using the standard deployment mechanism this is unlikely to happen). 
    request: the object is available for the complete duration of the request, regardless of forwarding. 
    session: the object is available for the complete duration of the session. 
    application: any page within the application may access the object. In particular, successive service invocations belonging to different sessions will share the same instance of the object. It is important to observe that the value of this attribute can have important security implications. The page and request scopes assure the isolation of successive calls. On the other extreme, application scope implies that all service objects are shared among different users of the SOAP server. A document describing usage scenarios for different scopes will be forthcoming. 
    Method list. Defines the names of the method that can be invoked on this service object. 
    Provider type. Indicates whether the service is implemented using Java, a scripting language, or a user-defined provider. If you are using a user-defined provider, then you also need to specify the fully qualified class name of the provider, as well as any options (key/value pairs) that you wish to pass to it. 
    For Java services, Provider class. Fully specified class name of the target object servicing the request. 
    For Java services, Use static class. If set to "Yes" the class method that is made available is a static method, and thus no object will be instantiated. When static invocation is used, the "scope" property is not applicable. 
    For script services, Script language. Indicates the scripting language used to implement the service. 
    For script services, Script filename. Name of file containing the script, or 
    For script services, Script. The actual script to run. 
    Type mappings. In order to control the serialization and deserialization of specific Java types to and from XML in a particular encoding style, it may be necessary to provide serialization and deserialization classes that know how to perform the correct conversions for those types. The Apache-SOAP server already includes serialization classes for most basic types in the SOAP encoding style, as well as a Bean encoding class that can provide a generic serialization of a bean in terms of its properties. It also includes XMI serializer/deserializer classes to support the XMI encoding style. Since different types may require additional support for correct serialization, the Apache-SOAP maintains a registry of Serializers and Deserializers. The registry is accessible to service administrators through the Apache-SOAP administration tool, as well as through a program API. In order to register a (de)serializer class, the class must implement the Serializer or Deserializer interfaces, see JavaDocs for org.apache.soap.util.xml.Serializer and com.org.apache.soap.util.Deserializer . 
    Default Mapping Registry. Fully-qualified classname of a customized registry that will manage the serializer/deserializers for the service. Must be a subclass of org.apache.soap.encoding.SOAPMappingRegistry. In the XML deployment descriptor, this can be specified in a "defaultRegistryClass" attribute of the "isd:mappings" element 
    Using the Command Line Tool to Manage Services
    The command line tool is run by typing java org.apache.soap.server.ServiceManagerClient. Running this yields:% java org.apache.soap.server.ServiceManagerClient
    Usage: java org.apache.soap.server.ServiceManagerClient [-auth username:password] url operation arguments
    where
            username and password is the HTTP Basic authentication info
            url is the Apache SOAP router's URL whose services are managed
            operation and arguments are:
                    deploy deployment-descriptor-file.xml
                    list
                    query service-name
                    undeploy service-nameTo deploy a service, for example, type:% java org.apache.soap.server.ServiceManagerClient http://hostname:port/soap/servlet/rpcrouter deploy foo.xml
      

  2.   

    首先把soap目录下的soap.jar文件放在tomcat目录的common\lib目录下
    再把mail.jar、activation.jar文件放在tomcat的common\lib目录下(这两各文件我是在jbuilder的lib目录下找到的)
    之后再次启动tomcate输入http://172.16.1.113:8080/soap/servlet/rpcrouter显示内容如下:
    SOAP RPC Router
    Sorry, I don't speak via HTTP GET- you have to use HTTP POST to talk to me.
    但有两点我不明白,
    一、按照http://ws.apache.org/soap/docs/index.html上的说明应该把JAXP路径放入tomcat中,但我没加该包也可以运行。不知道是不是其他包中包含了JAXP包?
    二、Server-Side Instructions
    You need to ensure that the server classpath contains all of the above components. In addition, to implement services in scripting languages (such as the calculator sample), add bsf.jar from BSF and js.jar from Rhino to your classpath.这句话做何解释?
    请知道的人为我讲解下,谢谢!
      

  3.   

    apache soap 已停止开发,并已被axis取代。建议使用axis
      

  4.   

    是啊。偶也在研究这个axis,挺好,还没有深入进去,不知道它的性能怎么样
      

  5.   

    晕晕,apache soap已经停止开发了?
      

  6.   

    Apache SOAP的Web Services在Tomcat上的初体验:安装和测试下载:
    Apache SOAP http://xml.apache.org/soap/index.html
    Tomcat http://jakarta.apache.org/1、解压Apache SOAP到%ApacheSOAP%,如:F:\OpenSource\SOAP2、安装Tomcat到%Tomcat%,如:F:\Program Files\Apache Group\Tomcat3、复制%ApacheSOAP%\webapps\soap.war文件到%Tomcat%\webapps目录下4、启动Tomcat,此时Tomcat自动将soap.war解压了5、在%Tomcat%\webapps\soap\WEB-INF\classes建立测试文件HelloSOAPClient.java、HelloSOAP.java,源码附后6、编译,进入%Tomcat%\webapps\soap\WEB-INF\classes目录
    javac -classpath .;%classpath%;F:\OpenSource\SOAP\lib\soap.jar *.java7、SOAP服务的发布
    使用IE浏览器浏览http://localhost:8080/soap/admin/index.html,进入Deploy,填写如下信息:
    ID: urn:hello.hellosoap
    Scope: Request
    Methods getWelcomeValue
    Provider Type: Java
    Java Provider Provider Class:  HelloSOAP
    Java Provider Static: NO
    确认发布,可以点List查看已发布服务
    Service Listing
    Here are the deployed services (select one to see details)urn:hello.hellosoap8、运行,java -classpath .;%classpath%;F:\OpenSource\SOAP\lib\soap.jar HelloSOAPClient
    可以看到返回值信息如下:
    SOAP调用测试开始
    Name:俞黎敏
    Result:欢迎光临SOAP:俞黎敏
    SOAP调用测试结束则证明配置和测试成功,以后就可以发布自己的SOAP服务了!9、删除服务Un-deploy之即可
    Un-Deploy a Service
    Select the service to be undeployed:urn:hello.hellosoap public class HelloSOAP
    {
        public String getWelcomeValue(String name)
        {
            String strResult = "欢迎光临SOAP:" + name;
            return strResult;
        }
    }import java.net.URL;
    import java.util.Vector;import org.apache.soap.Constants;
    import org.apache.soap.Fault;
    import org.apache.soap.rpc.Call;
    import org.apache.soap.rpc.Parameter;
    import org.apache.soap.rpc.Response;public class HelloSOAPClient
    {
        public static void main(String[] args) throws Exception
        {
            System.out.println("SOAP调用测试开始");
            String name = "俞黎敏";
            HelloSOAPClient helloSOAPClient = new HelloSOAPClient();
            //调用远程的SOAP服务
            String resultValue = helloSOAPClient.doSOAPRequest("hello.hellosoap","getWelcomeValue","name",name);
            System.out.println("Name:" + name);
            System.out.println("Result:" + resultValue);
            System.out.println("SOAP调用测试结束");
        }    public String doSOAPRequest(String _strURI,String _strMethodName,String _strName,String _strValue) throws Exception
        {
            //创建一个远程调用
            Call call = new Call();
            //设置远程对象的URI
            call.setTargetObjectURI("urn:" + _strURI);
            //设置调用的方法名
            call.setMethodName(_strMethodName);
            //设置编码风格
            call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
            //设置方法调用的参数
            Vector params = new Vector();
            params.addElement(new Parameter(_strName,String.class,_strValue,null));
            call.setParams(params);
            //发送RPC请求,请查看webapps\soap\web.xm,就知道rpcrouter是映射到org.apache.soap.server.http.RPCRouterServlet这个类
            Response resp = call.invoke(new URL("http://localhost:8080/soap/servlet/rpcrouter"),"");
            if(resp.generatedFault())
            {
                //远程调用出错处理
                Fault fault = resp.getFault();
                System.out.println("调用失败!");
                System.out.println("错误代号:" + fault.getFaultCode());
                System.out.println("错误信息:" + fault.getFaultString());
                return "调用失败!";
            }
            else
            {
                //调用成功,获取返回值
                Parameter result = resp.getReturnValue();
                return result.getValue().toString();
            }
        }
    }
      

  7.   

    楼上的大虾:
    我把那代码拿下来,没跑过去
    SOAP服务发布成功,
    但是执行java HelloSOAPClient时报如下错误:
    SOAP调用测试开始
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/MessagingE
    xception
            at HelloSOAPClient.doSOAPRequest(HelloSOAPClient.java:27)
            at HelloSOAPClient.main(HelloSOAPClient.java:18)
    相对应代码位置好像是doSOAPRequest()的调用那里。
    是因为少了哪个包吗?
      

  8.   

    运行,java -classpath .;%classpath%;F:\OpenSource\SOAP\lib\soap.jar HelloSOAPClient