zoukankan      html  css  js  c++  java
  • paip.myeclipse7 java webservice 最佳实践o228

    paip.myeclipse7  java webservice 最佳实践o228

    java的ws实现方案:jax-ws>>xfire

    ws的测试工具  webservice测试调用工具WebserviceStudio20

    作者Attilax  艾龙,  EMAIL:1466519819@qq.com
    来源:attilax的专栏
    地址:http://blog.csdn.net/attilax

     /

    1. 创建一个 webService 工程。

    2. 创建一个普通 Java 类(做为bean class)

    3. 创建 webService 服务端,选择才讲的bean来创建ws,生成代理类

    package com.hmw.jaxws;

    @javax.jws.WebService(targetNamespace ="http://jaxws.hmw.com/", serviceName = "HelloJaxwsService",portName = "HelloJaxwsPort", wsdlLocation ="WEB-INF/wsdl/HelloJaxwsService.wsdl")

    public class HelloJaxwsDelegate {

             com.hmw.jaxws.HelloJaxwshelloJaxws = new com.hmw.jaxws.HelloJaxws();

             publicString sayHello(String userName) {

                       returnhelloJaxws.sayHello(userName);

             }

             publicint add(int i, int j) {

                       returnhelloJaxws.add(i, j);

             }

    }

    /imServer/WebRoot/WEB-INF/sun-jaxws.xml

    <?xmlversion = "1.0"?>

    <endpointsversion="2.0"

        xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime">

        <endpointname="HelloJaxwsPort"

           implementation="com.hmw.jaxws.HelloJaxwsDelegate"

           url-pattern="/HelloJaxwsPort">

        </endpoint></endpoints>

     

     

    4. 导入相关的 jar 包(jax-ws)

    add lib >> my eclipse lib>>jax-ws  lib

    5.访问url

    http://localhost:8080/imServer/HelloJaxwsPort

    显示

    Web Services

    Endpoint

    Information

    Service Name:

    {http://jaxws.hmw.com/}HelloJaxwsService

    Port Name:

    {http://jaxws.hmw.com/}HelloJaxwsPort

    Address:

    http://localhost:8080/imServer/HelloJaxwsPort

    WSDL:

    http://localhost:8080/imServer/HelloJaxwsPort?wsdl

    Implementation class:

    com.hmw.jaxws.HelloJaxwsDelegate

    6.access wdsl    http://localhost:8080/imServer/HelloJaxwsPort?wsdl

    7. 测试使用工具

    参考:

    MyEclipse 8.6 创建 jax-ws 的详细步骤(有截图) - 旺仔专栏 - 博客频道 -CSDN.NET.htm

    Web Service测试工具小汇 - oscarxie - 博客园

  • 相关阅读:
    无限维
    黎曼流形
    why we need virtual key word
    TOJ 4119 Split Equally
    TOJ 4003 Next Permutation
    TOJ 4002 Palindrome Generator
    TOJ 2749 Absent Substrings
    TOJ 2641 Gene
    TOJ 2861 Octal Fractions
    TOJ 4394 Rebuild Road
  • 原文地址:https://www.cnblogs.com/attilax/p/15199307.html
Copyright © 2011-2022 走看看