这下面是我的代码。
//测试 直接引用远程的wsdl文件
String endpoint ="http://web.vv106.com/WS/LinkWS.asmx?wsdl";
//以下都是套路
Service service = new Service();
int msg = 0;
Call call;
try
{
call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
//测试 WSDL里面描述的接口名称
call.setOperationName(new QName("http://tempuri.org", "Send2"));
//测试 接口的参数
call.addParameter("CorpID",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("Pwd",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("Mobile",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("Content",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("Cell",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter("SendTime",org.apache.axis.Constants.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.setUseSOAPAction(true);
//设置返回类型
call.setReturnType(org.apache.axis.encoding.XMLType.SOAP_INT);
call.setSOAPActionURI("http://tempuri.org/Send2");
//给方法传递参数
msg = (Integer) call.invoke(new Object[]{"YS106","95160","13428993426","欢迎您注册,成为95160网站会员!","",""});
System.out.print("msg="+msg);
}
catch (ServiceException e)
{
e.printStackTrace();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (RemoteException e)
{
e.printStackTrace();
}
-------------------------------------------------
最后一步会报错
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.NumberFormatException: For input string: "过程或函数 'Act_IF_Send2' 需要参数 [email protected]',但未提供该参数。"
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:java.lang.NumberFormatException: For input string: "过程或函数 'Act_IF_Send2' 需要参数 [email protected]',但未提供该参数。"
at org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement(SimpleDeserializer.java:180)
at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:502)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:171)
at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
at org.apache.axis.client.Call.invoke(Call.java:2467)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.member.test.main(test.java:93)
{http://xml.apache.org/axis/}hostname:5fd3a2c54717493
java.lang.NumberFormatException: For input string: "过程或函数 'Act_IF_Send2' 需要参数 [email protected]',但未提供该参数。"
at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
at org.apache.axis.client.Call.invoke(Call.java:2470)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.member.test.main(test.java:93)
Caused by: java.lang.NumberFormatException: For input string: "过程或函数 'Act_IF_Send2' 需要参数 [email protected]',但未提供该参数。"