I am new to axis, xml and web services, so sorry if I'm asking a
boneheaded question.

I am trying to do some basic web services with axis for learning and
evaluation. I am using axis 1.1, java2wsdl to convert a java interface
into wsdl and then wsdl2java to create my stubs and skeletons. I have
deployed to the axis web application with AdminClient and successfully
conversed between a dumb client and the web service. I have gotten a
string, and array of string and complex type (sequence of 4 strings) to
return correctly.

I have another complex type that doesn't seem to be working correctly.
The complex type is an array of complex types (sequence of 4 strings).
The web service seems to return the last entry 3 times (my dummy
Implementation puts 3 items into the return) instead of each entry once.
SOAPMonitor shows that the web service is sending the same href "#id0" 3
times. I think this is happening in axis generated code and I don't know
if it is a bug or I have forgotten a step or what.

Does anyone have any suggestions? I've attached my java interface, the
wsdl it generated, my java implementation, my dumb java client and the
output I copied from SOAPMonitor. Thanks for any help,

Lloyd

package org.bmpcoe.signout.ws;

/**
 * Created by IntelliJ IDEA.
 * User: meinholz
 * Date: Jul 28, 2003
 * Time: 9:00:10 AM
 * To change this template use Options | File Templates.
 */


public interface SignOut extends java.rmi.Remote {
    public java.lang.String ping() throws java.rmi.RemoteException;
    public java.lang.String[] pings() throws java.rmi.RemoteException;
    public org.bmpcoe.signout.UserEntry getUserEntry() throws java.rmi.RemoteException;
    public java.lang.Object[] getUserEntries() throws java.rmi.RemoteException;
}
package org.bmpcoe.signout.ws;


import java.util.ArrayList;
import org.bmpcoe.signout.UserEntry;


public class SignOutImpl implements SignOut {
    public java.lang.String ping() throws java.rmi.RemoteException {
        return "pong";
    }

    public java.lang.String[] pings() throws java.rmi.RemoteException {
        String[] retVal = { "pong1", "pong2", "pong3" };

        return retVal;
    }

    public UserEntry getUserEntry() throws java.rmi.RemoteException {
        // Create a dummy user entry to look at with tcpmon
        UserEntry userEntry = new UserEntry();
        userEntry.setUserId("MEINHOLZ");
        userEntry.setName("Lloyd H. Meinholz");
        userEntry.setRemk("In");
        userEntry.setRetn("");

        return userEntry;
    }

    public Object[] getUserEntries() throws java.rmi.RemoteException {
        ArrayList userEntries = new ArrayList();
        UserEntry userEntry = new UserEntry();

        userEntry.setUserId("MEINHOLZ");
        userEntry.setName("Lloyd H. Meinholz");
        userEntry.setRemk("Vacation");
        userEntry.setRetn("7/21");
        userEntries.add(userEntry);

        userEntry.setUserId("Jorge");
        userEntry.setName("Jorge Cardozo");
        userEntry.setRemk("In");
        userEntry.setRetn("");
        userEntries.add(userEntry);

        userEntry.setUserId("RALPH");
        userEntry.setName("Ralph Sickinger");
        userEntry.setRemk("Running Late");
        userEntry.setRetn("Fri. PM");
        userEntries.add(userEntry);

        return userEntries.toArray();
    }

}
package org.bmpcoe.signout.client;

/**
 * Created by IntelliJ IDEA.
 * User: meinholz
 * Date: Jul 28, 2003
 * Time: 2:04:54 PM
 * To change this template use Options | File Templates.
 */


import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.bmpcoe.signout.*;
import org.bmpcoe.signout.ws.*;


public class SignOutClient {
    public static void main(String args[]) {
        SignOutClient client = new SignOutClient();
    }

    public SignOutClient() {
        try {
            SignOutService service = new SignOutServiceLocator();
            SignOut signout = service.getSignOut();

            //testPing(signout);
            //testPings(signout);
            //testGetUserEntry(signout);
            testGetUserEntries(signout);
        }
        catch (javax.xml.rpc.ServiceException se) {
            System.err.println("ws.createCall() threw javax.rpc.ServiceException");
            System.err.println(se.toString());
        }

/*
        String endpoint = "http://mjollnir.bmpcoe.org/axis/services/SignOut";;
        String method = "getUserEntry";
        UserEntry retVal = null;
        Service service = new Service();
        try {
            Call call = (Call)service.createCall();
            call.setTargetEndpointAddress(new java.net.URL(endpoint));
            call.setOperationName(method);
            //call.setReturnType(XMLType.XSD_STRING);
            retVal = (UserEntry)call.invoke(new Object[] {});
        }
        catch (javax.xml.rpc.ServiceException se) {
            System.err.println("ws.createCall() threw javax.rpc.ServiceException");
            System.err.println(se.toString());
        }
        catch (java.net.MalformedURLException mue) {
            System.err.println("new java.net.URL() threw java.net.MalformedURLException");
            System.err.println(mue.toString());
        }
        catch (java.rmi.RemoteException re) {
            System.err.println("call.invoke() threw java.rmi.RemoteException");
            System.err.println(re.toString());
        }

        //System.out.println("retVal (" + retVal + ")");

        //System.out.println("retVal (" + retVal[0] + ", " + retVal[1] + ", " + retVal[2] + ")");

        System.out.print("userId (" + retVal.getUserId() + ")  ");
        System.out.print("name (" + retVal.getName() + ")  ");
        System.out.print("remk (" + retVal.getRemk() + ")  ");
        System.out.println("retn (" + retVal.getRetn() + ")");
*/
    }


    public void testPing(SignOut signout) {
        //
        String result = null;
        // Call the Web Service
        try {
            result = signout.ping();
        }
        catch (java.rmi.RemoteException re) {
            System.err.println("signout.ping() threw java.rmi.RemoteException");
            System.err.println(re.toString());
        }
        // Print the Results
        System.out.println("ping() result:");
        System.out.println("    " + result);
        System.out.println("");
    }

    public void testPings(SignOut signout) {
        String[] result = null;
        // Call the Web Service
        try {
            result = signout.pings();
        }
        catch (java.rmi.RemoteException re) {
            System.err.println("signout.pings() threw java.rmi.RemoteException");
            System.err.println(re.toString());
        }
        // Print the Results
        System.out.println("pings() result:");
        System.out.println("    result[0]: " + result[0]);
        System.out.println("    result[1]: " + result[1]);
        System.out.println("    result[2]: " + result[2]);
        System.out.println("");
    }

    public void testGetUserEntry(SignOut signout) {
        UserEntry result = null;
        // Call the Web Service
        try {
            result = signout.getUserEntry();
        }
        catch (java.rmi.RemoteException re) {
            System.err.println("signout.getUserEntry() threw java.rmi.RemoteException");
            System.err.println(re.toString());
        }
        // Print the Results
        System.out.println("getUserEntry() result:");
        System.out.print("    ");
        System.out.print("userId (" + result.getUserId() + ")  ");
        System.out.print("name (" + result.getName() + ")  ");
        System.out.print("remk (" + result.getRemk() + ")  ");
        System.out.println("retn (" + result.getRetn() + ")");
        System.out.println("");
    }

    public void testGetUserEntries(SignOut signout) {
        Object[] result = null;
        // Call the Web Service
        try {
            result = signout.getUserEntries();
        }
        catch (java.rmi.RemoteException re) {
            System.err.println("signout.getUserEntries() threw java.rmi.RemoteException");
            System.err.println(re.toString());
        }
        // Print the Results
        System.out.println("getUserEntries() result:");
        for (int x=0; x<result.length; x++) {
            UserEntry userEntry = (UserEntry)result[x];
            System.out.print("    ");
            System.out.print("userId (" + userEntry.getUserId() + ")  ");
            System.out.print("name (" + userEntry.getName() + ")  ");
            System.out.print("remk (" + userEntry.getRemk() + ")  ");
            System.out.println("retn (" + userEntry.getRetn() + ")");
        }
        System.out.println("");
    }

}
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="urn:SignOut" 
xmlns="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:apachesoap="http://xml.apache.org/xml-soap"; xmlns:impl="urn:SignOut" 
xmlns:intf="urn:SignOut" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:tns2="http://signout.bmpcoe.org"; xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 <wsdl:types>
  <schema targetNamespace="urn:SignOut" xmlns="http://www.w3.org/2001/XMLSchema";>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_xsd_string">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]"/>
     </restriction>
    </complexContent>
   </complexType>
   <complexType name="ArrayOf_xsd_anyType">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
  <schema targetNamespace="http://signout.bmpcoe.org"; 
xmlns="http://www.w3.org/2001/XMLSchema";>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="UserEntry">
    <sequence>
     <element name="name" nillable="true" type="xsd:string"/>
     <element name="remk" nillable="true" type="xsd:string"/>
     <element name="retn" nillable="true" type="xsd:string"/>
     <element name="userId" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
  </schema>
 </wsdl:types>

   <wsdl:message name="getUserEntryResponse">

      <wsdl:part name="getUserEntryReturn" type="tns2:UserEntry"/>

   </wsdl:message>

   <wsdl:message name="pingRequest">

   </wsdl:message>

   <wsdl:message name="pingsResponse">

      <wsdl:part name="pingsReturn" type="impl:ArrayOf_xsd_string"/>

   </wsdl:message>

   <wsdl:message name="pingResponse">

      <wsdl:part name="pingReturn" type="xsd:string"/>

   </wsdl:message>

   <wsdl:message name="getUserEntryRequest">

   </wsdl:message>

   <wsdl:message name="getUserEntriesRequest">

   </wsdl:message>

   <wsdl:message name="getUserEntriesResponse">

      <wsdl:part name="getUserEntriesReturn" type="impl:ArrayOf_xsd_anyType"/>

   </wsdl:message>

   <wsdl:message name="pingsRequest">

   </wsdl:message>

   <wsdl:portType name="SignOut">

      <wsdl:operation name="ping">

         <wsdl:input message="impl:pingRequest" name="pingRequest"/>

         <wsdl:output message="impl:pingResponse" name="pingResponse"/>

      </wsdl:operation>

      <wsdl:operation name="pings">

         <wsdl:input message="impl:pingsRequest" name="pingsRequest"/>

         <wsdl:output message="impl:pingsResponse" name="pingsResponse"/>

      </wsdl:operation>

      <wsdl:operation name="getUserEntry">

         <wsdl:input message="impl:getUserEntryRequest" name="getUserEntryRequest"/>

         <wsdl:output message="impl:getUserEntryResponse" name="getUserEntryResponse"/>

      </wsdl:operation>

      <wsdl:operation name="getUserEntries">

         <wsdl:input message="impl:getUserEntriesRequest" 
name="getUserEntriesRequest"/>

         <wsdl:output message="impl:getUserEntriesResponse" 
name="getUserEntriesResponse"/>

      </wsdl:operation>

   </wsdl:portType>

   <wsdl:binding name="SignOutSoapBinding" type="impl:SignOut">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="ping">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="pingRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="pingResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="pings">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="pingsRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="pingsResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getUserEntry">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getUserEntryRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getUserEntryResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="getUserEntries">

         <wsdlsoap:operation soapAction=""/>

         <wsdl:input name="getUserEntriesRequest">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:input>

         <wsdl:output name="getUserEntriesResponse">

            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
namespace="urn:SignOut" use="encoded"/>

         </wsdl:output>

      </wsdl:operation>

   </wsdl:binding>

   <wsdl:service name="SignOutService">

      <wsdl:port binding="impl:SignOutSoapBinding" name="SignOut">

         <wsdlsoap:address 
location="http://mjollnir.bmpcoe.org/axis/services/SignOut"/>

      </wsdl:port>

   </wsdl:service>

</wsdl:definitions>
<!-- Request -->

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
    <ns1:getUserEntries 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:ns1="urn:SignOut"/>
  </soapenv:Body>
</soapenv:Envelope>


<!-- Response -->

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
    <ns1:getUserEntriesResponse 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:ns1="urn:SignOut">
      <getUserEntriesReturn xsi:type="soapenc:Array" 
soapenc:arrayType="xsd:anyType[3]" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>
        <item href="#id0"/>
        <item href="#id0"/>
        <item href="#id0"/>
      </getUserEntriesReturn>
    </ns1:getUserEntriesResponse>
    <multiRef id="id0" soapenc:root="0" 
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; 
xsi:type="ns2:UserEntry" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:ns2="http://signout.bmpcoe.org";>
      <name xsi:type="xsd:string">Ralph Sickinger</name>
      <remk xsi:type="xsd:string">Running Late</remk>
      <retn xsi:type="xsd:string">Fri. PM</retn>
      <userId xsi:type="xsd:string">RALPH</userId>
    </multiRef>
  </soapenv:Body>
</soapenv:Envelope>

Reply via email to