Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Consuming a SOAP Vector Type from .Net  RSS feed

Posts: 4
  • Mark post as helpful
  • send pies
  • 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???
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!