各位高手!我现用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----------------------";
}可以调用到方法 就接收不到值

解决方案 »

  1.   

    这个我封装的客户端代码 个人觉得你的client太复杂public ReconfirmSVClientFacade() throws ServiceException, SOAPException { AxisProperties
    .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);
    }
    }
      

  2.   


    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); }