当前位置:编程学习 > C#/ASP.NET >>

Java 与 .NET 的基于 WS-Security的Web Services集成实现(下)

Java 与 .NET 的基于 WS-Security的Web Services集成实现(下)
rottenapple
4. 打开Jbuilder9 ,新建一个java 类,命名为TestNetService。并将axis-wsse-1.0的jar包添加到Jbuilder的jdk中(Tools->configions jdks->class tab->add)代码如下:
package MyWebServiceJavaClient;
import java.util.Date;
import java.text.DateFormat;
import org.apache.axis.MessageContext;
import org.apache.axis.message.*;
import org.apache.axis.client.*;
import org.apache.axis.utils.*;
import javax.xml.namespace.QName;
import java.lang.Integer;
import javax.xml.rpc.ParameterMode;
import net.vitale.filippo.axis.handlers.WsseClientHandler;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2004</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/

public class TestNetService {
static String usernameS = null;
static String passwordS = null;
public TestNetService() {
}

public static void main(String[] args) {
try {
Integer i = new Integer(2);
Integer j = new Integer(2);
String endpoint="http://localhost/MyServices/WebServiceTest/SumService.asmx";

Service service = new Service();
Call call = (Call)service.createCall();

call.setTargetEndpointAddress(new java.net.URL(endpoint));
补充:asp.net教程,WebService
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,