You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Michael Moser (JIRA)" <ji...@apache.org> on 2006/11/16 10:17:37 UTC
[jira] Commented: (AXIS2-1717) Client API has no shutdown method
that waits until all buffered requests are sent
[ http://issues.apache.org/jira/browse/AXIS2-1717?page=comments#action_12450319 ]
Michael Moser commented on AXIS2-1717:
--------------------------------------
Test-Example - taken from the tutorial http://www-128.ibm.com/developerworks/edu/ws-dw-ws-understand-web-services1.html
Test-client:
---------------
package tutorials.webservices.clients;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMNamespace;
/**
* Sample for fire-and-forget service invocation
* Message Exchage Pattern IN-Only
*/
public class AddArticleClient
{
private static EndpointReference targetEPR =
new EndpointReference("http://localhost:8080/axis2/services/CMSService");
public static OMElement getOMElement() {
SOAPFactory fac = OMAbstractFactory.getSOAP12Factory();
OMNamespace omNs = fac.createOMNamespace("http://daily-moon.com/cms", "cms");
OMElement method = fac.createOMElement("addArticle", omNs);
OMElement category = fac.createOMElement("category", omNs);
category.setText("classifieds");
OMElement subcategory = fac.createOMElement("subcategory", omNs);
subcategory.setText("wantads");
OMElement adtext = fac.createOMElement("article", omNs);
adtext.setText("Do you have good head for numbers and a great deal of patience? "
+ "Do you like to sit for hours sorting objects by their size? "
+ "If so, then you could be the next goober counter in the world "
+ "famous Murphy Brothers peanut factory. "
+ "Willingness to dress up as our mascot helpful, but not required.");
method.addChild(category);
method.addChild(subcategory);
method.addChild(adtext);
return method;
}
public static void main(String[] args) {
try {
OMElement payload = AddArticleClient.getOMElement();
Options options = new Options();
options.setTo(targetEPR);
// options.setTransportInProtocol(?Constants.TRANSPORT_HTTP);
ServiceClient serviceClient = new ServiceClient();
serviceClient.setOptions(options);
System.out.println("PAYLOAD:");
System.out.println(payload.toString());
serviceClient.fireAndForget(payload);
System.out.println("SENT.");
// give the library time to execute the send-thread and actually send out the request:
try { Thread.sleep(3000); } catch (InterruptedException ex) { /*ignore*/ }
} catch (AxisFault axisFault) {
axisFault.printStackTrace();
}
}
}
Test-Service:
-----------------
package tutorials.webservices.cms;
import org.apache.axiom.om.OMElement;
public class CMSService
{
public void addArticle(OMElement element) /*throws XMLStreamException*/ {
System.out.println("received: addArticle");
element.build();
System.out.println(element);
System.out.println("done: addArticle");
}
}
service.xml:
----------------
<service name="CMSService">
<description>
This is a sample Web Service for the newspaper's Content Managment System.
</description>
<parameter name="ServiceClass" locked="false">tutorials.webservices.cms.CMSService</parameter>
<operation name="addArticle">
<messageReceiver class="org.apache.axis2.receivers.RawXMLINOnlyMessageReceiver"/>
</operation>
</service>
> Client API has no shutdown method that waits until all buffered requests are sent
> ---------------------------------------------------------------------------------
>
> Key: AXIS2-1717
> URL: http://issues.apache.org/jira/browse/AXIS2-1717
> Project: Apache Axis 2.0 (Axis2)
> Issue Type: Improvement
> Components: client-api
> Affects Versions: 1.1
> Reporter: Michael Moser
>
> On Tue, 2006-11-14 at 15:52 +0100, Michael Moser wrote:
> > I just ran into some problem with fireAndForget(...)-requests. These
> > obviously get buffered inside AxisEngine. Thus, if the application
> > terminates immediately after posting the last request(s) these request
> > get never sent.
> >
> > I stumbled over this, when experimenting with a command line code
> > snippet that uses the axis2 library to generate and send out SOAP
> > requests. I first couldn't understand why these requests had no effect.
> > After some digging I found out that these request were never received.
> > After some further digging I realized they weren't even sent out in the
> > first place. And after even more digging I finally realized, what was
> > going wrong here...
> >
> > Is there some shutdown method or such in that library? I searched but
> > found nothing so far...
> Hmmmm .. I think you're right; we're missing a way to say "please wait
> to finish all pending stuff and then shutdown." I thought that
> ServiceClient.finalize() had that behavior but it doesn't. In any case,
> that's not enough because this has to span across all pending service
> requests not just one service client.
> Can u open a JIRA with a simple sample please?
> Thanks!
> Sanjiva.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org