AboutSyed Rizwan Muhammad Rizvi Expertise I can answers questions regarding web based and desktop based programming in VB.Net. Which can include SOAP, XML, Custom Controls, COM Interoperability etc.
Experience Have been working in this specific area for last 2 years previously I was a VB 6 Developer with experties in other languages as well. Total 10 years of programming experience.
Expert: Syed Rizwan Muhammad Rizvi Date: 1/15/2007 Subject: ASP. NET Web services and objects - VS.Net 2005
Question Thank you for looking in to this problem. When I call the product service from the client app, the product object gets populated, but when the End Function statement is executed in the service and the product is returned it gives me this error
"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> "
-----relevant code follows----------
'_market product is a class that looks like this and is referenced in both the client app and prod service
Public Class marketProduct
Public productNumber As String
Public productName As String
Public unitPrice As Decimal
Public Sub New()
End Sub
End Class
________________________
'asp,net client application that calls the product service
Private Function getproducts()
Dim aProduct As New productLibrary.marketProduct
Dim aProductService As New prodService.prodService
aProduct = aProductService.getProds("001")
End Function
____________________
'prod Service
<WebMethod()> _
Public Function getProds(ByVal aProductID As String) As Object
Dim aProduct As New productLibrary.marketProduct
aProduct.productName = "Phil"
aProduct.productNumber = "0001"
aProduct.unitPrice = 1.5
Return aProduct
End Function
-------------------------------------------
The text above is a follow-up to ...
-----Question-----
I have a web service that accepts a productID as a parameter, instantiates a product class and fills in the 3 attributes that the class contains and returns the product object.
This web service is called by an asp.net client that sends
a productID as a parameter and expects a product Object back.
When the object is returned I get this exception
"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.InvalidOperationException: There was an error generating the XML document. ---> "
-----Answer-----
You need to paste the ccode so I can see whats wrong and where.
Answer The code that you have sent me doesnt seem to be causing any trouble, if you can run your webservice through .net IDE then you can easily debug this error as to which line is causing the problem.
The solution is to add another desktop project to the same solution and add references to that webservice and run the app in debug mode, incase of any error the specific line will be displayed.
Also try ctype function to convert object type variables to the sepcific data type.