Marios,

Here's a very simple service class that accepts a String array

-----------------------------------------------------
package myservices;
public class VerySimpleService {
       public int countStrings (String[] myStrings) {
           return myStrings.length;
       }
}
-------------------------------------------------------

Next generate a WSDL for it (with java2wsdl) as attached. Generate a client stub from this WSDL, with wsdl2java. 

Finally write your client that uses the generated stub, e.g:
-----------------------------------------------------------------------------
package myservices.client;
import java.rmi.RemoteException;
public class VerySimpleClient {
    public static void main(String[] args) throws RemoteException {
        VerySimpleServiceStub service = new VerySimpleServiceStub();
        String [] request = {"1st element","2nd element","3rd element","last element"};
        int count = service.countStrings(request);
        System.out.println("Number of elements in array:" + count);
    }
}
----------------------------------------------------------------------------------------------------------

Good luck,

Roel



Marios Christoulakis schreef:
Thank you very much for your response. Can i have an example with an
array of string?

On Sat, 2008-01-12 at 19:26 +0100, Roel Verbunt wrote:
  
SOAP does not support collections of any type, because of weakly typing. 
So no Vector either. You can put all kind of different objects in a 
collection so this would cause a problem for your clients.
You should use an array of objects instead.

Roel


Marios Christoulakis wrote:
    
Hello i want to know how i can call a web service with
input argument Vector and how to get as an answer
vector.

I have been searching for a long time but i haven't
found anything.

To call the ws i use the method

OMElement result = sender.sendReceive(payload);

Thank you in advance.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





  
      
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

    



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; xmlns:axis2="http://myservices"; xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; xmlns:ns0="http://myservices/xsd"; xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"; xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; xmlns:ns1="http://org.apache.axis2/xsd"; xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; targetNamespace="http://myservices";>
    <wsdl:types>
        <xs:schema xmlns:xsd="http://myservices/xsd"; attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://myservices/xsd";>
    <xs:element name="countStrings">
        <xs:complexType>
            <xs:sequence>
                <xs:element maxOccurs="unbounded" minOccurs="0" name="myStrings" nillable="true" type="xs:string"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:element name="countStringsResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element minOccurs="0" name="return" type="xs:int"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
    </wsdl:types>
    <wsdl:message name="countStringsRequest">
        <wsdl:part name="parameters" element="ns0:countStrings"/>
    </wsdl:message>
    <wsdl:message name="countStringsResponse">
        <wsdl:part name="parameters" element="ns0:countStringsResponse"/>
    </wsdl:message>
    <wsdl:portType name="VerySimpleServicePortType">
        <wsdl:operation name="countStrings">
            <wsdl:input message="axis2:countStringsRequest" wsaw:Action="urn:countStrings"/>
            <wsdl:output message="axis2:countStringsResponse" wsaw:Action="urn:countStringsResponse"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="VerySimpleServiceSOAP11Binding" type="axis2:VerySimpleServicePortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"; style="document"/>
        <wsdl:operation name="countStrings">
            <soap:operation soapAction="urn:countStrings" style="document"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="VerySimpleServiceSOAP12Binding" type="axis2:VerySimpleServicePortType">
        <soap12:binding transport="http://schemas.xmlsoap.org/soap/http"; style="document"/>
        <wsdl:operation name="countStrings">
            <soap12:operation soapAction="urn:countStrings" style="document"/>
            <wsdl:input>
                <soap12:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="VerySimpleServiceHttpBinding" type="axis2:VerySimpleServicePortType">
        <http:binding verb="POST"/>
        <wsdl:operation name="countStrings">
            <http:operation location="VerySimpleService/countStrings"/>
            <wsdl:input>
                <mime:content type="text/xml" part="countStrings"/>
            </wsdl:input>
            <wsdl:output>
                <mime:content type="text/xml" part="countStrings"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="VerySimpleService">
        <wsdl:port name="VerySimpleServiceSOAP11port_http" binding="axis2:VerySimpleServiceSOAP11Binding">
            <soap:address location="http://localhost:8080/axis2/services/VerySimpleService"/>
        </wsdl:port>
        <wsdl:port name="VerySimpleServiceSOAP12port_http" binding="axis2:VerySimpleServiceSOAP12Binding">
            <soap12:address location="http://localhost:8080/axis2/services/VerySimpleService"/>
        </wsdl:port>
        <wsdl:port name="VerySimpleServiceHttpport" binding="axis2:VerySimpleServiceHttpBinding">
            <http:address location="http://localhost:8080/axis2/services/VerySimpleService"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to