SAP BW xml/a adapter in .net website help!

Joined
Apr 22, 2008
Messages
3
Reaction score
0
I'm trying to integrate a SAPBW connection into my .net website using a SAPBW xml/a adapter. (I've added a web reference to this so I have a .wdsl).
I've basically followed the steps mentioned here:
http://drowningintechnicaldebt.com/.../06/14/using-xml-a-and-c-to-query-sap-bw.aspx

However, I'm stuck with step 3 which shows how to implement the solution for an application rather then a website so it talks about modify the generated webservice proxy??

"Step 3: Modify the WebService Proxy Class, When .NET generates the proxy class it declares the Execute Mehtod with two arguments the ExecuteCommand and a PropertiesType. The PropertiesType is a base class for the DiscoverProperties object, but has no properties. To fix this we actually want to pass a DiscoverProperties object to the Execute Method. While this compiles fine the XML serializer has a problem serializing the request. To fix this add "[XmlElement(typeof(DiscoverProperties))]" before the PropertiesType argument in the Execute Methods Signature. It should look like this "public System.Xml.XmlElement Execute([System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] ExecuteCommand Command, [XmlElement(typeof(DiscoverProperties))]PropertiesType Properties) {"
"

How do I make this sort of change in a .net website. Do I need to modify the webreference wdsl file?

Any help would be very much appreciated because I can't seem to get over this... (please find my code below).
 
Joined
Apr 22, 2008
Messages
3
Reaction score
0
Here's my .net code trying to connect to the xml/a adapter

Imports System
Imports System.Data
Imports System.Xml
Imports System.Collections.Generic
Imports System.Text
Imports System.Net
Imports Microsoft
Imports SAPBW
Imports Microsoft.AnalysisServices.AdomdClient
Imports System.Xml.Serialization
Imports System.Xml.Schema
Imports System.IO

'Namespace SAPBW
<XmlInclude(GetType(_Default))> _
<XmlInclude(GetType(PropertiesType))> _
<XmlInclude(GetType(DiscoverProperties))> _
Partial Class _Default
Inherits System.Web.UI.Page

'Global Variables
Private BWQuery As MsXmlAnalysis
Private Command As ExecuteCommand
Private result As XmlElement
Private convert_result As XmlNodeReader
Private properties As DiscoverProperties
'Private properties As PropertiesType
Private login As NetworkCredential
Private cellset_result As CellSet
Private tuples_on_columns As TupleCollection
Private i As Integer
Private nr_tuples_on_columns As Integer


Protected UN As String = "UserName"
Protected Pass As String = "PassWord"

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
InitializeVariables()

SetVariables()
WriteCommand()
Commands()

End Sub


Private Sub InitializeVariables()

BWQuery = New MsXmlAnalysis()
Command = New ExecuteCommand()
properties = New DiscoverProperties()
properties.PropertyList = New DiscoverPropertiesPropertyList()
login = New NetworkCredential()

End Sub

Private Sub SetVariables()
login.UserName = UN
login.Password = Pass

BWQuery.Credentials = login
BWQuery.PreAuthenticate = True


properties.PropertyList.Content = "SchemaData"
properties.PropertyList.Format = "Multidimensional"
properties.PropertyList.DataSourceInfo = "default"
End Sub

Private Sub WriteCommand()
Command.Statement = "SELECT NON EMPTY { [Measures].[3YIJG796Q2HIRX2ZBG2MMQZNN] } ON COLUMNS, NON EMPTY {[FEEEARNER].[LEVEL01].ALLMEMBERS } ON ROWS FROM [OP_CTIM3/FI_CTIM3_001_V01]"
End Sub

Private Sub Commands()

'Dim s As XmlSerializer = new XmlSerializer(typeof(result))
'<XmlElement(typeof(DiscoverProperties))>
Try
Dim propType As PropertiesType

/********************************************************
**This is the problem as Execute expects (Command, Property)
**however i've populated Discoverproperties attribute but
**cannout pass it without implementing step 3. So I am trying
**to pass BWQuery.Execute(Command, properties)
********************************************************/
result = BWQuery.Execute(Command, propType)
convert_result = New XmlNodeReader(result)

cellset_result = CellSet.LoadXml(convert_result)


Dim i As Integer = 1

For i = 1 To nr_tuples_on_columns
Response.Write(tuples_on_columns(i).Members(0).Caption)
Next
'Console.ReadLine()


Catch ex As Exception
Response.Write(ex.ToString())
End Try
End Sub
End Class
'End Namespace
 
Last edited:
Joined
Aug 19, 2008
Messages
1
Reaction score
0
We had the same issue

We had the same issue. Alot of Sample code doesn't work out there. Including the stuff from Microsoft.
I found a tool called Nexxus SAP Connect. Its a code generator and does the proxy and connection stuff for you. Their website is NexxusPartners.com

Ted
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top