on 11-22-2005 12:52 PM
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!
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();
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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).
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.