473,588 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serialization problem, VB.Net Client consuming Java Axis Web Service

I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated

"Cannot assign object of type System.Object[] to an object of type ElectronicWalle t.C2PTest.Payme ntItem."

[System.InvalidO perationExcepti on]: {System.Invalid OperationExcept ion
HelpLink: Nothin
InnerException: {System.Invalid CastException
Message: "There is an error in XML document (12, 19).
Source: "System.Xml

StackTrace: " at System.Xml.Seri alization.XmlSe rializer.Deseri alize(XmlReader xmlReader, String encodingStyle
at System.Xml.Seri alization.XmlSe rializer.Deseri alize(XmlReader xmlReader
at System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.ReadRes ponse(SoapClien tMessage message, WebResponse response, Stream responseStream, Boolean asyncCall
at System.Web.Serv ices.Protocols. SoapHttpClientP rotocol.Invoke( String methodName, Object[] parameters
at ElectronicWalle t.C2PTest.SOAPP aymentServiceSe rvice.method1(S tring par1, String par2, String par3, Int64 par4, String par5, String par6, Boolean par7, String par8, String par9, String par10, String par11) in C:\Projects\Gat eway\Electronic Wallet\Electron icWalletWebServ ice\Web References\C2PT est\Reference.v b:line 4
at ElectronicWalle t.PayoutCommon. DoPayout(Int64 lngTransID, XmlDocument& oWSReq, XmlDocument& oWSResp) in C:\Projects\Gat eway\Electronic Wallet\Electron icWalletWebServ ice\PayoutCommo n.vb:line 22
at ElectronicWalle t.Process.EWPay out(String s_Payout) in C:\Projects\Gat eway\Electronic Wallet\Electron icWalletWebServ ice\Process.asm x.vb:line 153
TargetSite: {System.Reflect ion.RuntimeMeth odInfo
?ex.InnerExcept ion
{System.Invalid CastException
[System.InvalidC astException]: {System.Invalid CastException
HelpLink: Nothin
InnerException: Nothin
Message: "Cannot assign object of type System.Object[] to an object of type ElectronicWalle t.C2PTest.Payme ntItem[].
Source: "fqsomxwu
StackTrace: " at Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.Read3 _ResponsePar6l(
at System.Xml.Seri alization.XmlSe rializationRead er.ReadReferenc ingElement(Stri ng name, String ns, Boolean elementCanBeTyp e, String& fixupReference
at System.Xml.Seri alization.XmlSe rializationRead er.ReadReferenc edElements(
at Microsoft.Xml.S erialization.Ge neratedAssembly .XmlSerializati onReader1.Read6 _method1Respons e()
TargetSite: {System.Reflect ion.RuntimeMeth odInfo

Related code from .NET proxy class.......... ............... ...

<System.Web.Ser vices.Protocols .SoapRpcMethodA ttribute("", RequestNamespac e:="http://somewebsite", ResponseNamespa ce:="https://somewebsite/method1")>
Public Function method1(ByVal par1 As String, ByVal par2 As String, ByVal par3 As String, ByVal par4 As Long, ByVal par5 As String, ByVal par6 As String, ByVal par7 As Boolean, ByVal par8 As String, ByVal par9 As String, ByVal par10 As String, ByVal par11 As String) As <System.Xml.Ser ialization.Soap ElementAttribut e("method1Retur n")> ResponseMode
Dim results() As Object = Me.Invoke("meth od1", New Object() {par1, par2, par3,_u97 ?mount, par5, par6, par7, par8, par9, par10, par11}

Return CType(results(0 ),ResponseModel
End Functio

<System.Xml.Ser ialization.Soap TypeAttribute(" ResponseModel", "http://somewebsite")>
Public Class ResponseMode

Public ret1 As Strin

Public ret2 As Strin

Public ret 3 As Strin

Public paymentItems() As PaymentIte
End Clas

<System.Xml.Ser ialization.Soap TypeAttribute(" PaymentItem", "http://somewebsite")>
Public Class PaymentIte

Public ret4 As Strin

Public ret5 As Strin

Public ret6 As String
End Class
Here is the VB.NET code........... ............... ...

Dim SoapRequest As New C2PTest.SOAPPay mentServiceServ ice
Dim C2PResult As New C2PTest.Respons eModel
Dim Dict As New Collections.Spe cialized.String Dictionary
C2PResult = SoapRequest.met hod1(Dict("par1 "), Dict("par2"), Dict("par3"), Dict("par4"), _
Dict("par5"), Dict("Par6"), Dict("par7"), Dict("par8"), Dict("par9"), _
Dict("par10"), Dict("par11"))
Here is the WSDL file........... ............... ...

<wsdl:definitio ns targetNamespace ="https://somewebsite/method1" xmlns="http://schemas.xmlsoap .org/wsdl/" xmlns:apachesoa p="http://xml.apache.org/xml-soap" xmlns:impl="htt ps://somewebsite/method1" xmlns:intf="htt ps://somewebsite/method1" xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/" xmlns:tns1="htt p://somewebsite" xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/" xmlns:wsdlsoap= "http://schemas.xmlsoap .org/wsdl/soap/" xmlns:xsd="http ://www.w3.org/2001/XMLSchema">
<schema targetNamespace ="http://somewebsite" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http ://schemas.xmlsoap .org/soap/encoding/"/>
<complexType name="PaymentIt em">
<element name="ret4" nillable="true" type="xsd:strin g"/>
<element name="ret5" nillable="true" type="xsd:strin g"/>
<element name="ret6" nillable="true" type="xsd:strin g"/>
<complexType name="ResponseM odel">
<element name="ret1" nillable="true" type="xsd:strin g"/>
<element name="ret2" nillable="true" type="xsd:strin g"/>
<element name="ret3" nillable="true" type="xsd:strin g"/>
<element name="paymentIt ems" nillable="true" type="impl:Arra yOf_tns1_Paymen tItem"/>
<schema targetNamespace ="https://somewebsite/method1" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http ://schemas.xmlsoap .org/soap/encoding/"/>
<complexType name="ArrayOf_t ns1_PaymentItem ">
<complexContent >
<restriction base="soapenc:A rray">
<attribute ref="soapenc:ar rayType" wsdl:arrayType= "tns1:PaymentIt em[]"/>
<wsdl:message name="method1Re quest">
<wsdl:part name="par1" type="xsd:strin g"/>
<wsdl:part name="par2" type="xsd:strin g"/>
<wsdl:part name="par3" type="xsd:strin g"/>
<wsdl:part name="par4" type="xsd:long"/>
<wsdl:part name="par5" type="xsd:strin g"/>
<wsdl:part name="par6" type="xsd:strin g"/>
<wsdl:part name="par7" type="xsd:boole an"/>
<wsdl:part name="par8" type="xsd:strin g"/>
<wsdl:part name="par9" type="xsd:strin g"/>
<wsdl:part name="par10" type="xsd:strin g"/>
<wsdl:part name="par11" type="xsd:strin g"/>
<wsdl:message name="method1Re sponse">
<wsdl:part name="method1Re turn" type="tns1:Resp onseModel"/>
<wsdl:portTyp e name="SOAPPayme ntService">
<wsdl:operati on name="method1" parameterOrder= "par1 par2 par3 par4 par5 par6 par7 par8 par9 par10 par11">
<wsdl:input message="impl:m ethod1Request" name="method1Re quest"/>
<wsdl:output message="impl:m ethod1Response" name="method1Re sponse"/>
<wsdl:binding name="method1So apBinding" type="impl:SOAP PaymentService" >
<wsdlsoap:bindi ng style="rpc" transport="http ://schemas.xmlsoap .org/soap/http"/>
<wsdl:operati on name="method1">
<wsdlsoap:opera tion soapAction=""/>
<wsdl:input name="method1Re quest">
<wsdlsoap:bod y encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/" namespace="http ://somewebsite" use="encoded"/>
<wsdl:output name="method1Re sponse">
<wsdlsoap:bod y encodingStyle=" http://schemas.xmlsoap .org/soap/encoding/" namespace="http s://somewebsite/method1" use="encoded"/>
<wsdl:service name="SOAPPayme ntServiceServic e">
<wsdl:port binding="impl:m ethod1SoapBindi ng" name="method1">
<wsdlsoap:addre ss location="https ://somewebsite/method1"/>
</wsdl:definition s>

Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
Nov 18 '05 #1
0 2486

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: psy000 | last post by:
Hi, I have a C# web service client that talks to a JAVA application sever. I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy stub c# code. When I try to use c# client connect to application server, I did not get the result in the C# client side, I used a soap monitor to look at the SOAP messages that were exchanged, I can see server returned a correct SOAP message, but the C# client failed to deserialize the XML...
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
by: JLJ | last post by:
I have a very simple webservice written in Java/Axis. It takes in a complexType with 2 string elements, userid and password. The response is a complexType containing two complexTypes each having 2 strings <wsdl:portType name=SecurityLoginService"> <wsdl:operation name="login"> <wsdl:input message="tns:loginRequest" name="loginRequest"/> <wsdl:output message="tns:loginResponse" name="loginResponse"/> </wsdl:operation> </wsdl:portType>
by: Parag Mahajan | last post by:
Hi, I am developing a .Net client for Axis 1.1 web service written in java. The wsdl is generated using, java2WSDL with these switches:: -y WRAPPED -u LITERAL The login service which returns a session Id, is null, after deserializing, but when the XML passing over wire is seen, I can see the session Id being returned. But if in the client proxy code, if I changed the "Use" property from Literal to Encoded, .Net client is able to...
by: Samudrala | last post by:
Hi, I have developed a web service developed in C#. the WSDL I gave is working fine with .net client. But when java client consumes it always raising exception. I have basic knowledge of java too but never worked on consuming/producing web services. can any body send sample source code for java client so that i can test my web service in java client. thanx in advance samudrala
by: perschrotti | last post by:
I have simple .NET webservice coded in C# running on IIS 5 windows 2000 sp4 with .NET framework 1.1. I have a client coded in java with a webservice client stub generated by wsdl2java (axis). After doing some monitoring on the server box I noticed that connections were not closed but stacked up with the status TIME_WAIT and were not closed until windows timed them out after 3 minutes. This can be very resource consuming if you have...
by: cjharrelson | last post by:
I am trying to consume a .NET web service using UsernameToken plain text password authentication. Here is my .wsdd configuration file: <!-- Using the WSDoAllSender security handler in request flow --> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
by: Philip Reimer | last post by:
Hello. We have here a Java web service that has been created using Apache Axis 1.4, using the document/literal wrapped style, and returns complex types in its methods. When consuming the web service with a C# client, all the fields in the returned objects are null. The SOAP message, however, contains all the expected data.
by: Siyodia | last post by:
This is a java program which i need to run facing compilation error Its consuming a third party web service method I have the supported files(folder) which contain necessary class files org/apache/axis The following is what i need to do but am unable to do //////////////////////////////////////////////////////////////////////////////////////////// set classpath where the below jars are located.... axis.jar commons-discovery.jar
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.