cancel
Showing results for 
Search instead for 
Did you mean: 

Service Reference .NET 2008

Former Member
0 Kudos

Hello everyone

I'm trying to get an set data from vs2008, Framework 3.5

i added a service reference to WSDL that i created in SAP

i used RFC Style to get the reference, however i get an error

"Unrecognized message version." i would like to know

how to connect SAP web service with .NET 2008 Framework 3.5,

is someone encounter this problems?

Thanks Emmanuel

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Emmanuel,

I have the same problem.

Can you give me some help?

Regards,

Anders

Former Member
0 Kudos

Thank you for again,

The probelm was that in th configurantion i

linked the WSDL instead of the web service URL,

Thank you again.

Emmanuel RUBIN

Former Member
0 Kudos

Dear William

1) Yes i used Service reference in vs2008 (Framework 3.5).

2) The namespace is Namespace="urn:sap-com:document:sap:rfc:functions" the

Difference is that i don't have :mc-style. (From SAP i used RFC style)

3) The function is not even get into SAP because i dumped the Function module,

and don't see any addition dump in transaction ST22.

4) thank you for the refactoring however i didn't overcome this problem yet.

I would like to know if you have any other idea.

Thank you Emmanuel RUBIN

Former Member
0 Kudos

Hi Emmanuel,

wrt "3) The function is not even get into SAP because i dumped the Function module,

and don't see any addition dump in transaction ST22."

when you debug the .NET client side, at what source line do you get the runtime error;

is it at opening the proxy, or when trying to invoke the Z_CURRENCY method ?

In case of the latter, does your SAP webservice (and thus the SAP function module behind) also exposes a method with a 'simpler' signature; preferable one without method-parameters, but otherwise also one without a ref-param;

if so, do you also get an error upon trying to invoke one of these 'simpler' methods.

Best regards, William.

Former Member
0 Kudos

Dear William

First thank you for your answer!

Also I was encounter this problem that you mentioned (1)

I was able to overcome this problem, but still

Have an exception "Unrecognized message version."

For the following code: (the RFC function is a returning

Current list with no obligatory parameters)

static void Main(string[] args)

{

// create a proxy object

Currency.Z_CURRENCYClient myProxy = new ConsoleApplication16.Currency.Z_CURRENCYClient();

// set SAP credentials

myProxy.ClientCredentials.UserName.UserName = "DIDER";

myProxy.ClientCredentials.UserName.Password = "123456";

// SAP table

Currency.TCURR[] dateRangeA = new ConsoleApplication16.Currency.TCURR[0];

try

{

myProxy.Open();

myProxy.Z_CURRENCY("20090806", "1", "", ref dateRangeA);

myProxy.Close();

}

catch (Exception Ex) { Console.Write(Ex.Message); }

Console.ReadLine();

}

Best regards Emmanuel RUBIN

Former Member
0 Kudos

Hi Emmanuel,

1) did you create your SAP WS proxy via 'Add Service Reference' in VS 2008 ?

2) how does the generated proxy code, including interface, dto-classes, look like ?

In particular, what is the XML-namespace for the ServiceContractAttribute, XmlTypeAttribute; it is < Namespace="urn:sap-com:document:sap:soap:functions:mc-style" > ?

3) at what code statement do you get the runtime error; is it at myProxy.Z_CURRENCY("20090806", "1", "", ref dateRangeA); ?

4) I suggest a little refactoring to your code structure:

try

{

using(Currency.Z_CURRENCYClient myProxy = new ConsoleApplication16.Currency.Z_CURRENCYClient())

{

// set SAP credentials

myProxy.ClientCredentials.UserName.UserName = "DIDER";

myProxy.ClientCredentials.UserName.Password = "123456";

// SAP table

Currency.TCURR[] dateRangeA = new ConsoleApplication16.Currency.TCURR[0];

myProxy.Z_CURRENCY("20090806", "1", "", ref dateRangeA);

}

} catch (Exception ex) {Console.Write(Ex.Message); }

Best regards, William.

Former Member
0 Kudos

Hi Emmanuel,

I've successfully connected from .NET as WCF client to a generated SAP BAPI webservice.

2 pecularities to be aware of are the following wrt the generated wsdl for the SAP webservice:

1) SAP also uses 'System' as phrase in its .wsdl definition; at runtime this will collapse with the standard System namespace at the WCF proxy side. This is easily remedied by renaming in the wsdl, eg rename to all capital SYSTEM

2) rename in the wsdl all instances of phrase "parameters" to "parameter". This is required to be able to read the WebService methods within VS 2008.

Hope this solves your problem, if not please let us know.

Best regards, William.

Former Member
0 Kudos

Hi William,

It seems you are an expert in such area, can you give me some instructions?

Do you have m a i l , or ..... ?

Thanks and best regards,

Anders,

Former Member
0 Kudos

Hi Anders,

I'm a .NET / SharePoint developer, with special focus on SAP / MS interoperability. As such I've gained theoretical and (more important) practical experience in this area. See my blog [Thoughts on SharePoint Development|http://williamvanstrien.blogspot.com/] for some related entries.

Wrt my contact details; I've no problem of sharing that (it's in my forum [profile|http://forums.sdn.sap.com/profile.jspa?userID=3970316]). However I do urge you do consider posting your questions via this forum, so that all interested in the subject may benefit from problem description and (hopefully) resolution[s] suggested by any of the forum subscribers.

Best regards, William.

Former Member
0 Kudos

Hi William,

Thanks very much and I understand your idea.

I'll first ask questions in this forum and if we still not able solve the problem, I'll write you an e-mail.

Thanks and best regards,

Anders

Former Member
0 Kudos

Hi William,

Can you tell me how to get the web service URL ?

for example, if my service name is ws_ssc_usr_get_user_list

and the WSDL file is

<?xml version="1.0" encoding="utf-8" ?>

- <wsdl:definitions targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:n1="urn:sap-com:document:sap:rfc:functions">

- <wsdl:documentation>

<sidl:sidl xmlns:sidl="http://www.sap.com/2007/03/sidl" />

</wsdl:documentation>

<wsp:UsingPolicy wsdl:required="true" />

- <wsp:Policy wsu:Id="IF_ws_ssc_usr_get_user_list">

- <sapsession:Session xmlns:sapsession="http://www.sap.com/webas/630/soap/features/session/">

<sapsession:enableSession>false</sapsession:enableSession>

</sapsession:Session>

</wsp:Policy>

- <wsp:Policy wsu:Id="OP_SscUsrGetUserList">

<sapblock:enableBlocking xmlns:sapblock="http://www.sap.com/NW05/soap/features/blocking/">true</sapblock:enableBlocking>

<sapcomhnd:enableCommit xmlns:sapcomhnd="http://www.sap.com/NW05/soap/features/commit/">false</sapcomhnd:enableCommit>

<saptrhnw05:required xmlns:saptrhnw05="http://www.sap.com/NW05/soap/features/transaction/">no</saptrhnw05:required>

<saprmnw05:enableWSRM xmlns:saprmnw05="http://www.sap.com/NW05/soap/features/wsrm/">false</saprmnw05:enableWSRM>

</wsp:Policy>

- <wsdl:types>

- <xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:rfc:functions">

- <xsd:simpleType name="char1">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="1" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char128">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="128" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char32">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="32" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="char4">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="4" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="clnt3">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="3" />

</xsd:restriction>

</xsd:simpleType>

- <xsd:simpleType name="date">

- <xsd:restriction base="xsd:string">

<xsd:maxLength value="10" />

<xsd:pattern value="\d\d\d\d-\d\d-\d\d" />

</xsd:restriction>

</xsd:simpleType>

</xsd:schema>

- <xsd:schema attributeFormDefault="qualified" targetNamespace="urn:sap-com:document:sap:soap:functions:mc-style" xmlns:n0="urn:sap-com:document:sap:rfc:functions">

<xsd:import namespace="urn:sap-com:document:sap:rfc:functions" />

- <xsd:complexType name="SscUsrUserBas">

- <xsd:sequence>

<xsd:element name="Mandt" type="n0:clnt3" />

<xsd:element name="Guid" type="n0:char32" />

<xsd:element name="Id" type="xsd:int" />

<xsd:element name="UserName" type="n0:char32" />

<xsd:element name="UserPassword" type="n0:char32" />

<xsd:element name="EMail" type="n0:char128" />

<xsd:element name="BasAuthority" type="xsd:int" />

<xsd:element name="Status" type="n0:char4" />

<xsd:element name="Points" type="xsd:int" />

<xsd:element name="CreatedAt" type="n0:date" />

<xsd:element name="ChangedAt" type="n0:date" />

<xsd:element name="LastLoginAt" type="n0:date" />

<xsd:element name="IsValid" type="n0:char1" />

</xsd:sequence>

</xsd:complexType>

- <xsd:complexType name="TypTUserList">

- <xsd:sequence>

<xsd:element name="item" type="tns:SscUsrUserBas" minOccurs="0" maxOccurs="unbounded" />

</xsd:sequence>

</xsd:complexType>

- <xsd:element name="SscUsrGetUserList">

- <xsd:complexType>

<xsd:sequence />

</xsd:complexType>

</xsd:element>

- <xsd:element name="SscUsrGetUserListResponse">

- <xsd:complexType>

- <xsd:sequence>

<xsd:element name="EtUserList" type="tns:TypTUserList" />

</xsd:sequence>

</xsd:complexType>

</xsd:element>

</xsd:schema>

</wsdl:types>

- <wsdl:message name="SscUsrGetUserList">

<wsdl:part name="parameters" element="tns:SscUsrGetUserList" />

</wsdl:message>

- <wsdl:message name="SscUsrGetUserListResponse">

<wsdl:part name="parameters" element="tns:SscUsrGetUserListResponse" />

</wsdl:message>

- <wsdl:portType name="ws_ssc_usr_get_user_list">

- <wsp:Policy>

<wsp:PolicyReference URI="#IF_ws_ssc_usr_get_user_list" />

</wsp:Policy>

- <wsdl:operation name="SscUsrGetUserList">

- <wsp:Policy>

<wsp:PolicyReference URI="#OP_SscUsrGetUserList" />

</wsp:Policy>

<wsdl:input message="tns:SscUsrGetUserList" />

<wsdl:output message="tns:SscUsrGetUserListResponse" />

</wsdl:operation>

</wsdl:portType>

</wsdl:definitions>

Former Member
0 Kudos

Hi Anders,

in the webservices ABC (Address, Binding, Contract), the webservice url accounts for a physical 'address', and the wsdl file for the logical contract. The same .wsdl can be applied independent for the actual webservice location.

Although this theorie, typically the wsdl file does contain information about the address/service-location, in the "<wsdl:service name='your SAP service'> " node:

<wsdl:definition ...>

<wsdl:types>

<wsdl:message ...>

<wsdl:binding>

<wsdl:operation...>

</wsdl:binding>

<wsdl:service name='your SAP service'>

<wsdl:port name=''>

<soap:address location="http://XXXX.topforce.local:51080/sap/bc/srt/rfc/sap/Z_EE_CREATE_EMPLOYEE_EXPENSE?sap-client=200" />

If you have access to the SAP environment, you can also determine / access the webservice URL viatransaction WSADMIN, SOAMANAGER or NetWeaver DevStudio;

Best regards, William.

Former Member
0 Kudos

Hi William,

I am passing through the same situation. From your post, I check my web service and at the bottom where is <soap:address location, I have

http://MyServer/sap/bc/srt/rfc/sap/zws_wf_incinv_create_wf/200/zws_wf_incinv_create_wf/zws_wf_incinv...; />, do you mean in Adding Service Reference, I have to use this address? Using this address as it is, it does give me error saying "SRT: Wrong Content-Type and empty HTTP-Body received: ("HTTP Code 200:OK")

Just for your reference:

1. I added web service using "Add Service Reference"

2. The error "Unrecognized message" is giving me when I call the method

Many thanks,

Alpesh

Former Member
0 Kudos

Hi Alpesh,

In the Add Service Reference wizard in Visual Studio, you should use the wsdl-url; the wizard itself will extract from it the physical endpoint-adress if present and set it as default in the generated WCF proxy. However, for optimal flexibility you have to configure it yourself as WCF endpoint in your web.config.

Best regards, William.

Former Member
0 Kudos

Hi William,

Thank you for your reply, I configured it in web.config and now it's working. Many thanks for your tips/help.

Regards,