axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bu...@us.ibm.com
Subject Re: Should BindingStub wait for one-way RPC return?
Date Mon, 01 Jul 2002 12:57:28 GMT
(I was on vacation last week.  It looks like no-one else answered your
question, so here goes, a bit late...)

WSDL2Java does not generate proper oneway methods.  But the notion of
oneway is not completely defined so, depending on your meaning of oneway,
it's either completely wrong or almost right.  If you see oneway as
immediately returning without any acknowledgement, then it's completely
wrong.  This is the usual interpretation of oneway, and the one I suspect
we should be following.

But should oneway methods throw a communications exception if there is a
problem communicating with the server?  Should there be some sort of
acknowledgement that the call actually arrived somewhere?  If that's your
understanding of oneway, then the code WSDL2Java generates is a bit closer
to correct.  However, it should not be waiting for a return from the server
method itself, which is what it's doing, so it's still not quite right.

Russell Butek
butek@us.ibm.com


Jack Crosscope <jrc@tecobj.com> on 06/23/2002 12:13:44 PM

Please respond to axis-dev@xml.apache.org

To:    axis-dev@xml.apache.org
cc:
Subject:    Should BindingStub wait for one-way RPC return?



Greetings,

I've got RedHat version 7.3.  I recently downloaded AXIS
(xml-axis-beta2.tar.gz,
04/29/02) for the first time, and have a question.

Is wsdl2java code handling one-way remote calls correctly?  With the
following
scenario, it throws an exception for void returns.  My understanding is
that the
client should not wait for a response from a one-way call.  Yet the stub
code
generated by wsdl2java appears to violate this.  However, I am new to SOAP,
so I'll just submit the following as grist for the mill.  (Probably I
could avoid a lot
of problems anyway by steering clear of one-way calls.)

Thanks,
Jack Crosscope
jrc@tecobj.com

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

// ClipsInterface.java -- for generating WSDL

public interface ClipsInterface
{
  public void clearClips();  // offending case, void return
...
};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


 >>> java2wsdl >>>

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

<definitions targetNamespace="ClipsInterface"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="ClipsInterface" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
...
    <message name="clearClips"/>
...
    <portType name="ClipsInterface">
        <operation name="clearClips">
            <input message="tns:clearClips" name="clearClips"/>
        </operation>
...
    <binding name="ClipsInterfaceSOAPBinding" type="tns:ClipsInterface">
        <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="clearClips">
            <soap:operation soapAction="" style="rpc"/>
            <input>
                <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="ClipsInterface" use="encoded"/>
            </input>
        </operation>
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


 >>> wsdl2java >>>

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

public class ClipsInterfaceSOAPBindingStub extends
org.apache.axis.client.Stub implements clips.client.ClipsInterface {

    public void clearClips() throws java.rmi.RemoteException{
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call call = createCall();
        call.setReturnType(org.apache.axis.encoding.XMLType.AXIS_VOID);
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("");
        call.setOperationStyle("rpc");
        call.setOperationName(new
javax.xml.rpc.namespace.QName("ClipsInterface", "clearClips"));

??? >>> Object resp = call.invoke(new Object[] {});   // line 99.
Expecting one-way return?

        if (resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)resp;
        }
    }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


My client code (modeled after junit.framework example):

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

public void test() {
        clips.client.ClipsInterface binding;
        try {
            binding = new
clips.client.JavaClassesLocator().getClipsInterface();
        }
        catch (javax.xml.rpc.ServiceException jre) {
            jre.printStackTrace();
            return;
        }

        try {
            long ivalue = 0;
            java.lang.String svalue = null;
            ivalue = binding.openTraceFile("clipsClientJ.trc");
            binding.clearClips();  // throws exception
...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Executed ANT test target in build.xml in netbeans ide on redhat 7.3 linux:

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

init:
compile:
Compiling 1 source file to /home/jack/tmp/ClipsSOAP/java
test:
org.xml.sax.SAXParseException: The markup in the document preceding the
root element must be well-formed.
org.xml.sax.SAXParseException: The markup in the document preceding the
root element must be well-formed.
        at org.apache.xerces.framework.XMLParser.reportError(XMLParser.
        java)
        at
org.apache.xerces.framework.XMLDocumentScanner.
        reportFatalXMLError(XMLDocumentScanner.java)
        at
org.apache.xerces.framework.XMLDocumentScanner$XMLDeclDispatcher.
        dispatch(XMLDocumentScanner.java)
        at
org.apache.xerces.framework.XMLDocumentScanner.
        parseSome(XMLDocumentScanner.java)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java)
        at javax.xml.parsers.SAXParser.parse(SAXParser.java)
        at
org.apache.axis.encoding.DeserializationContextImpl.
        parse(DeserializationContextImpl.java:202)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:428)
        at org.apache.axis.client.Call.invoke(Call.java:1919)
        at org.apache.axis.client.Call.invoke(Call.java:1690)
        at org.apache.axis.client.Call.invoke(Call.java:1608)
        at org.apache.axis.client.Call.invoke(Call.java:1169)
        at
clips.client.ClipsInterfaceSOAPBindingStub.
        clearClips(ClipsInterfaceSOAPBindingStub.java:99)
        at clips.client.ClipsClient.test(ClipsClient.java:27)
        at clips.client.ClipsClient.main(ClipsClient.java:42)
BUILD SUCCESSFUL
Total time: 5 seconds
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


The above exception has appeared for me only with one-way rpc calls.

The prior client call to openTraceFile(), which returns an integer,
works fine.
I checked, and the trace file was truly created and written by the server.

...EOM


Mime
View raw message