zoukankan      html  css  js  c++  java
  • webservice的soap

    1.soap的定义:

     2.使用TCP/IP Monitor监视Soap协议

     eclipse工具,show view-->other-->debug-->TCP/IP Monitor

     

     

     

     

     

     

     2.4

     

     

     

    2.5 客户端代码:

    package com.client;

    import java.net.URL;
    import javax.xml.namespace.QName;
    import javax.xml.ws.Service;

    import com.test.WeatherInterfaceImpl;

    public class Client2 {
    public static void main(String[] args) throws Exception {
    //服务的地址
    URL url=new URL("http://127.0.0.1:54321/weather?wsdl");
    //定义qname,第一个参数是命名空间,第二个参数是wsdl里边的服务名
    QName qName=new QName("http://server.com/","WeatherInterfaceImplService");
    //创建服务视图
    Service service=Service.create(url,qName);
    //得到服务端点
    WeatherInterfaceImpl weatherInterfaceImpl=service.getPort(WeatherInterfaceImpl.class);

    //通过服务端点调用服务方法
    String result=weatherInterfaceImpl.queryWeather("郑州");
    System.out.println(result);

    }
    }

    2.6运行看TCP/IP Monitor的监测窗口内容

     请求:

     响应:

     3.报错信息

    http://127.0.0.1:54321/weather?wsdl无法访问,原因是monitor没有启动

  • 相关阅读:
    JSP一个简单的项目实现教程
    多个Excel文件快速导入到DB里面
    NotePad++左侧导航
    简单实用JSTL标签库
    Eclipse导入现有项目
    Java工具Eclipse
    winform窗体只能放大不能缩小
    ref out

    数组
  • 原文地址:https://www.cnblogs.com/curedfisher/p/11850606.html
Copyright © 2011-2022 走看看