隨筆 - 119  文章 - 3173  trackbacks - 0
          <2007年6月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          1234567

          交友莫獨(dú)酒,茅臺(tái)西鳳游。
          口干古井貢,心徜洋河流。
          稱多情杜康,趟無(wú)量雙溝。
          贊中華巍巍,無(wú)此不銷愁。

          常用鏈接

          留言簿(68)

          隨筆分類(136)

          隨筆檔案(122)

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 526946
          • 排名 - 92

          最新評(píng)論

          import ?java.io.IOException;
          import ?java.net.InetSocketAddress;
          import ?java.util.concurrent.ExecutorService;
          import ?java.util.concurrent.Executors;

          import ?javax.xml.ws.Endpoint;

          import ?com.sun.net.httpserver.HttpContext;
          import ?com.sun.net.httpserver.HttpServer;

          public ? class ?HttpServerTestService?{

          ????
          public ? static ? void ?main(String[]?args)?{
          ????????
          try ?{
          ????????????
          ????????????HttpServer?server?
          = ?HttpServer.create( new ?InetSocketAddress( 8888 ),? 0 );
          ????????????ExecutorService?threads??
          = ?Executors.newFixedThreadPool( 10 );
          ????????????server.setExecutor(threads);
          ????????????server.start();
          ????????????Endpoint?endpoint?
          = ?Endpoint.create( new ?Hello());//響應(yīng)類
          ????????????HttpContext?context?
          = ?server.createContext( " /hello " );//發(fā)布URL
          ????????????endpoint.publish(context);
          ????????}?
          catch ?(IOException?ioe)?{
          ????????????ioe.printStackTrace();
          ????????}
          ????}


          }

          import ?javax.jws.WebMethod;
          import ?javax.jws.WebService;
          import ?javax.jws.soap.SOAPBinding;

          @WebService(targetNamespace?
          = ? " http://jdk.study.hermit.org/client " )
          @SOAPBinding(style?
          = ?SOAPBinding.Style.RPC)
          public ? class ?Hello?{
          ????@WebMethod
          ????
          public ?String?sayHello(String?name)?{
          ????????
          return ? " hello: " ? + ?name;
          ????}
          }


          訪問(wèn):http://127.0.0.1:8888/hello?wsdl
          ??<?xml?version="1.0"?encoding="UTF-8"??>?
          -?
          <definitions?xmlns="http://schemas.xmlsoap.org/wsdl/"?xmlns:tns="http://jdk.study.hermit.org/client"?xmlns:xsd="http://www.w3.org/2001/XMLSchema"?xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"?targetNamespace="http://jdk.study.hermit.org/client"?name="HelloService">
          ??
          <types?/>?
          -?
          <message?name="sayHello">
          ??
          <part?name="arg0"?type="xsd:string"?/>?
          ??
          </message>
          -?
          <message?name="sayHelloResponse">
          ??
          <part?name="return"?type="xsd:string"?/>?
          ??
          </message>
          -?
          <portType?name="Hello">
          -?
          <operation?name="sayHello"?parameterOrder="arg0">
          ??
          <input?message="tns:sayHello"?/>?
          ??
          <output?message="tns:sayHelloResponse"?/>?
          ??
          </operation>
          ??
          </portType>
          -?
          <binding?name="HelloPortBinding"?type="tns:Hello">
          ??
          <soap:binding?style="rpc"?transport="http://schemas.xmlsoap.org/soap/http"?/>?
          -?
          <operation?name="sayHello">
          ??
          <soap:operation?soapAction=""?/>?
          -?
          <input>
          ??
          <soap:body?use="literal"?namespace="http://jdk.study.hermit.org/client"?/>?
          ??
          </input>
          -?
          <output>
          ??
          <soap:body?use="literal"?namespace="http://jdk.study.hermit.org/client"?/>?
          ??
          </output>
          ??
          </operation>
          ??
          </binding>
          -?
          <service?name="HelloService">
          -?
          <port?name="HelloPort"?binding="tns:HelloPortBinding">
          ??
          <soap:address?location="http://127.0.0.1:8888/hello"?/>?
          ??
          </port>
          ??
          </service>
          ??
          </definitions>
          posted on 2007-06-22 14:21 交口稱贊 閱讀(1684) 評(píng)論(1)  編輯  收藏 所屬分類: Java6

          FeedBack:
          # re: 學(xué)習(xí)Java6(十)HttpServer(3)與web service 2007-06-24 22:33 search-computer
          good....  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 阿坝| 丹巴县| 绍兴县| 民丰县| 宜兰市| 来宾市| 宜阳县| 黄骅市| 三门县| 钟山县| 天水市| 罗田县| 遂宁市| 广宁县| 衡南县| 梅州市| 砀山县| 宣恩县| 惠安县| 淮北市| 收藏| 乌鲁木齐县| 万安县| 长子县| 彭州市| 临武县| 鸡西市| 南江县| 漠河县| 攀枝花市| 沭阳县| 麻城市| 尼玛县| 东乌珠穆沁旗| 贵州省| 贡觉县| 思茅市| 中西区| 阜新| 河津市| 东乌珠穆沁旗|