on 09-09-2009 5:53 AM
Has anyone got a working example of this? I always get an "Invalid XML File" error.
Hi,
It means that the xml you passed in is not correct from the prespective of the BO.
The typical way to do this is:
- Get a BO object by key
- Call ToXMLString() method and check the structure of the xml content
- Program your code to prepare the xml with the same structure.
Regards,
Tedy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
Could u explain bit more
i mean when ur getting error..?
Firos
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here are some more details. Also there is no GetByKey() or ToXMLString() function on the SAPbobsCOM.Messages object.
Dim oMSG As SAPbobsCOM.Messages = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oMessages)
oMSG = oCompany.GetBusinessObjectFromXML("C:\iBOLT2.5\projects\Alert\test.xml", 0) '<-error happens here
Contents of test.xml file
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<BOM>
<BO>
<Messages>
<row>
<Priority>pr_High</Priority>
<Subject>subject</Subject>
<MessageText>body</MessageText>
</row>
</Messages>
<Recipients>
<row>
<UserType>rt_InternalUser</UserType>
<UserCode>manager</UserCode>
<SendInternal>tYES</SendInternal>
</row>
</Recipients>
</BO>
</BOM>
Yes you are right that specifically Message object has no GetByKey method.
I suppose to provide a general method to know how the acceptable xml per each BO would be like.
In addition to my original method, for all BO w/o GetByKey, usually there is a corresponsent service object to get a BO. For example, for Messge object, call MessagesService.GetMessage(header) to get a Message object.
Cheers,
Tedy
Still no luck. I tried generating the XML schema with GetBusinessObjectXmlSchema(SAPbobsCOM.BoObjectTypes.oMessages) which changed my XML file slightly, but I'm still getting the same error. I'll have to open a support ticket. Thanks for the help.
<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
<BOM>
<BO>
<OALR>
<row>
<Priority>pr_High</Priority>
<Subject>test subject</Subject>
<UserText>test body</UserText>
</row>
</OALR>
<AOB1>
<row>
<ObjType>rt_InternalUser</ObjType>
<ObjCode>manager</ObjCode>
<SendIntrnl>tYES</SendIntrnl>
</row>
</AOB1>
</BO>
</BOM>
Hi Mark,
I also met the error you mentioned when I gave it a little try. I verify that your xml attached is valid against the schema from calling GetBusinessObjectXmlSchema method. It should be a bug.
From the DI help, you may try the MessagesService Object and GetDataInterfaceFromXMLFile method. Caution that the xml payload would be different.
Good luck.
Tedy
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.