Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Serialization Problems In Powerbuilder 11

Status
Not open for further replies.

alfa123456

Programmer
Dec 30, 2009
4
0
0
GR
Hi
I'm using PB 11.2 built 8739
I have a wsdl file and I'm trying to use serialization classes in my
PB APP.
I wrote the below code

po_header.PO_No=mystring2'

po_header.mystring='mystring'

#if defined PBDOTNET THEN
@system.object SO
SO=create dt_purchaseorder_header
SO=po_header

@System.Xml.Serialization.XmlSerializer serializer

serializer=CREATE @System.Xml.Serialization.XmlSerializer(SO.gettype
())

@System.IO.StreamWriter WriteFileStream
WriteFileStream = create @System.IO.StreamWriter("C:\XML_TEST
\test.xml")

serializer.Serialize(WriteFileStream, SO)
WriteFileStream.Close()
#end if

But when it comes to the below line of code
serializer.Serialize(WriteFileStream, SO)

I'm getting an exception.
SystemInvalidOperationException void checksupported of object
system.xml.serialization.typedesc

dt_purchaseorder_header contains as public instances two strings.
If I try to serialize the same object in Visual Studio everything
works OK !. So It have to do something with Powerbuilder.
I think it has something to do with the System.Object ? Does not
recognize what type of object it is ? I don't Know.
How can I use serialization classes in Powerbuilder or is it
something I did wrong ?
Thank you
 
Sorry no idea of pb 11 and serialization but ...

in one of your first lines there seems to be a ' missing?

po_header.PO_No=mystring2'

should be
po_header.PO_No='mystring2'


??????????

suppose I'm wrong but just in case it might be that little detail

regards,
Miguel L.
 
Ahhhh. Yes-Missed that . But that is not the reason of the exception.
Thanks anyway.
 
Okay Alpha,

happy to hear so. Sorry not being able to help a little bit more.

(did you try to monitor using depends.exe? It might give you an indication of where things go wrong???)

Happy new year.

regards,
Miguel L.
 
Hi ,
I don't think it will help me a lot. The exception is quite clear. Powerbuilder doesn't like something in the wsdl file. I have tested the same code (of course different syntax)if it is working in VB .NET 2008 and it did work lioke a charm.
Visual Studio can use the serialization without any problem. Although Powerbuilder tells me that I can use .Net assemblies as the matter of fact it can't handle that. Because we are talking about a simple object with just two strings. I don't even imagine what would have happened if I had more complex objects.
Powerbuilder is the problem. Is there any other way to serialize in Powerbuilder ?
 
Sorry Alfa, the only thing that comes to my mind is using a datawindow and do a SaveAs(.... XML!...). and I don´t think that it'll solve your problem.

Why not just use VB .net and create a DLL or ActiveX control that you can call from powerbuilder?

just to give you an idea ...

regards,
Miguel L.
 
Ahhhh. Yes. I can do that and already did but there is a small problem. I VB .NET I don't know what type of object I want to serialize every time. I have to built a Choose case with all the list of objects I will use and this is kind of hardcoding and I don't want to do that.
On the other hand in Powerbuilder I know the objects But the problem is that when I pass the object as an argument in my VB COM function (argument System.Object) I get a system.dbnull. Meaning that VS does not recognize my object which is fair enough but it is still a problem. That is why I wanted to do this in Powerbuilder because my app is in PB.
No matter what kind of method I will finally use in VS 2008 I with the same code as I mentioned before I can get my object serialized. But PB 11 I think it has a HUGE BUG and even if it gives you the way to serialize it doesn't support it.
Anyway. I don't think that I will do it without the choose case in VS 2008 because PB says that supports .NET assemblies in theory but .....
Thank you for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top