on 01-29-2004 4:34 PM
Hello,
does anyone have experience with Visual .Net 2003 consuming a Web Service from SAP, e.g. a ABAP Function module exposed as WS and the WSDL which the WebService browser creates?
I used the C# example which comes from the SOAP Runtime and it does not work, e.g. the C# program gets only null values back. I used MS Infopath and that gets the value back from my web service but it cannot handle complex types, e.g. internal tables.
Stefan
Hi Alexander,
the support pack is SP 39 for WAS 620. I have not tested this as I had my solution working without the fix in SP 39.
Based on that I took the serialization out of the reference.cs the Visual Studio.Net creates from the WSDL you supoly.
Here is my piece of code:
namespace ZBxCreateOrder.WebAS {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
// [System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="ZBxCreateOrderBinding", Namespace="urn:sap-com:document:sap:soap:functions:mc-style")]
[System.Xml.Serialization.XmlIncludeAttribute(typeof(Zbxorditem[]))]
public class ZBxCreateOrderService : System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public ZBxCreateOrderService() {
this.Url = "http://sapnts65.scottishcourage.com:8000/sap/bc/soap/zrfcbarbox";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.sap.com/ZBxCreateOrder", RequestNamespace="urn:sap-com:document:sap:soap:functions:mc-style", ResponseElementName="ZBxCreateOrderResult", ResponseNamespace="urn:sap-com:document:sap:soap:functions:mc-style", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
I hope it helps.
Stefan
[return: System.Xml.Serialization.XmlElementAttribute("Cwofactor")]
public string ZBxCreateOrder( string Customer, string Deldate, Zzbxemaildetails Emaildetails, ref Zbxorditem[] Items, string Ponumber, out string Orderno, out Bapireturn Wsreturn) {
object[] results = this.Invoke("ZBxCreateOrder", new object[] {
Customer,
Deldate,
Emaildetails,
Items,
Ponumber});
Items = ((Zbxorditem[])(results[1]));
Orderno = ((string)(results[2]));
Wsreturn = ((Bapireturn)(results[3]));
return ((string)(results[0]));
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alexiender,
I am trying to consume web service from my c# application bu am not able for that it's gives the error "Request failed with HTTP status 401:Unauthorized" i don't know why if u have a idea then plz or if u have a sample code, then provide me .I am very thankful for that .
I am using the visual studio 2005 and also not using the SAP.NET Connector.
thanx
regards
sandeep dabral
Hello Stefan,
calling RFC-function over Soap from C# should work fine. It's important to set the Creadentials property to a new NetworkCredentials object setting the correctl usrername and password.
If client is different than 0, it must be specified at the URL as "sap-client" query string parameter with three digits, e.g. "http://mysapserver:1080/sap/bc/soap/rfc?sap-client=001". You should also set PreAuthenticate to true.
Regards,
Reiner.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Reiner,
it was a SAP bug and they are correcting it in a Support Pack. I got it to run after correcting the proxy class the .Net generates from the SAP WSDL by hand. It took me a while but I got it done.
Since the support pack is not yet available I will try the out of the box approach once again when we have implemented it.
Regards
Stefan
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.