各位高手!我现用Axis做的一个WebService 客户端别人已经写好了 我写的服务端 他的客户端用axis工具自动生成的
可以调用到我的方法,我却接收不到Map参数 ,客户端好像已经发出去了 但是服务端没有参数 求救
客户端:
package com.sangame.process.service;import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;import javax.xml.rpc.ServiceException;import com.sangame.process.tool.LogUtil;
import com.sangame.process.tool.SpWsConstant;public class Client { public String sendReplyProcess(String webServiceAddress, java.util.Map rqst)
throws RemoteException, ServiceException {
/** *************将Map对象转换为AnyType2AnyTypeMapEntry对象数组********************* */
Set keySet = rqst.keySet();
Iterator it = keySet.iterator();
AnyType2AnyTypeMapEntry[] paras = new AnyType2AnyTypeMapEntry[keySet
.size()];
int i = 0;
while (it.hasNext()) {
AnyType2AnyTypeMapEntry para = new AnyType2AnyTypeMapEntry();
String key = (String) it.next();
para.setKey(key);
para.setValue(rqst.get(key));
paras[i] = para;
i++;
}
/** ********************************** */
String result = null;
RemoteReplyServicePortType binding = null; RemoteReplyServiceLocator remoteLocator = new RemoteReplyServiceLocator();
remoteLocator
.setRemoteReplyServiceHttpPortEndpointAddress(webServiceAddress);
binding = remoteLocator.getRemoteReplyServiceHttpPort();
((RemoteReplyServiceHttpBindingStub) binding).setMaintainSession(true);
if (binding == null) {
System.out.println("binding is null");
}
result = binding.replyProcess(paras);
return result;
}
public static void main(String[] args)
{
Client client=new Client();
try
{
Map mapMessage=new HashMap();
mapMessage.put("outSystem", "ZJ_SPOA");
mapMessage.put("serialNo", "25725727524217257254");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("spId", "0573");
mapMessage.put("srTypeID", "0999900207");
mapMessage.put("acceptCity", "0573");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("subsCity", "0573");
mapMessage.put("srTypeID", "001006002001002");
mapMessage.put("acceptCity", "0573");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("subsCity", "0573");
String s= client.sendReplyProcess("http://localhost:7001/icd_hw/services/c_pbh_spoaRemoteReplyServicePortType?wsdl", mapMessage);
System.out.println(s);
}
catch (RemoteException e)
{
e.printStackTrace();
}
catch (ServiceException e)
{
e.printStackTrace();
}
}}
Main 方法
服务端很简单
就打印
public String replyProcess(Map map) throws Exception
{
// AnyType2anyTypeMap a=(AnyType2anyTypeMap)map;
return "fsadfasfsdafasfsafasfasdfasfvs----------------------";
}可以调用到方法 就接收不到值
可以调用到我的方法,我却接收不到Map参数 ,客户端好像已经发出去了 但是服务端没有参数 求救
客户端:
package com.sangame.process.service;import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;import javax.xml.rpc.ServiceException;import com.sangame.process.tool.LogUtil;
import com.sangame.process.tool.SpWsConstant;public class Client { public String sendReplyProcess(String webServiceAddress, java.util.Map rqst)
throws RemoteException, ServiceException {
/** *************将Map对象转换为AnyType2AnyTypeMapEntry对象数组********************* */
Set keySet = rqst.keySet();
Iterator it = keySet.iterator();
AnyType2AnyTypeMapEntry[] paras = new AnyType2AnyTypeMapEntry[keySet
.size()];
int i = 0;
while (it.hasNext()) {
AnyType2AnyTypeMapEntry para = new AnyType2AnyTypeMapEntry();
String key = (String) it.next();
para.setKey(key);
para.setValue(rqst.get(key));
paras[i] = para;
i++;
}
/** ********************************** */
String result = null;
RemoteReplyServicePortType binding = null; RemoteReplyServiceLocator remoteLocator = new RemoteReplyServiceLocator();
remoteLocator
.setRemoteReplyServiceHttpPortEndpointAddress(webServiceAddress);
binding = remoteLocator.getRemoteReplyServiceHttpPort();
((RemoteReplyServiceHttpBindingStub) binding).setMaintainSession(true);
if (binding == null) {
System.out.println("binding is null");
}
result = binding.replyProcess(paras);
return result;
}
public static void main(String[] args)
{
Client client=new Client();
try
{
Map mapMessage=new HashMap();
mapMessage.put("outSystem", "ZJ_SPOA");
mapMessage.put("serialNo", "25725727524217257254");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("spId", "0573");
mapMessage.put("srTypeID", "0999900207");
mapMessage.put("acceptCity", "0573");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("subsCity", "0573");
mapMessage.put("srTypeID", "001006002001002");
mapMessage.put("acceptCity", "0573");
mapMessage.put("subsNumber", "13819339033");
mapMessage.put("subsCity", "0573");
String s= client.sendReplyProcess("http://localhost:7001/icd_hw/services/c_pbh_spoaRemoteReplyServicePortType?wsdl", mapMessage);
System.out.println(s);
}
catch (RemoteException e)
{
e.printStackTrace();
}
catch (ServiceException e)
{
e.printStackTrace();
}
}}
Main 方法
服务端很简单
就打印
public String replyProcess(Map map) throws Exception
{
// AnyType2anyTypeMap a=(AnyType2anyTypeMap)map;
return "fsadfasfsdafasfsafasfasdfasfvs----------------------";
}可以调用到方法 就接收不到值
解决方案 »
- 用myeclipse发送邮件失败
- No getter method for property XXXX of bean问题(再问)
- 我知道这个问题很低级,但是我给的分多啊,跪求大哥们帮忙,20分必给
- 在div里创建table的问题,急
- 您好,您以前回答过的我问题,现在我又来找您了!
- 关于放类文件位置的问题
- spring管理的service里的某个save方法怎么单独提前提交
- 为什么我用javabean更新不了数据库?javabean,oracle高手请进!!!!!高分相赠!!!在线等待中。。。
- ★哪有让IIS支持JSP+Beans的东东?怎么使用??
- 这是我写的一个验证用户是否存在的问题,请帮我看看
- MyEclipse,放入WEB-INF里的lib为什么打不开?
- JSP中调用package.properties文件中的变量
.setProperty(
DefaultCommonsHTTPClientProperties.MAXIMUM_CONNECTIONS_PER_HOST_PROPERTY_KEY,
"100");
AxisProperties
.setProperty(
DefaultCommonsHTTPClientProperties.MAXIMUM_TOTAL_CONNECTIONS_PROPERTY_KEY,
"100");
EngineConfiguration defaultConfig = EngineConfigurationFactoryFinder
.newFactory().getClientEngineConfig();
SimpleProvider config = new SimpleProvider(defaultConfig);
config.deployTransport(HTTPTransport.DEFAULT_TRANSPORT_NAME,
new CommonsHTTPSender()); try {
String url = Configuration.getInstance()
.getValue("reconfirmSV_url");
this.stub = (ReconfirmSV_BindingStub) (new ReconfirmSV_ServiceLocator(
config).getReconfirmSV(new URL(url)));
// SOAPHeaderElement.;http://www.neusoft.com/
this.stub.setHeader(new SOAPHeaderElement(
Constant.HEADER_NAMESPACE, Constant.HEADER_LOCALPART));
} catch (IOException e) {
log.error("reconfirmSV_url : 读取文件---异常: " + e);
}
}
public static void main(String[] args) throws Exception {
ReconfirmSVClientFacade client = new ReconfirmSVClientFacade();
XStream xs = new XStream(new DomDriver());
xs.processAnnotations(SendRQMsgFromVSOPReq.class);
xs.processAnnotations(SendRQMsgFromVSOPResp.class); SendRQMsgFromVSOPReq req = new SendRQMsgFromVSOPReq();
//req.setStreamingNo("23");
String reqStr = "";
VsopServiceResponse resp = client.sendRQMessage(new VsopServiceRequest(
reqStr)); String respStr = resp.getResponse();
System.out.print(respStr); SendRQMsgFromVSOPResp resps = (SendRQMsgFromVSOPResp) xs
.fromXML(respStr); }