java 客户端调用gsoap_java客户端调用C++ GSoap生成的webservice

package com.test.webservice.client;

import java.rmi.RemoteException;

import javax.xml.namespace.QName;

import javax.xml.rpc.ServiceException;

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

public class TestClent {

public static void main(String[] args) {

try {

String endpoint = "http://www.cmsz.com:7088/getdbpwd/getdbpwdservice";

Service service = new Service();

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

call.setTargetEndpointAddress(endpoint);

call.setOperationName(new QName(

"urn:getdbpwd", "getdbpwd"));

call.addParameter( "pmsDBUser",null,javax.xml.rpc.ParameterMode.IN);

call.setReturnClass(String.class);

String temp = (String)call.invoke(new Object[]{"pubdba"});

System.out.println("result: " + temp);

} catch (ServiceException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (RemoteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

对应的WSDL 文件如下:

targetNamespace="http://www.cmsz.com:7088/getdbpwd/getdbpwd.wsdl"

xmlns:tns="http://www.cmsz.com:7088/getdbpwd/getdbpwd.wsdl"

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

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

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:ns="urn:getdbpwd"

xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"

xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"

xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"

xmlns="http://schemas.xmlsoap.org/wsdl/">

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"

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

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:ns="urn:getdbpwd"

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

elementFormDefault="unqualified"

attributeFormDefault="unqualified">

Service definition of function ns__getdbpwd

gSOAP 2.7.15 generated service definition

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值