0
當我嘗試從C#代碼訪問託管在Tomcat中的Web服務時,出現如下錯誤消息。從dot net客戶端調用Java webservice
There was an error in serializing body of message searchRepositoriesRequest: '
Unable to generate a temporary class (result=1).
error CS0266: Cannot implicitly convert type 'object' to 'object[]'. An explicit
conversion exists (are you missing a cast?)
error CS0266: Cannot implicitly convert type 'object' to 'object[]'. An explicit
conversion exists (are you missing a cast?)
error CS0266: Cannot implicitly convert type 'object' to 'object[]'. An explicit
conversion exists (are you missing a cast?)
'. Please see InnerException for more details.
有人能幫助我嗎?請參考下面給出的堆棧跟蹤。
Server stack trace:
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBo
dy(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDes
cription messageDescription, Object returnValue, Object[] parameters, Boolean is
Request)
at System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(Xm
lDictionaryWriter writer, MessageVersion version, Object[] parameters, Object re
turnValue, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessag
e.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWri
ter writer)
at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDict
ionaryWriter writer)
at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter wr
iter)
at System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writ
er)
at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message me
ssage, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.
WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager,
Int32 messageOffset)
at System.ServiceModel.Channels.HttpOutput.SerializeBufferedMessage(Message m
essage)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpCha
nnelRequest.SendRequest(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeS
pan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message messag
e, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan tim
eout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean on
eway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCall
Message methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at WSTesting2.SBS.SBSQueryService.searchRepositories(searchRepositoriesReques
t request)
at WSTesting2.SBS.SBSQueryServiceClient.WSTesting2.SBS.SBSQueryService.search
Repositories(searchRepositoriesRequest request) in E:\Tetsngs\WSTesting2\Service
References\SBS\Reference.cs:line 2253
at WSTesting2.SBS.SBSQueryServiceClient.searchRepositories(searchRequest arg0
) in E:\Tetsngs\WSTesting2\Service References\SBS\Reference.cs:line 2259
at WSTesting2.Program.Main(String[] args) in E:\Tetsngs\WSTesting2\Program.cs
:line 66Press any key to continue . . .
是一個Java堆棧跟蹤或C#堆棧跟蹤?如果是後者,也許你應該添加C#標籤。 – 2009-09-11 08:41:27
請提供WSDL文件。這將幫助我們幫助你。 ;) – KB22 2009-09-11 08:49:46
@Thomas,添加了C#標記,以便知道C#和.Net的人可以查看堆棧跟蹤來幫助解決問題。無論是控制檯應用程序,WinForms應用程序還是ASP.Net頁面或多或少都不相關。 – 2009-09-11 08:58:02