當前位置:首頁 » 操作系統 » ws信用源碼

ws信用源碼

發布時間: 2024-12-07 18:55:11

『壹』 C++ 如何隱藏窗口在任務欄的顯示 WS_EX_TOOLWINDOW沒解決問題 求點源碼

對話框還是一般窗口?

『貳』 java調用webservice例子

現在大多數項目都會用到spring,所以選擇 CXF 框架,cxf能很好的和spring結合


在官網下載最新版 xcf 3.0.3 網站 http://cxf.apache.org/


MyEclipse項目結構圖


結構圖中各個文件源碼

HelloWorldImpl.java

---------

import javax.jws.WebService;


@WebService(endpointInterface = "IHelloWorld", serviceName = "HelloWorld")

public class HelloWorldImpl implements IHelloWorld {

@Override

public String sayHello(String text) {

return "serviceSay: " + text;

}

}

------------------------------------------------------------------------------------------------



IHelloWorld.java

---------

import javax.jws.WebService;


@WebService

public interface IHelloWorld {

public String sayHello(String text);

}

------------------------------------------------------------------------------------------------


Test.java

---------

import org.apache.cxf.endpoint.Client;

import org.apache.cxf.endpoint.dynamic.DynamicClientFactory;


public class Test {

public static void main(String[] args) throws Exception {

DynamicClientFactory dcf = DynamicClientFactory.newInstance();

Client c = dcf.createClient("http://localhost:8080/cxf/ws/hwUrl?wsdl");

Object[] param = new Object[] { "----test....." };

Object[] result = c.invoke("sayHello", param);

System.out.println(result[0].toString());

}


}

------------------------------------------------------------------------------------------------



cxf-servlet.xml

-----------------

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"

xmlns:soap="http://cxf.apache.org/bindings/soap"

xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">

<jaxws:server id="hwService" serviceClass="IHelloWorld"

address="/hwUrl">

<jaxws:serviceBean>

<bean class="HelloWorldImpl" />

</jaxws:serviceBean>

</jaxws:server>

</beans>

------------------------------------------------------------------------------------------------


web.xml

---------

<?xml version="1.0" encoding="UTF-8"?>

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

<display-name></display-name>

<welcome-file-list>

<welcome-file>index.jsp</welcome-file>

</welcome-file-list>

<servlet>

<servlet-name>cxfS</servlet-name>

<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>cxfS</servlet-name>

<url-pattern>/ws/*</url-pattern>

</servlet-mapping>

</web-app>

------------------------------------------------------------------------------------------------



部署項目,然後運行Test.java

在瀏覽器裡面輸入http://localhost:8080/cxf/ws/hwUrl?wsdl 可查看webservice服務介面信息

熱點內容
linuxpython界面 發布:2025-03-10 11:06:38 瀏覽:574
安卓對蘋果怎麼傳通訊錄 發布:2025-03-10 10:47:11 瀏覽:403
十周年源碼 發布:2025-03-10 10:42:09 瀏覽:239
安卓手機內存卡怎麼解決 發布:2025-03-10 10:39:39 瀏覽:964
雲引擎雲伺服器 發布:2025-03-10 10:39:39 瀏覽:672
安卓部落沖突怎麼加好友 發布:2025-03-10 10:38:06 瀏覽:151
如何查詢伺服器的sn 發布:2025-03-10 10:36:40 瀏覽:588
為什麼越來越多人從蘋果轉向安卓 發布:2025-03-10 10:28:08 瀏覽:105
php正則結尾 發布:2025-03-10 10:19:57 瀏覽:780
影音先鋒在線腳本 發布:2025-03-10 10:10:51 瀏覽:421