Soap Conversion From 7 to 8

(imported topic written by SystemAdmin)

I wrote a VB app that references the Soap interface for the 7.2.5.22 bes server, when I

pointed it to our new 8 server of course nothing even came close to working, is there some

compatibility between the 2 soap interfaces or will i need to rewrite the entire app over again

Dim QueryResults = New BESReference.RelevanceService

Results = QueryResults.GetRelevanceResult(NewBESQuery.Trim.ToLower, “”, “”)

http://forum.bigfix.com/attachment.php?item=326&download=1

(imported comment written by SystemAdmin)

Found one of my problem was I didn’t have all the retrieved properties imported

Dim QueryResults = New BESReference2.RelevanceBinding

Results = QueryResults.GetRelevanceResult(NewBESQuery.Trim.ToLower, “”, “”)

with all the fields imported, when I look at the results in the relevance tester I get an error

Error: There is an error in XML document (5, 5159)

does that mean anything that I can use to troubleshoot this issue

after walking through the query line by line I found this to be the error

, 
"|" , concatenation 
", " of unique values of ( 

if ( exists result from ( bes property 
"command lines for programs run at startup" ) of it ) and ( exists values of result from ( bes property 
"command lines for programs run at startup" ) of it ) then ( values of ( results from ( bes property 
"command lines for programs run at startup" ) of it ) ) 

else 
"<no data>" )

now this is 1 chunk of the data that i return, I have about 70 pieces like this all appended together…

and only when I add this piece of code do i get the XML error

(imported comment written by NoahSalzman)

Random guess: change “” to “no data”

(imported comment written by SystemAdmin)

Nope that wasn’t it…

if clean it all up and place this into the BES Session Relevance Tester

(names of it , 
"|", ( 

if ( exists result from (bes property 
"Command Lines for Programs Run at Startup") of it ) and ( exists values of result from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) then ( values of ( results from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) ) 

else 
"no data" ) ) of bes computers

i get the Error

Error: There is an error in XML document (10,79)

values of ( results from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) of bes computers

Error (10,60)

and the Property “Command Lines for Programs Run at Startup” is

unique values of (

if it ends with 

case insensitive regex 
"\.lnk" AND exists shortcut of file (following text of first 
" " of it) then (it; (
"[Shortcut] " & it) of pathname of shortcut of file (following text of first 
" " of it)) 

else it) of (  (

if (exists key 
"HKLM\Software\Microsoft\Windows\CurrentVersion\Run" whose (exists value whose (exists name of it OR it != 
"") of it) of registry) then ((

if it = 
"" then 

if exists name of it then 
"[Registry] No Command Line" 

else nothing 

else 
"[Registry] " & it as string) of values of keys 
"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\" of (if x64 of operating system then (x32 registry; x64 registry) else registry)) else nothing) ;   (if (exists key "HKCU\Software\Microsoft\Windows\CurrentVersion\Run
" whose (exists value whose (exists name of it OR it != "
") of it) of registry) then ((if it = "
" then if exists name of it then "[Registry] No Command Line
" else nothing else "[Registry] 
" & it as string) of values of keys "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\
" of (if x64 of operating system then (x32 registry; x64 registry) else registry)) else nothing) ;   (if ((name of it contains "Win2000
" OR name of it contains "WinXP
" OR name of it contains "Win2003
") of operating system) then (if (exists folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Start Menu\Programs\Startup
")) then ("[Startup-Folder] 
" & it) of pathnames of files of folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Start Menu\Programs\Startup
") else nothing) ; (if (exists folder (value of variable "USERPROFILE
" of environment as string & "\Start Menu\Programs\Startup
")) then ("[Startup-Folder] 
" & it) of pathnames of files of folder (value of variable "USERPROFILE
" of environment as string & "\Start Menu\Programs\Startup
") else nothing) else if ((name of it contains "WinVista
" OR name of it contains "Win2008
" OR name of it contains "Win7
") of operating system) then (if (exists folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Microsoft\Windows\Start Menu\Programs\Startup
")) then ("[Startup-Folder] 
" & it) of pathnames of files of folder (value of variable "ALLUSERSPROFILE
" of environment as string & "\Microsoft\Windows\Start Menu\Programs\Startup
") else nothing) ; (if (exists folder (value of variable "USERPROFILE
" of environment as string & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
")) then ("[Startup-Folder] 
" & it) of pathnames of files of folder (value of variable "USERPROFILE
" of environment as string & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
") else nothing) else nothing) ;   (if version of client >= "8.0
" then ((if (type of it = exec task action type) then ("[Scheduled] 
" & path of (it as exec task action)) else nothing) of actions of definitions of it ; (if exists paths of it then ("[Scheduled] 
" & it) of paths of it as string else ("[Scheduled] 
" & it) of names of it as string)) of scheduled tasks whose (exists definitions whose (exists triggers whose (type of it is logon task trigger type OR type of it is boot task trigger type) of it) of it AND type of actions of definitions of it = exec task action type) else nothing)  )

and this is the output on the server, could the quotes or braces be breaking the XML ?

Command Lines 

for Programs Run at Startup [Registry] 
"C:\Program Files (x86)\McAfee\Common Framework\udaterui.exe" /StartedFromRunKey [Registry] 
"C:\Program Files (x86)\McAfee\VirusScan Enterprise\SHSTAT.EXE" /STANDALONE [Registry] Ati2mdxx.exe [Registry] C:\Program Files\Altiris\DAgent\dagentui.exe [Registry] C:\Program Files\HP\NCU\cpqteam.exe [Registry] rundll32.exe qlco1006.dll,QLSaveSystemInfo [Scheduled] %windir%\system32\ServerManagerLauncher.exe [Scheduled] %windir%\system32\appidcertstorecheck.exe [Scheduled] %windir%\system32\lpremove.exe [Scheduled] %windir%\system32\rundll32.exe [Scheduled] %windir%\system32\wermgr.exe [Scheduled] \Microsoft\Windows\AppID\VerifiedPublisherCertStoreCheck [Scheduled] \Microsoft\Windows\Autochk\Proxy [Scheduled] \Microsoft\Windows\MUI\LPRemove [Scheduled] \Microsoft\Windows\Server Manager\ServerManager [Scheduled] \Microsoft\Windows\Windows Error Reporting\QueueReporting [Shortcut] C:\Program Files (x86)\EMC\PowerCommon\EmcPowMon.exe [Startup-Folder] C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\PowerPath Monitor.lnk [Startup-Folder] C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini [Startup-Folder] C:\Windows\system32\config\systemprofile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\desktop.ini

(imported comment written by MattBoyd)

I’m not sure if this is a bug or it’s expected behavior, but it looks like control characters aren’t being escaped properly before the web service sends a response back to the client. Some of the results in this query contain control characters. I think that startup entries from the registry were the offenders, at least that’s what I found from my results.

At first I thought it was just null control characters (%00), but it looks like there could be others as well. Here’s what I had to do to get it to work:

substrings separated by 
"||" of concatenation of matches (regex 
"\p{Print}") of characters of concatenation 
"||"  of  values of ( results from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) of bes computers

I don’t know if this is the best way to eliminate control characters, but it seems to work for me. By the way, I don’t know much regex, and I found that pattern after some Googling. A better pattern may exist.

(imported comment written by Lee Wei)

Hi guys,

We have a bug report open (#38567) to track this issue.

I see that 7.2 is successful dealing with a null-terminated return value, but it is failing in 8.0.

Boyd has a good workaround.

I was using a different form, that achieves the same results of getting around the issue:

substrings separated by 
"%00" whose (length of it > 0) of values of results of bes property 
"Your Property".

Lee Wei

(imported comment written by SystemAdmin)

Thanks Guys I see light… :slight_smile:

do you mean replace my query with this…

(names of it, “|”, operating system of it,

values of

(

results from

(

substrings separated by "%00"
whose
(
length of it > 0
)
of values of results of bes property

“Command Lines for Programs Run at Startup”

)

of it

))

of bes computers

Error: The operator “results from” is not defined.

and this doesnt work on either system 7.2 or 8.0

(imported comment written by SystemAdmin)

Got it… Thank You…

( names of it , 
"|" , operating system of it , substrings separated by 
"||" of concatenation of matches ( regex 
"\p{Print}" ) of characters of concatenation 
"||" of values of ( results from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) ) of bes computers

is either one of these more efficient then the other ?

(imported comment written by MattBoyd)

Lee Wei

Hi guys,

We have a bug report open (#38567) to track this issue.
I see that 7.2 is successful dealing with a null-terminated return value, but it is failing in 8.0.

Boyd has a good workaround.
I was using a different form, that achieves the same results of getting around the issue:

substrings separated by
"%00" whose (length of it > 0) of values of results of bes property
"Your Property".

Lee Wei

Just a heads up, I tried something very similar to that to remove all of the null characters, but there were other control characters in the results of this property that were also causing the return value to fail with an XML error. I couldn’t pin down exactly which ones it was though, so I went with the regex pattern.

Mark, I think Lee’s is faster but it depends how many results you’re returning. If it’s only the results of one system it probably won’t matter (just guessing).

(imported comment written by SystemAdmin)

Im returning about 70 properties… most of them are not system properties…

so how would I put

substrings separated by “%00” whose (length of it > 0) of values of results of bes property “Your Property”.

into here

(

names of it , “|” , operating system of it , substrings separated by “||” of concatenation of matches

(

regex “\p{Print}”

)

of characters of concatenation “||” of values of

(

results from

(

bes property “Command Lines for Programs Run at Startup”

)

of it

)

)

of bes computers

and if this is the case I really would have to redo my entire query to add this to each property i retrieve incase theres null chars…

(imported comment written by MattBoyd)

You could replace my regex pattern with Lee’s relevance. If you’re going to use the regex, you don’t need to combine it with Lee’s relevance because the regex will includes “%00”

substrings separated by 
"%00" whose (length of it > 0) of values of ( results from ( bes property 
"Command Lines for Programs Run at Startup" ) of it ) of bes computers

Oh, and don’t think you would have to rewrite your entire query. Just modify your relevance so that all of the values that you’re returning in your clause are filtered with this.

(imported comment written by SystemAdmin)

its not going to be bad, I made a Query builder and just pass it the property name “Command Lines for Programs Run at Startup” and it builds the entire query string

Thank again for helping me figure this out,

(imported comment written by MattBoyd)

Did this get fixed with the 8.0.627 patch?

(imported comment written by Lee Wei)

The issue has been fixed in version 8.1.

That is scheduled for release turn of the year.

(imported comment written by MattBoyd)

Sigh… I’m running into issues with this once again on 8.1.617.0. For a custom web report, EvaluateRelevance() throws this exception:

Error: not well-formed Source File: https:
//asdf:52312/webreports Line: 15, Column: 78 Source Code: <answer>1,Windows|Adobe Acrobat 9 Pro Extended - English, Français, Deutsch

If I run the same query in the Session Relevance Tester, the results are returned successfully, so I think it’s occurring when the xml result is being parsed inside EvaluateRelevance().

Help please?

(imported comment written by Lee Wei)

You can try this statement to rid of control characters:

(concatenations of matches (regex “^%01-%1F”) of substrings separated by “%00” of it) of “test%01 test%00”

Lee Wei