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

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

          常用鏈接

          留言簿(68)

          隨筆分類(lèi)(136)

          隨筆檔案(122)

          最新隨筆

          搜索

          •  

          積分與排名

          • 積分 - 526712
          • 排名 - 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)類(lèi)
          ????????????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 交口稱(chēng)贊 閱讀(1683) 評(píng)論(1)  編輯  收藏 所屬分類(lèi): Java6

          FeedBack:
          # re: 學(xué)習(xí)Java6(十)HttpServer(3)與web service 2007-06-24 22:33 search-computer
          good....  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 石阡县| 闵行区| 锡林浩特市| 曲沃县| 洛浦县| 和田市| 车致| 沁阳市| 克山县| 江陵县| 诸暨市| 连云港市| 绥江县| 岐山县| 柳江县| 昂仁县| 涞源县| 博乐市| 台北县| 玉林市| 慈利县| 农安县| 赣榆县| 合作市| 民乐县| 阳江市| 郧西县| 乐亭县| 玛纳斯县| 全椒县| 黄浦区| 长顺县| 武邑县| 自贡市| 红桥区| 尤溪县| 博爱县| 玉山县| 乌海市| 马公市| 柳州市|