cancel
Showing results for 
Search instead for 
Did you mean: 

Tables in the RFC web serice from .net

Former Member
0 Kudos

I am trying to call the RFC webservice in SAPWS 6.2, calling from .NET using the Web Reference functionality not the .NET adaptor. I get the the simple function module calls with imports and export working just fine, however when I try to call a service that returns a table, like

SD_RFC_CUSTOMER_GET, the web reference creates a public sub instead of a public function, and I cannot get the data returned. I trace the call on the ICM in SAP and actually see the data coming in in a different, I actually think the issue is in the way I am calling the

web service from .NET.

Does anyone have sample code of a call to a RFC web service receiving and returning a table?

Thanks

Stephen Taylor

Accepted Solutions (1)

Accepted Solutions (1)

reiner_hille-doering
Active Contributor
0 Kudos

This should definitely work. I assume that something is wrongly configured. The fact that .NET is not creating a return paramters sounds like the WSDL doesn't contain a response message (or an empty one). Can you please check the WSDL?

Former Member
0 Kudos

Thanks for your input. I traced the call on the ICM side and compared it against a call that worked (from infopath) and this is what I got:

called from .net

<soap:Body><SD_RFC_CUSTOMER_GET xmlns="urn:sap-

com:document:sap:rfc:functions"><KUNNR xmlns="" /><NAME1

xmlns="">A*</NAME1></SD_RFC_CUSTOMER_GET></soap:Body></soap:Envelope>

called from infopath

<SOAP-ENV:Body><s0:SD_RFC_CUSTOMER_GET xmlns:s0="urn:sap-

com:document:sap:rfc:functions">.....<CUSTOMER_T>......<item>.......<KUNNR></KUNNR>.......<ANRED></ANRED>.......<NAME1></

NAME1>.......<PFACH></PFACH>.......<STRAS></STRAS>.......<PSTLZ></PSTLZ>.......<ORT01></ORT01>.......<TELF1></TELF1>.....

..<TELFX></TELFX>......</item>.....</CUSTOMER_T>.....<KUNNR></KUNNR>.....<NAME1>A*</NAME1>....</s0:SD_RFC_CUSTOMER_GET></

SOAP-ENV:Body></SOAP-ENV:Envelope>

It seems I need to include the table. Also could it be that the sub is created instead of a function because the table is being passed as well as received?

Thanks

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

Sorry, you are right: The Sub is created, because the Table is InOut (and ByRef), but you can pass it in empty:

Dim tab() as BRFCKNA

'...

proxy.SD_RFC_CUSTOMER_GET("", "", tab)

"tab" should be filled after the call.

Former Member
0 Kudos

This is the syntax I used:

Dim cust() As xxxxxxx.RFCCUST

Proxy.SD_RFC_CUSTOMER_GET(cust, "", "A*")

Which is the same as yours except for the position of the table, but the table is not returned populated.

Maybe it is someting to do with the type definition, I tried both the simple type WSDL as well as the complex, but the type looks to be the same.

Any ideas? Thanks again for you input.

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

There was a problem with the Soap processor is the past that most inner elements have not been marked with "Unqualified" but have been transfered in empty XML namespace. The effect was that the returned rows (in XMLNamespace "") have not been deserialized.

The problem was fixed with a kernel patch.

Please check the WSDL or VB proxy if you find some "qualified" or "unqualifed" attributes. If there is none of "qualified", the WSDL doesn't fully fit to the transferred data and you nee the kernel patch.

Former Member
0 Kudos

I'll check, but what is strange is that the call from infopath to the same rfc on the same server using the SOAP processor worked fine, have a look at the xml doc differences posted above.

Thanks

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

It's not a problem with XML document, but with the WSDL. .NET is very strict about the XML namespace, maybe InfoPath is not:

If WSDL says that the <item> tags are in namepace "urn:sap-

com:document:sap:rfc:functions" but the arrive in namespace "", the are just ignored (and vice versa). Other Soap implemenations are not so strict and just accept every tag that has the same name.

Former Member
0 Kudos

OK, I checked the VB proxy and cannot find a "qualified", so I guess we need the patch. Is it possible edit the WSDL directly or change the proxy or is it that the WebAS is returning the namespace of "" and that is the fix to get the WebAS to return the correct namespace?

Thanks again for you help.

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

Yes, you can change the WSDL by hand. Can you please post it here or somewhere on the net? Than I could give you some hints what you need to change.

Former Member
0 Kudos

Here it is, thanks again. I tried setting the targetNamespace="", but it seems I need to add the namespace to the other types.

<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:s0="urn:sap-com:document:sap:rfc:functions" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="urn:sap-com:document:sap:rfc:functions"><types><xsd:schema targetNamespace="urn:sap-com:document:sap:rfc:functions"><xsd:element name="SD_RFC_CUSTOMER_GET"><xsd:complexType><xsd:all><xsd:element name="CUSTOMER_T"><xsd:complexType><xsd:sequence><xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="s0:RFCCUST"></xsd:element></xsd:sequence></xsd:complexType></xsd:element><xsd:element name="KUNNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element></xsd:all></xsd:complexType></xsd:element><xsd:element name="SD_RFC_CUSTOMER_GET.Response"><xsd:complexType><xsd:all><xsd:element name="CUSTOMER_T"><xsd:complexType><xsd:sequence><xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="s0:RFCCUST"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:all></xsd:complexType></xsd:element><xsd:complexType name="RFCCUST"><xsd:sequence><xsd:element name="KUNNR" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ANRED" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="15"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="NAME1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PFACH" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="STRAS" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="PSTLZ" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="10"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="ORT01" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="35"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELF1" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="16"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element><xsd:element name="TELFX" minOccurs="0"><xsd:simpleType><xsd:restriction base="xsd:string"><xsd:maxLength value="31"></xsd:maxLength></xsd:restriction></xsd:simpleType></xsd:element></xsd:sequence></xsd:complexType></xsd:schema></types><message name="SD_RFC_CUSTOMER_GETInput"><part name="parameters" element="s0:SD_RFC_CUSTOMER_GET"></part></message><message name="SD_RFC_CUSTOMER_GETOutput"><part name="parameters" element="s0:SD_RFC_CUSTOMER_GET.Response"></part></message><portType name="SD_RFC_CUSTOMER_GETPortType"><operation name="SD_RFC_CUSTOMER_GET"><input message="s0:SD_RFC_CUSTOMER_GETInput"></input><output message="s0:SD_RFC_CUSTOMER_GETOutput"></output></operation></portType><binding name="SD_RFC_CUSTOMER_GETBinding" type="s0:SD_RFC_CUSTOMER_GETPortType"><soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding><operation name="SD_RFC_CUSTOMER_GET"><soap:operation soapAction="http://www.sap.com/SD_RFC_CUSTOMER_GET"></soap:operation><input><soap:body use="literal"></soap:body></input><output><soap:body use="literal"></soap:body></output></operation></binding><service name="SD_RFC_CUSTOMER_GETService"><documentation>SAP Service SD_RFC_CUSTOMER_GET via SOAP</documentation><port name="SD_RFC_CUSTOMER_GETPortType" binding="s0:SD_RFC_CUSTOMER_GETBinding"><soap:address location="http://cssrs1d1.soups.com:8001/sap/bc/soap/rfc"></soap:address></port></service></definitions>

Former Member
0 Kudos

Could you post a WSDL from a 6.4 WebAS rather editing the WSDL I posted (from 6.2), the function module is a standard SAP function "SD_RFC_CUSTOMER_GET".

Thanks

Stephen

reiner_hille-doering
Active Contributor
0 Kudos

Hello Stephen,

sorry for the long delay. I had to test this in detail.

It seems that I was going into the wrong direction: The WSDL that I get from our internal test System is the same and also doesn't contain any of the "unqualified" schema tags. But the following code nicely works:


RfcCustomerGet.SD_RFC_CUSTOMER_GETService service = new TestIndexedProperty.RfcCustomerGet.SD_RFC_CUSTOMER_GETService();
            service.Credentials = new System.Net.NetworkCredential("user", "password");
            RfcCustomerGet.RFCCUST[] result = new RfcCustomerGet.RFCCUST[0];
            service.SD_RFC_CUSTOMER_GET(ref result, "", "A*");
            this.dataGridView1.DataSource = result;
        }

The important line here is "RfcCustomerGet.RFCCUST[] result = new RfcCustomerGet.RFCCUST[0];", which initializes the result array as empty array. I don't know the exactly VB syntax for it, but I'm sure that you find it out.

If I don't do it, but initilize the array to null / Nothing as in your code snipped, the Application Server doesn't return any information.

Hope that solves the problem.

Regards,

Reiner.

Former Member
0 Kudos

Reiner

Your suggestion worked. I used

Dim result(0) As WebApplication1.com.xxxxxx.RFCCUST

and thanks for the credentials line as well, I had authorizations on the node in the WebAS, and was wondering how to send the authority as part of the SOAP request.

This is nice functionality.

Thanks again for your help

Stephen

Answers (0)