cancel
Showing results for 
Search instead for 
Did you mean: 

Consume Web service problem, SAP connector

Former Member
0 Kudos

I have made a test web service on our test server which uses the RFC "SD_Customer_Rfc_Get". When I test this service Local on the server it returns its XML data as expected. I then made an other application that consume this web service. I would like some tips on how the code should look like. This is what I have:

Private Sub cmd_test_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_test.Click

Dim oservice As New CustomerList.RFCCustService

Dim dt As New DataTable

dt = oservice.CustomerWebService(CustNo.Text, CustName.Text)

End Sub

But I get compile error:
dobra\wwwroot\SAP connect vb\test_webservice.aspx.vb(35): Value of type '1-dimensional array of SAP_connect_vb.CustomerList.BRFCKNA1' cannot be converted to 'System.Data.DataTable'.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

When you expose a NCo-Proxy as web service, all SAPTables will be returned as array of the underlying structure. If you need a DataTable, you must convert either on WebService side or on client.

Client side:

dim a() as SAP_connect_vb.CustomerList.BRFCKNA1

a = oservice.CustomerWebService(CustNo.Text, CustName.Text)

' convert a to DataTable...

For the WebService Side I would anyway recommend not to expose the proxy directly but instead to define the WebService methods to the clients needs and do the necessary conversion and additional locgic (C# syntax):

class MyWebService

{

[WebMethod]

public DataTable GetList(string filter)

{

SAPProxy1 proxy = GetProxy();

// ...

BRFCKNA1Table result = proxy.GetCustomerList(...);

// ...

return result.ToAdoTable();

}

}

Former Member
0 Kudos

Thanks for Your answer!

I get no rows returned. Perhaps this is an autorisation problem? (But I don't get any error message)

My code on the client is now:

Dim oservice As New CustomerList.RFCCustService

Dim a() As CustomerList.BRFCKNA1

oservice.Credentials = System.Net.CredentialCache.DefaultCredentials

oservice.PreAuthenticate = True

a = oservice.CustomerWebService(CustNo.Text, CustName.Text)

dg.DataSource = a

' dg is a datagrid.

reiner_hille-doering
Active Contributor
0 Kudos

I don't think that this is related to permissions. More likely the filter is somehow lost or changed on the way.

Best you debug the web service and see where the data is lost.

reiner_hille-doering
Active Contributor
0 Kudos

In the meantime I have the feeling that I misunderstood you. You are NOT using SAP .NET Connector, but the Soap Processor, right? (You connect directly from .NET to ABAP-Web Services?).

So you can ignore some of my answers. The problem that returned data from a ABAP-function does not receive correctly is know. It is caused by a difference between the WSDL and the sent XML, regarding elementFormDefault attribute. As far as I remember the sent XML is allways elementFormDefault="unqualified", but the WSDL does not always contain the declaration. You can fix this by:

- applying a kern patch (don't ask me for exact number) and recreate WSDL/proxy.

- or change the WSLD by hand

- or change the generated proxy (Form:=ElementFormDefault.Unqualified).

Former Member
0 Kudos

No i'm using the SAP .NET connector.

reiner_hille-doering
Active Contributor
0 Kudos

Ok. Then could you please describe the overall architecture, e.g.

WinFormClient <-Soap-> ASP.NET WebService <-----> ABAP

Former Member
0 Kudos

Thanks for your passion with me (I'm a newcomer to web services).

I use this architecture:

ASP.NET form (vb) <Soap> ASP.NET WebService (c#) <---> ABAP RFC.

reiner_hille-doering
Active Contributor
0 Kudos

Ok, than (almost) all of my answers are correct.

Answers (0)