当前位置:首页 » 操作系统 » 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服务接口信息

热点内容
安卓对苹果怎么传通讯录 发布: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
油猴万能脚本 发布:2025-03-10 10:09:10 浏览:445