<%@ WebHandler Language="C#" Class="callWebServiceSap" %> using System; using System.Web; using System.Xml; using System.Xml.Linq; using DK.XuWei.WebMes; using System.Collections; using System.Collections.Generic; using System.Dynamic; using System.IO; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; using System.Xml.Serialization; using System.Web.Services.Description; public class callWebServiceSap : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plan"; string postData = @" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "; postData = postData.Replace("'", "\""); string url = "http://S4DEVAPP.hegii.com:8080/sap/bc/srt/rfc/sap/zppfm008/240/zppfm008/zppfm008_bind"; NetworkCredential credential = new NetworkCredential("hgsapdk", "Sapdk#240"); XmlDocument xml = SoapClient.Post(url, postData, credential); context.Response.Write(xml.InnerXml + "\n\n"); string ztype = xml.DocumentElement["soap-env:Body"]["n0:ZPPFM008Response"]["ZTYPE"].InnerXml; string zmsg = xml.DocumentElement["soap-env:Body"]["n0:ZPPFM008Response"]["ZMSG"].InnerXml; context.Response.Write("ZTYPE:" + ztype + " "); context.Response.Write("ZMSG:" + zmsg + " "); } public bool IsReusable { get { return false; } } }