• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Consuming a SOAP Vector Type from .Net

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am new to web services.
I am not sure if this problem should be posted in a .Net forum or Java forum
because it involves a ASP.Net applicaton consuming a Java web service exposed using AXIS.
But I hope i can get some help here.

I have exposed my Java web services to receive a SOAP Vector type and to return results as a SOAP Vector.
Both vectors should contain Arrays of String.
My .net web application need to consume this web service and I have added a web refernce to this Java web services.
From the debug writeline statement below, i can assume "myVector" is initialise correctly before calling the web service.
'========= .NET
:
:
Dim arr1 As String() = {"1", "2"} 'an array of String
Dim arr2 As String() = {"3", "4"}
Dim arr3 As String() = {"5", "6"}
'' stockAppl is the project name
'' Enq is the web reference name
'' Vector is the class name
Dim myVector As New stockAppl.Enq.Vector()
myVector.item = Array.CreateInstance(GetType(String()), 3)
myVector.item(0) = arr1
myVector.item(1) = arr2
myVector.item(2) = arr3
'System.Diagnostics.Debug.WriteLine(" *" & myVector.item.GetType().ToString & " *")
'System.Diagnostics.Debug.WriteLine(" *" & myVector.item.Length.ToString & " *")
Dim abc As New stockAppl.Enq.EnquireStockWSService()
Dim myAL2 As stockAppl.Enq.Vector() = abc.EnquireStockWS(myVector)

:
:
:
'========= .NET

But in my Java code, i try to perform the following explicit casting into a java.util.Vector object.
Line 1 : System.out.println(javaVector.getClass().getName());
line 2 : WSRequestVector = (Vector)javaVector;
Though the Line 1 print out "java.util.Vector" Line 2 throws a ClassCastException.

Did i do something wrong here???
Thanks.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This belongs in the Web Services forum. Why not just send an array of Strings? Both Java and Net understand array of type string and there are very convenient methods in the Collections API for converting from Vector to an array.
Bill
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic