Hi All,
I have a Web Service written in Java (Web Logic) and I am trying to call it
in my ASP. NET client. I am facing a problem while getting the data from the
Web Service Method. My Web Service returns me an object which is a wrapper
around an array of objects. (Earlier I was trying to read the array directly
but could not succeed - so I wrapped that array with another object.)
Now the primary issue is regarding the chunky characters (Some character
data) that I am getting in the SOAP Envelope Response. I trapped the Response
with the TCPTrace and found that the data is getting chunked while transfer.
I am getting the data like this:
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Date: Thu, 17 Mar 2005 02:08:52 GMT
Content-Type: text/xml; charset=UTF-8
Transfer-Encoding: chunked
06ad
<?xml version='1.0' encoding='UTF-8'?><SOAP-ENV:Envelope
xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'><SOAP-ENV:Body><ns0:retrieveEccCashflowResponse
xmlns:ns0='urn:local'
SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'><return
xsi:type='bean:EccCashflowViewDTO' xmlns:bean='java:com.cba.ecc.gateway.msgs'
><cashFlowBusinessPartyId
xsi:type='xsd:string'></cashFlowBusinessPartyId><businessReferenceNumber
xsi:type='xsd:string'>8805010016909</businessReferenceNumber><receiveFlag
xsi:type='xsd:string'>80</receiveFlag><currency
xsi:type='xsd:string'>USD</currency><instructionReceiptMethod
xsi:type='xsd:string'></instructionReceiptMethod><amount
xsi:type='xsd:string'>1637.80</amount><modifyDate
xsi:type='xsd:string'></modifyDate><valueDate
xsi:type='xsd:string'>31-Jan-2005</valueDate><clientID
xsi:type='xsd:string'>10000009</clientID><modifyUserId
xsi:type='xsd:string'></modifyUserId><instructionStatus
xsi:type='xsd:string'>Saved</instructionStatus><authorizationChannelId
xsi:type='xsd:string'></authorizationChannelId><additionalDetails
xsi:type='xsd:string'></additionalDetails><modifyChannelId
xsi:type='xsd:string'></modifyChannelId><tradeSetId
xsi:type='xsd:string'>39063</tradeSetId><instructionReceiptMethodCode
xsi:type='xsd:string'></instructionReceiptMethodCode><instructionName
xsi:type='xsd:string'>Documentary
Trade</instructionName><cashFlowReferenceNumber
xsi:type='xsd:string'>8805010016948</cashFlowReferenceNumber></return></ns0:retrieveEccCashflowResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
0000
In between the data there are some characters which are inserted by HTTP1.1
for chunking. This example shows only one object returned from the Web
Service. AS the objects increase, the chunked data also increase. Because of
this I am unable to deserialize the data on my ASP. NET client.
I get the following exception while doing the same...
System.InvalidOperationException: There is an error in XML document (1,
2998). ---> System.InvalidCastException: Cannot assign object of type
System.Xml.XmlNode[] to an object of type
JavaWSClient.SIWebService.CashflowViewList.
at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read18_retrieveCashflowsResponse()
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader
xmlReader, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at
JavaWSClient.SIWebService.ECCGatewayServiceWse.retrieveCashflows(String arg0,
String arg1, String arg2, String arg3, String arg4, String arg5, String arg6)
in C:\Vaibhav\JavaWSClient\Web References\SIWebService\Reference.vb:line 78
at JavaWSClient.Form1.btnTestWS_Click(Object sender, EventArgs e) in
C:\Vaibhav\JavaWSClient\Form1.vb:line 84
I don't know whether the error is coming because of the Encoding (encoded
instead of literal) or something else.
By default Web logic is returning me the WSDL with "RPC/Encoded" Encoding.
Please help me with some pointer regarding the error message that I am
getting at the client application. I am totally struck with the same and am
not in a position to proceed further.
recoil@community.nospam - 21 Mar 2005 15:41 GMT
I would attempt to packet sniff the data on the server side to see how
the server is receiving it.
I am not sure what your web service parameters and return value is but
you should determine if the error is happening upon parsing the input
or upon parsing the output.
System.InvalidCastException: Cannot assign object of type
System.Xml.XmlNode[] to an object of type
JavaWSClient.SIWebService.CashflowViewList.
at
the actual exception is that which basically states that somewhere
along the line it had an XmlNode[] (array of xml nodes) and tried
casting it to your CashflowViewList