高手请帮忙看看小弟写的这个web service:

04-04-29 cold_liu
小弟写了下面这个:基于apache axis 和java的web service 程序,用来调用基于C#的服务器端程序,可是编译运行后,总是提示说参数无法传递....不知是何缘故,请高手指点一二:

另外,小弟有个建议,就是:能否专门开辟一个专栏用语讨论和研究Web service技术的 ^_^

import java.util.Date;

import java.text.DateFormat;

import java.util.Date;

import java.text.DateFormat;

import org.apache.axis.client.Call;

import org.apache.axis.client.Service;

import javax.xml.namespace.QName;

import java.lang.Integer;

import javax.xml.rpc.ParameterMode;

public class DeliverClient {

public DeliverClient() {

}

public static void main(String[] args) {

System.out.println("+++++++++++++++++++++++++++++++ 联通SP短信程序 +++++++++++++++++++++++++++++++");

System.out.println("+ +");

System.out.println("+ SMS130-1.0版本 创作:Cold_liu@hotmail.com 日期:2004-4-27 +");

System.out.println("+ +");

System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");

try {

String LoginName = "cwtest41";

String LoginPassword = "cwsmstest41";

String endpoint="http://211.94.227.177/smsservice/service.asmx";

Service service = new Service();

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

call.setTargetEndpointAddress(new java.net.URL(endpoint));

call.setOperationName(new QName("cn.com._2266.www","Deliver"));

call.addParameter("LoginName",org.apache.axis.encoding.XMLType.XSD_DATE,javax.xml.rpc.ParameterMode.IN);

call.addParameter("LoginPassword",org.apache.axis.encoding.XMLType.XSD_DATE,javax.xml.rpc.ParameterMode.IN);

call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);

call.setUseSOAPAction(true);

call.setSOAPActionURI("http://www.2266.com.cn/Deliver");

String[] k = (String[])call.invoke(new String[]{LoginName,LoginPassword});

for (int i=0;i<k.length;i++){

System.out.println( "result is " + k);

}

}

catch (Exception e) {System.err.println(e.toString());}

}

}

cold_liu
2004-04-29 05:08
小弟的apache asix地址是:http://cfmx.xicp.net:8080/axis/

为什么有两个选项不能用呢:

Administer Axis

SOAPMonitor

请各位大哥多多指教,小弟先行谢过了...

^_^

廉价劳力
2004-04-29 08:44
自己写太麻烦,在命令行下:

java org.apache.axis.wsdl.WSDL2Java http://211.94.227.177/smsservice/service.asmx?wsdl

自动生成一堆封装的Java Class,你直接用就行了!

飞龙战将
2004-04-29 11:41
有什么问题也不说

cold_liu
2004-04-29 14:00
to:廉价劳力兄,小弟用了你说的方法,可是提示说:Exception in thread "main" java.lang.NoClassDefoundError:java\apache\axis\wsdl2java

to:飞龙将军兄,小弟的问题有两个,

1,是用java axis 调用远程的C#的服务,参数无法传递,我写的文件,在第一楼

2, 我axis在服务器的地址是:http://cfmx.xicp.net:8080/axis/

里面有些设置不对,想请大家指教...

猜你喜欢
3Go 1 2 3 下一页