Try the following;

First run the EchoServer, that will start a simple Axis2 server on port
6060. Then run the client. If the code does not work for you let me know.


import org.apache.axis2.engine.AxisServer;

======================EchoServer============================

public class EchoServer {
    public static void main(String[] args) throws Exception {
        new AxisServer().deployService(EchoService.class.getName());
    }
}
====================EchoService==============================
public class EchoService {

    public void echo(String value){
        System.out.println("I am here");
        //return value;
    }
}
=====================EchoClient=================================
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;

public class EchoClient {
    public static void main(String[] args) throws Exception {
        ServiceClient client = new ServiceClient();
        Options opts = new Options();
        opts.setTo(new
EndpointReference("http://localhost:8000/axis2/services/EchoService";));
        opts.setAction("urn:echo");
        opts.setUseSeparateListener(true);
        client.setOptions(opts);
        client.fireAndForget(createPayLoad());
        Thread.sleep(500);
    }

    public static OMElement createPayLoad() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://sample.org";, "ns");
        OMElement method = fac.createOMElement("echo", omNs);
        OMElement value = fac.createOMElement("value", omNs);
        method.addChild(value);
        value.setText("Axis2");
        return method;

    }
}
> Deepal,  Thanks for the feedback.  I have my sleep set to 30000 (should be 
> enough) and have blocked it in Eclipse too.  Have also tried sendRobust().  
> Any other ideas? 
>
> William
>
>
> -----Original Message-----
> From: Deepal jayasinghe [mailto:deep...@gmail.com] 
> Sent: Thursday, June 03, 2010 6:43 PM
> To: java-user@axis.apache.org
> Subject: Re: InOnly client code?
>
> Hi William,
>
> When you invoke the service using fireAndForget you need to put put a
> sleep statement after invocation, if you do not do that the main thread
> terminate before sending  the message.
>   
>> Has anyone had success writing an In-Only client that they'd be willing to 
>> share?  I've deployed a simple In-Only service on WebSphere that works fine 
>> via soapui, but when I try to invoke it via a Java client it doesn't run, 
>> completely.  That is, I can see the log4j trace with additional activity 
>> after the usual ending "Exiting deleteAttachments()" entry. I know it 
>> doesn't completely run (which I know sounds strange) because I have another 
>> service for interrogating the static variable it initializes.   Using tcpmon 
>> I'm not seeing any significant difference in the SOAP messages, which I've 
>> constructed "manually" or via Axiom APIs based on what I see soapui sending. 
>>  I've tried using fireAndForget and robustSend along with stub invocation 
>> (equivalent of the Axis2 generated test case), the latter fails with 
>> AxisFault: The input stream for an incoming message is null.
>>
>> Thanks,
>> William
>>
>>
>>
>>
>> The information in this email is confidential and may be legally privileged.
>> It is intended solely for the addressee. Access to this email by anyone else
>> is unauthorized. If you are not the intended recipient, any disclosure,
>> copying, distribution or any action taken or omitted to be taken in reliance
>> on it, is prohibited and may be unlawful. If you are not the intended
>> addressee please contact the sender and dispose of this e-mail. Thank you.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
>> For additional commands, e-mail: java-user-h...@axis.apache.org
>>
>>
>>   
>>     
>
>
>   


-- 
"If we knew what it was we were doing, it would not be called research, would 
it?" - Albert Einstein


http://blogs.deepal.org
http://deepal.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to