コード例 #1
0
ファイル: LocationService.cs プロジェクト: mobilipia/Win7
        private Response GetNetworkDesignListForServiceResponse(ForServiceMethodArgs FSMA)
        {
            byte[] oByte = null;
                Response resp = null;
                UTF8Encoding encoding = new UTF8Encoding();
                string soapEnvelope = null;

                soapEnvelope = string.Format("<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body><GetNetworkDesignListForService xmlns=\"http://cisco.com/mse/location\" serviceId=\"{0}\" options=\"{1}\"><AesBusinessSession mask=\"-1\" id=\"{2}\"/></GetNetworkDesignListForService></soap:Body></soap:Envelope>",FSMA.serviceId,FSMA.options,FSMA.AesBusinessSession.id);

                Trace.WriteLine("SOAP Request::" + soapEnvelope);
                oByte = encoding.GetBytes(soapEnvelope);
                string contType = null;
                byte[] ndlResponse = SendNetworkDesignRequest(oByte, "urn:#GetNetworkDesignListForService", ref contType);

                    ImageParser imp = new ImageParser(ndlResponse);
                    string soapEnvelop = imp.GetSoapEnvelop();

                    resp = (Response)ParseSoapResponse(soapEnvelop, typeof(Response));
                    Attachment atch = imp.GetNext();
                    System.Collections.Hashtable htImagePaths = new System.Collections.Hashtable();
                    Trace.WriteLine("htImagePaths" + htImagePaths);
                    String curDir = Directory.GetCurrentDirectory();
                    Directory.CreateDirectory("Images");
                    Directory.SetCurrentDirectory("Images");
                    while (atch != null)
                    {

                        String CID = atch.ContentID;
                        Trace.WriteLine("CID" + CID.Length);
                        CID = CID.Substring(CID.IndexOf("domain"));
                        CID = CID.Substring(0, CID.Length - 1);
                        Trace.WriteLine("CID" + CID);
                        String sFileName = Directory.GetCurrentDirectory() + "\\" + CID + "." + atch.Extension;//Path.GetTempFileName();

                        Trace.WriteLine("Path" + sFileName);
                        string extn = atch.Extension;
                        if (extn != null)
                        {
                            sFileName = Path.ChangeExtension(sFileName, extn);
                        }
                        BinaryWriter bWrit = new BinaryWriter(new FileStream(sFileName, FileMode.Create));
                        System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding();
                        string str = enc.GetString(atch.Data);
                        if (str.Contains("------=_Part_")) str = str.Substring(0, str.IndexOf("------=_Part_"));
                        byte[] imageBytes = Convert.FromBase64String(str);

                        bWrit.Write(imageBytes);
                        bWrit.Close();
                        htImagePaths.Add(atch.ContentID, sFileName);
                        atch = imp.GetNext();
                        Trace.WriteLine("soapEnvelop3");
                        UpdateResponseWithImagePath(resp, htImagePaths, sFileName);
                    }

                return resp;
        }
コード例 #2
0
ファイル: LocationService.cs プロジェクト: mobilipia/Win7
 /// <remarks/>
 public void GetNetworkDesignListForServiceAsync(ForServiceMethodArgs GetNetworkDesignListForService1)
 {
     this.GetNetworkDesignListForServiceAsync(GetNetworkDesignListForService1, null);
 }
コード例 #3
0
ファイル: LocationService.cs プロジェクト: mobilipia/Win7
 /// <remarks/>
 public void GetNetworkDesignListForServiceAsync(ForServiceMethodArgs GetNetworkDesignListForService1, object userState)
 {
     if ((this.GetNetworkDesignListForServiceOperationCompleted == null))
     {
         this.GetNetworkDesignListForServiceOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetNetworkDesignListForServiceOperationCompleted);
     }
     this.InvokeAsync("GetNetworkDesignListForService", new object[] {
             GetNetworkDesignListForService1}, this.GetNetworkDesignListForServiceOperationCompleted, userState);
 }
コード例 #4
0
ファイル: LocationService.cs プロジェクト: mobilipia/Win7
 /// <remarks/>
 public System.IAsyncResult BeginGetNetworkDesignListForService(ForServiceMethodArgs GetNetworkDesignListForService1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("GetNetworkDesignListForService", new object[] {
             GetNetworkDesignListForService1}, callback, asyncState);
 }