Reputation: 522
I want to connect with SOAP to SAP and have received a WSDL
file. After import of the file as a Service Reference SOAPService
I've now these classes available:
SOAPService.IMPORT1
Namespace myComp.SoapSap
myComp.SoapSap.INTERFACE_HEAD
myComp.SoapSap.INTERFACE_POS
myComp.SoapSap.IMPORT
I'm new to SOAP
and SAP
and do not know how to connect through SOAP
to SAP
. This is what I've done so far:
Dim soapClient As New myComp.SoapSap.IMPORT
Dim soapHead(1) As New myComp.SoapSap.INTERFACE_HEAD
Dim soapPos(1) As New myComp.SoapSap.INTERFACE_POS
Dim client2 As New SOAPService.IMPORT1
soapClient.Url = "http://" & AppServer
Dim Cred As New System.Net.NetworkCredential(User, Passwd)
soapClient.Credentials = Cred
client2.IV_PRODUCT = "/MYCOMP/ABCD"
client2.IV_IMAGE = Convert.FromBase64String(base64_doc)
client2.IV_FILENAME = _batch.UserProperty("Filename")
client2.IV_EML = Nothing
soapHead(0) = New myComp.SoapSap.INTERFACE_HEAD
soapHead(0).FIELD = "testheadfield"
soapHead(0).VALUE = "testposfield"
soappos(0) = New myComp.SoapSap.INTERFACE_POS
soappos(0).FIELD = "testposfield"
soappos(0).VALUE = "testposvalue"
soappos(0).LINE = "testposline"
client2.IT_HEAD = soapHead 'Error see below
soapClient.IMPORT(soapHead, soappos, client2.IV_EML, client2.IV_FILENAME, client2.IV_IMAGE, client2.IV_PRODUCT, client2.IV_REIMPORT) 'Error 404
Description of the Error:
client2.IT_HEAD
Mouseover: (field) Exp.SOAPService.IMPORT1.IT_HEAD As Exp.SOAPService.INTERFACE_HEAD()
client2.IT_HEAD = soapHead()
Error: Number of indices is less than the number of dimensions of the indexed array
client2.IT_HEAD = soapHead(0)
Error: Value of type 'INTERFACE_HEAD' cannot be converted to 'INTERFACE_HEAD()'
client2.IT_HEAD = soapHead
Error: Value of type INTERFACE_HEAD() cannot be converted to INTERFACE_HEAD() because INTERFACE_HEAD is not derived from INTERFACE_HEAD
When I try to run soapClient.IMPORT()
I get a 404
error. Anybody knows how to do a proper connect and what client2.IT_HEAD
expects as a value? Have I declared the array soapHead()
wrong?
Upvotes: 0
Views: 22
Reputation: 522
myComp.SoapSap.INTERFACE_HEAD
and Exp.SOAPService.INTERFACE_HEAD
are in two different namespaces. Therefore the error: Value of type INTERFACE_HEAD() cannot be converted to INTERFACE_HEAD()
Upvotes: 0