axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roel Verbunt <roel...@gmail.com>
Subject Re: Axis2 and vectors
Date Mon, 14 Jan 2008 20:04:13 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Marios,<br>
<br>
Here's a very simple service class that accepts a String array <br>
<br>
-----------------------------------------------------<br>
package myservices;<br>
public class VerySimpleService {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; public int countStrings (String[] myStrings)
{<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return myStrings.length;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; }<br>
}<br>
-------------------------------------------------------<br>
<br>
Next generate a WSDL for it (with java2wsdl) as attached. Generate a
client stub from this WSDL, with wsdl2java.&nbsp; <br>
<br>
Finally write your client that uses the generated stub, e.g:<br>
-----------------------------------------------------------------------------<br>
package myservices.client;<br>
import java.rmi.RemoteException;<br>
public class VerySimpleClient {<br>
&nbsp;&nbsp;&nbsp; public static void main(String[] args) throws RemoteException
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VerySimpleServiceStub
service = new VerySimpleServiceStub();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String [] request =
{"1st element","2nd element","3rd
element","last element"};<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int count = service.countStrings(request);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println("Number
of elements in array:" + count);<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
----------------------------------------------------------------------------------------------------------<br>
<br>
Good luck,<br>
<br>
Roel<br>
<br>
<br>
<br>
Marios Christoulakis schreef:
<blockquote cite="mid:26843743.10054211200311785144.JavaMail.root@atlas"
 type="cite">
  <pre wrap="">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:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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:
    </pre>
    <blockquote type="cite">
      <pre wrap="">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: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>





  
      </pre>
    </blockquote>
    <pre wrap="">
---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>

    </pre>
  </blockquote>
  <pre wrap=""><!---->


---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-unsubscribe@ws.apache.org">axis-user-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:axis-user-help@ws.apache.org">axis-user-help@ws.apache.org</a>


  </pre>
</blockquote>
</body>
</html>

Mime
View raw message