为什么已经执行了putString()后得到的值不变呢.如果putString 各getSTring()执得的是不同一个对象的话.那本人也试过采用加一个构造函数 static i = 0; Test(){ i++;} 但在每资执行客户端时打印的 i 的值多为 0;

解决方案 »

  1.   

    客户端代码:
    public class TestClient{
    private static EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2/services/Test?wsdl");

    public static OMElement putValue(String param0,String param1)
       {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://service.pack/xsd", "tns");
        OMElement method = fac.createOMElement("putString", omNs);
        OMElement value1 = fac.createOMElement("param0",omNs);
        value1.addChild(fac.createOMText(value1,param0));
        method.addChild(value1);
        OMElement value2 = fac.createOMElement("param1",omNs);
        value2.addChild(fac.createOMText(value2,param1));
        method.addChild(value2);
        return method;
      }
      
       public static OMElement getValue1(){ 
       OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://service.pack/xsd", "tns");
        OMElement method = fac.createOMElement("getString1", omNs); 
        return method;
      }  
      
       public static OMElement getValue2(){ 
       OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace("http://service.pack/xsd", "tns");
        OMElement method = fac.createOMElement("getString2", omNs); 
        return method;
      } 
      
       public static void main(String args[]){
       try{
       Options options = new Options();
       options.setTo(targetEPR);
       options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
       ServiceClient sender = new ServiceClient();
       sender.setOptions(options);
       OMElement putVa = putValue("@@@@","****");
       sender.fireAndForget(putVa); 
      
        
       OMElement getVa1 = getValue1();
       OMElement result1 = sender.sendReceive(getVa1);
       String str1 = result1.getFirstElement().getText();
      
       OMElement getVa2 = getValue2();
       OMElement result2 = sender.sendReceive(getVa2);  
       String str2 = result2.getFirstElement().getText();
       }catch(Exception e){
       e.printStackTrace();
       }
      } 
    }
      

  2.   

    当采用ServiceClient().sendRobust()调用putString()时又会抛出
    org.apache.axis2.AxisFault: Incoming message input stream is null
      

  3.   

    我这也有axis2的问题:
    Exception in thread "main" org.apache.axis2.AxisFault: Module not found
    at org.apache.axis2.description.AxisService.engageModule(AxisService.java:395)
    at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:279)
    at org.guoxin.webservice.ClientClass.ClientFromAPI(ClientClass.java:105)
    at org.guoxin.webservice.ClientClass.main(ClientClass.java:35)
    刚开始axis2学习,研究soa中