cancel
Showing results for 
Search instead for 
Did you mean: 

.NET Proxy

Former Member
0 Kudos

Hi erveryone

I have created a Webservice in my sap system. How can I use that in .NET?

When I add a web reference for the service in VS2005 it does not create any proxy file. Does anyone have some hints what might be wrong here?

THanks

regards

Martin

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Martin,

did you import the SAP webservice in VS via its WSDL ? Try that.

See:

  • Thread [WSDL Issue?|]

  • Whitepaper [Building Microsoft .NET Applications using Visual Studio 2005 and SAP NetWeaver Web Services|http://download.microsoft.com/download/5/7/f/57f1490e-8a8d-497b-bbae-ec2a44b3799f/SAPNetweaverWebServicesVS2005.pdf]

Best regards, William.

Former Member
0 Kudos

Hi William

I have already read the two articles / threads you mention. However, that did not bring any success.

Any other hints?

thanks

regards

Martin

Former Member
0 Kudos

Hi Martin,

how do you reference the SAP webservice in VS; via its wsdl or directly at the webservice adress/url ?

Do you get any errors in the output window ?

Can you include the wsdl of the SAP webservice? I'll can then try generating a proxy to it, and investigate in VS what goes wrong.

Best regards, William.

Former Member
0 Kudos

Hi William

I have tried to create the webreference by clicking Add Webreference in Visual Studio 2005 and then using the service URL as well as the WSDL. None of the both did work. Here is what my SAP AS genereated as WSDL for a Service calling the BAPI FLIGHT_GET_LIST.

I tried several times not but could not inclide the WSDL into the posting. However, I did not receive any errors. When generating the proxy in VS 2005. The WSDL.exe tool gave a message that the file does not conform to some wsdl 1.1 standard.

THanks

regards

Martin

Edited by: Martin on Nov 25, 2009 8:37 AM

Addition: I have also tried to rename parameters to parameter but without success.

Edited by: Martin on Nov 25, 2009 8:41 AM

Former Member
0 Kudos

Hi Martin,

if possible, you should upgrade to VS 2008.

Within VS2008 I can successfully generate a proxy by the option 'Add Service Reference', whereby referencing the .wsdl you included (had that contained in a local file for this test).

Add Service Reference is new in VS2008; it's not within VS2005.

See also the former mentioned thread, especially from [here|], Dennis had the same issue initially

Best regards, William.

Former Member
0 Kudos

Hi William

I will try and download VS2008 Express Edition. I guess the web reference is working with this version as well. As soon as I have something new, I will let you know.

Thanks so far.

best regards

Martin

Former Member
0 Kudos

Hi William

thanks for the tip with VS2008. I tried with the express edition and added a web service reference. This seems to work so far. However I am still facing problem on how to call that service.

I have created a simple service in SAP fpr the Company Code Get List BAPI. The proxy is creted in visual studio and I am using iti with the following code:


Z_CC_LIST.Z_CC_LISTClient myClient = new Z_CC_LIST.Z_CC_LISTClient();
                myClient.ClientCredentials.UserName.UserName = tbUser.Text;
                myClient.ClientCredentials.UserName.Password = tbPwd.Text;

When executing this piece of code I get an exception:

Der Typeninitialisierer für "System.ServiceModel.ClientBase`1" hat eine Ausnahme verursacht.

The Type initializer for "..." threw an exception.

Do you have any idea what that means?

Thanks

Regards

Martin

Former Member
0 Kudos

Hi Martin,

you need to configure an endpoint for the SAP webservice in the [web or app].config of your client; binding + client-address

Something like:

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">

<system.serviceModel>

<bindings>

<basicHttpBinding>

<binding name="Z_EE_CREATE_EMPLOYEE_EXPENSESoapBinding" closeTimeout="00:01:00"

openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"

allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"

maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"

messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

useDefaultWebProxy="true">

<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"

maxBytesPerRead="4096" maxNameTableCharCount="16384" />

<security mode="None">

<transport clientCredentialType="None" proxyCredentialType="None"

realm="" />

<message clientCredentialType="UserName" algorithmSuite="Default" />

</security>

</binding>

</basicHttpBinding>

</bindings>

<client>

<endpoint address="http://XXXXXXXXXX.topforce.local:YYY/sap/bc/srt/rfc/sap/Z_EE_CREATE_EMPLOYEE_EXPENSE?sap-client=200"

binding="basicHttpBinding" bindingConfiguration="Z_EE_CREATE_EMPLOYEE_EXPENSESoapBinding"

contract="TopForce.ExpensesHandling.Integration.Services.SAP.Z_EE_CREATE_EMPLOYEE_EXPENSE"

name="Z_EE_CREATE_EMPLOYEE_EXPENSESoapBinding" />

</client>

</system.serviceModel>

</configuration>

Best regards, William.

Former Member
0 Kudos

EDIT:

I have now succeeded in establishing the connection. However I receive the exception unknown messageversion.

Do you know what that means?

Thanks

regards

Martin

Hi William

sorry for the delayed reply but I finally had time to try your suggestions. Unfortunately I am receiving another error now:

Die HTTP-Anforderung ist beim Clientauthentifizierungsschema "Anonymous" nicht autorisiert.

The HTTP-Request is not authorized with the Client-Authorization-Scheme Anonymous

What does that mean? I have added user name credentials as seen in my previous post above.

Thanks!

regards

Martin

Edited by: Martin on Dec 7, 2009 2:50 PM

Former Member
0 Kudos

Hi Martin,

what is the technology of your .NET client; might it be Silverlight? If so, I suggest that you read thread[ 'Unrecognized message version.' Error|; on this forum - Anders experienced a similar error message trying to directly invoke from a Silverlight client a SAP BAPI webservice. As I answerred there, such a setup is currently not without problems, architectural-sound approach is to use an intermediate WCF-based webservice.

Best regards, William.

Former Member
0 Kudos

Hello William,

I am using a plain c# application.

regards

Martin

Former Member
0 Kudos

Hi William,

I am developing several WCF clients to consume SAP-PI service methods. When authentication is turned on in SAP PI, my clients work fine. We turned it off at first just so I would not have deal with the authentication issues.

We have now turned it on, and so naturally my clients fail. As I have been told, SAP PI is only requiring basic authentication.

I have been doing a LOT of searching and your answers and the code fragments you show seem to make it all look so easy. But then other links such as the the 3 part series written by Martin Raepple titled "Web Services Security Interoperability Between SAP NetWeaver 7.0 and Microsoft Windows Communication Foundation" (see: http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/e0ecb76a-2f70-2a10-8bb6-bf5d4f1fb750) seem to make it sound like it won't work out of the box without some pretty significant reconfigurations.

What am I missing? Is this really that hard?

Any advice you can share would be most welcome!

Brad