Hello, I think I have to ask for help.I have ask "[EMAIL PROTECTED] for 
help.But nobody answered my question.Hoping I can get help here.
I am now using axis2 accessing .net web service following samples of 
"EchoNonBlockingDualClient".The userguide just mentions the condition of both 
web service and client are based on axis2.But if my web service is .net web 
service,how should I use Axis2 client to access in the 
"EchoNonBlockingDualClient" way?  .net web service as follows:   public string 
HelloWorld(string name)  {     return "Hello World"+name;  }  Axis2 client code 
is in the attachment.When I run the client code,appearing the following 
information: org.apache.axis2.AxisFault: Unable to engage module : addressing 
at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:333) 
at org.apache.axis2.client.ServiceClient.engageModule(ServiceClient.java:318) 
at Test.NonBlockingDualClient.main(NonBlockingDualClient.java:47) How should I 
change the client code?Maybe the "sender.engageModule(new 
QName(Constants.MODULE_ADDRESSING));"?If so,how to? Waiting for your help.  
-Zhang 
_________________________________________________________________
Windows Live Spaces 中最年轻的成员!
http://miaomiaogarden2007.spaces.live.com/
public class NonBlockingDualClient {

         private static EndpointReference targetEPR = new 
EndpointReference("http://localhost/test/Service1.asmx";);

            public static void main(String[] args) {
                ServiceClient sender = null;
                try {
                    OMElement payload = getContentOMElement();

                    Options options = new Options();
                    options.setTo(targetEPR);
                    //options.setAction("http://tempuri.org/HelloWorld";);
                    options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
                    options.setUseSeparateListener(true);
                    options.setAction("http://tempuri.org/HelloWorld";);  // 
this is the action mapping we put within the service.xml
                    //Callback to handle the response
                    Callback callback = new Callback() {
                        public void onComplete(AsyncResult result) {
                            System.out.println(result.getResponseEnvelope());
                        }

                        public void onError(Exception e) {
                            e.printStackTrace();
                        }
                    };

                    //Non-Blocking Invocation
                    //ConfigurationContext configContext = 
ConfigurationContextFactory.createConfigurationContextFromFileSystem("D:\\axis\\axis2-1.2\\axis2-1.2\\repository",
 null);
                    //sender = new ServiceClient(configContext, null);
                    sender = new ServiceClient();
                    sender.engageModule(new QName(Constants.MODULE_ADDRESSING));
                  
                    sender.setOptions(options);
                    sender.sendReceiveNonBlocking(payload, callback);

                    //Wait till the callback receives the response.
                    while (!callback.isComplete()) {
                        Thread.sleep(1000);
                    }
                    //Need to close the Client Side Listener.

                } catch (AxisFault axisFault) {
                    axisFault.printStackTrace();
                } catch (Exception ex) {
                    ex.printStackTrace();
                } finally {
                    try {
                        sender.cleanup();
                    } catch (AxisFault axisFault) {
                        //have to ignore this
                    }
                }

            }
            
            public static OMElement getContentOMElement() {
                OMFactory fac = OMAbstractFactory.getOMFactory();
                OMNamespace omNs = fac.createOMNamespace("http://tempuri.org/";, 
"");
                OMElement method = fac.createOMElement("HelloWorld", omNs);
                
                //ÈçºÎÅжϷþÎñ¶ËÊÇ·ñʹÓÃAxis2µÄOMElement
                //method.setText(" ,zhangsan"); //special for axis2 OMElement 
mode
                OMElement value = fac.createOMElement("name", omNs);  
//×¢£ºnameΪ²ÎÊýÃû×Ö
                //value.addChild(fac.createOMText(value,"zhangsan")); //Ò²¿ÉÒÔ
                value.addChild(fac.createOMText(value,"zhangsan"));
                method.addChild(value);
                return method;
            }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to