You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Mark Melia <me...@eircom.net> on 2004/01/18 19:18:33 UTC

RE: Service being called Twice

Just wondering if anyone can help me out I am calling a SOAP service but it
is being called twice, firstly with a document set to null and then with the
XML document I have specified.

Below is the calling method:


    public String execute() throws Exception{
        try{

            String endpoint =
"http://localhost:8080/axis/services/acmemsgservice";
            InputStream is =
ClassLoader.getSystemResourceAsStream("PurchaseOrder.xml");
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(endpoint);
            SOAPEnvelope env = new SOAPEnvelope();
            SOAPBodyElement ele = new SOAPBodyElement(is);

ele.setNamespaceURI("http://localhost:8080/axis/services/acmemsgservice");
            env.addBodyElement(ele);
            SOAPEnvelope elms = (SOAPEnvelope)call.invoke(env);
            SOAPBodyElement elem = elms.getFirstBody();
            Element e = elem.getAsDOM();
            str = XMLUtils.ElementToString(e);
        }catch(Exception e){
            e.printStackTrace();
        }
        return str;
    }

Anyone have any idea why 2 calls to the service are being made?

Thanks
Mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.423 / Virus Database: 238 - Release Date: 25/11/2002


RE: Service being called Twice

Posted by Abhinav Maheshwari <ab...@contata.co.in>.
Hi Mark,
I have deployed an echo service on my axis and tried using your code. (The
only difference is that I have used FileInputStream instead of
PurchaseOrder.xml)
It makes a single call. Is it possible that your external code is calling
the execute() method twice ?

I can try it again with your service code and file PurchaseOrder.xml if you
post it.

Regards,
Abhinav

-----Original Message-----
From: Mark Melia [mailto:meliamark@eircom.net]
Sent: Sunday, January 18, 2004 11:49 PM
To: axis-user@ws.apache.org
Subject: RE: Service being called Twice


Just wondering if anyone can help me out I am calling a SOAP service but it
is being called twice, firstly with a document set to null and then with the
XML document I have specified.

Below is the calling method:


    public String execute() throws Exception{
        try{

            String endpoint =
"http://localhost:8080/axis/services/acmemsgservice";
            InputStream is =
ClassLoader.getSystemResourceAsStream("PurchaseOrder.xml");
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setTargetEndpointAddress(endpoint);
            SOAPEnvelope env = new SOAPEnvelope();
            SOAPBodyElement ele = new SOAPBodyElement(is);

ele.setNamespaceURI("http://localhost:8080/axis/services/acmemsgservice");
            env.addBodyElement(ele);
            SOAPEnvelope elms = (SOAPEnvelope)call.invoke(env);
            SOAPBodyElement elem = elms.getFirstBody();
            Element e = elem.getAsDOM();
            str = XMLUtils.ElementToString(e);
        }catch(Exception e){
            e.printStackTrace();
        }
        return str;
    }

Anyone have any idea why 2 calls to the service are being made?

Thanks
Mark

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.423 / Virus Database: 238 - Release Date: 25/11/2002