الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مشكلة في الاتصال بين الويب سرفيس المنشا بالدلفي و السي شارب .

بدأه زكيري عبد العالي في 31 مارس 2010 · 13 رد · 605 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

هناك مشكلة عندما اردت استراد الوظيفت FetchAll في الدوت نت

<definitions name="Iserviceservice" targetNamespace="http://tempuri.org/">

  <types>

    <xs:schema targetNamespace="urn:UPersoCollection">

      <xs:complexType name="TpersoCollection">

        <xs:sequence>
          <xs:element name="itms" type="ns1:TArray"/>
        </xs:sequence>
      </xs:complexType>

      <xs:complexType name="TArray">

        <xs:complexContent>

          <xs:restriction base="soapenc:Array">
            <xs:sequence/>
            <xs:attribute ref="soapenc:arrayType" n1:arrayType="ns2:Tperso[]"/>
          </xs:restriction>
        </xs:complexContent>
      </xs:complexType>
    </xs:schema>

    <xs:schema targetNamespace="urn:Uperso">

      <xs:complexType name="Tperso">

        <xs:sequence>
          <xs:element name="ID_Perso" type="xs:int"/>
          <xs:element name="Nom_Perso" type="xs:string"/>
          <xs:element name="Prenom_Perso" type="xs:string"/>
          <xs:element name="Age_Perso" type="xs:int"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
  </types>
  <message name="FetchAll0Request"/>

  <message name="FetchAll0Response">
    <part name="return" type="ns1:TpersoCollection"/>
  </message>

  <message name="getperso1Request">
    <part name="iperso" type="ns2:Tperso"/>
  </message>

  <message name="getperso1Response">
    <part name="return" type="ns2:Tperso"/>
  </message>

  <portType name="Iservice">

    <operation name="FetchAll">
      <input message="tns:FetchAll0Request"/>
      <output message="tns:FetchAll0Response"/>
    </operation>

    <operation name="getperso">
      <input message="tns:getperso1Request"/>
      <output message="tns:getperso1Response"/>
    </operation>
  </portType>

  <binding name="Iservicebinding" type="tns:Iservice">
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

    <operation name="FetchAll">
      <soap:operation soapAction="urn:serviceIntf-Iservice#FetchAll" style="rpc"/>

      <input>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:serviceIntf-Iservice"/>
      </input>

      <output>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:serviceIntf-Iservice"/>
      </output>
    </operation>

    <operation name="getperso">
      <soap:operation soapAction="urn:serviceIntf-Iservice#getperso" style="rpc"/>

      <input>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:serviceIntf-Iservice"/>
      </input>

      <output>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:serviceIntf-Iservice"/>
      </output>
    </operation>
  </binding>

  <service name="Iserviceservice">

    <port name="IservicePort" binding="tns:Iservicebinding">
      <soap:address location="http://webdev1:8083/Mywebservice.dll/soap/Iservice"/>
    </port>
  </service>
</definitions>

هذا الملف الناتج عن الويب سرفيس

و عندما كتبت ب c# الكود التالي

 private void button1_Click(object sender, EventArgs e)
        {
            Iserviceservice oservice = new Iserviceservice();
            Tperso[] ms = oservice.FetchAll().itms;
            int i = ms.Count();
            MessageBox.Show(Convert.ToString(i));
        }

طبعا بعد اضافة client wsdl

حدث خطأ

وكانه لم يفهم XML

post-1034-12700288397062_thumb.jpg

#2

السلام عليكم

الرابطة التالية بها درس حولالتطبيقات متعددة الطبقات N-tier طريقة I و لكن عندي مشكلة في الاتصال بين الويب سرفيس المنشا بالدلفي و السي شارب .

ارجو المساعدة

#4

لقد نقلت المشاركة كما هي لكن في ما بعد سانقل الكل في موضوع الدرس ان شاء الله وان لم بكن هناك مانع .

شكرا

#5

السلام عليكم

وينكم يارفاق

#6

ترجم لنا رسالة الخطأ من الفرنسية للعربية او الانجليزية على الاقل

Technical Lead Developer

My LinkedIn Profile

اللهم قنى شر الجهل و الجهلاء

( اقْتَرَبَ لِلنَّاسِ حِسَابُهُمْ وَهُمْ فِي غَفْلَةٍ مَّعْرِضُونَ ) {الأنبياء:1}

#7

من عيني يا اخ طارق

there is an error in XML document

يوجد خطأ في ملف XML

:blink:

الخطأ في السطر

oservice.FetchAll().itms;

تم تعديل هذه المشاركة بواسطة زكيري عبد العالي في 1 أبريل 2010 في 14:10

#8

للرفع مستعجل لاكمل الدرس

#9

ما المفترض ان يقوم هذا السطر بفعله

oservice.FetchAll().itms;

و ماهى الدالة المستخدمة فى الويب سيرفس التى تقوم بعمل Consume لها

Technical Lead Developer

My LinkedIn Profile

اللهم قنى شر الجهل و الجهلاء

( اقْتَرَبَ لِلنَّاسِ حِسَابُهُمْ وَهُمْ فِي غَفْلَةٍ مَّعْرِضُونَ ) {الأنبياء:1}

#10

السلام عليكم

اشكراك اخي طارق على تواصلك معي ساقدم لك نتبجة stub من wsdl الناتع عن webservice

class Iserviceservice

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;

namespace webdev1
{
    [DesignerCategory("code")]
    [DebuggerStepThrough]
    [GeneratedCode("System.Web.Services", "4.0.21006.1")]
    [WebServiceBinding(Name = "Iservicebinding", Namespace = "http://tempuri.org/")]
    public class Iserviceservice : SoapHttpClientProtocol
    {
        public Iserviceservice();

        public event FetchAllCompletedEventHandler FetchAllCompleted;
        public event getpersoCompletedEventHandler getpersoCompleted;

        public IAsyncResult BeginFetchAll(AsyncCallback callback, object asyncState);
        public IAsyncResult Begingetperso(Tperso iperso, AsyncCallback callback, object asyncState);
        public void CancelAsync(object userState);
        public TpersoCollection EndFetchAll(IAsyncResult asyncResult);
        public Tperso Endgetperso(IAsyncResult asyncResult);
        [SoapRpcMethod("urn:serviceIntf-Iservice#FetchAll", RequestNamespace = "urn:serviceIntf-Iservice", ResponseNamespace = "urn:serviceIntf-Iservice")]
        public TpersoCollection FetchAll();
        public void FetchAllAsync();
        public void FetchAllAsync(object userState);
        [SoapRpcMethod("urn:serviceIntf-Iservice#getperso", RequestNamespace = "urn:serviceIntf-Iservice", ResponseNamespace = "urn:serviceIntf-Iservice")]
        public Tperso getperso(Tperso iperso);
        public void getpersoAsync(Tperso iperso);
        public void getpersoAsync(Tperso iperso, object userState);
    }
}

class TpersoCollection

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace webdev1
{
    [Serializable]
    [GeneratedCode("System.Xml", "4.0.21006.1")]
    [DebuggerStepThrough]
    [DesignerCategory("code")]
    [SoapType(Namespace = "urn:UPersoCollection")]
    public class TpersoCollection
    {
        public TpersoCollection();

        public Tperso[] itms { get; set; }
    }
}

Tperso[] itms

هو جدول موجود في الكلاس TpersoCollection حيث كل عنصر من هذا الجودل هو عبارة عن ابجكة من الكلاس Tperso . و التي تحتوي على الحقول

using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Xml.Serialization;

namespace webdev1
{
    [Serializable]
    [DebuggerStepThrough]
    [SoapType(Namespace = "urn:Uperso")]
    [GeneratedCode("System.Xml", "4.0.21006.1")]
    [DesignerCategory("code")]
    public class Tperso
    {
        public Tperso();

        public int Age_Perso { get; set; }
        public int ID_Perso { get; set; }
        public string Nom_Perso { get; set; }
        public string Prenom_Perso { get; set; }
    }
}

تم تعديل هذه المشاركة بواسطة زكيري عبد العالي في 6 أبريل 2010 في 14:14

#11

لو اطلعت على الدرس لكان اسهل في فهم الوضوع ارجو ذلك

المهم انا اريد استرجاع سجلات لجدول perso في قاعدة بيانات مرورا ب3طبقات و مرحلة الويب سرفيس هي التي تسمح لي استعمال الطبقات في عدة لغاة و مثل c# في مثالي هذا .

شكرا

post-1034-12702142830759_thumb.jpg

تم تعديل هذه المشاركة بواسطة زكيري عبد العالي في 2 أبريل 2010 في 16:18

#12

للرفع

#13

يبدو لي أنها مشكلة في الـserialization.

هل جربت استخدام هذه الدالة مباشرة أي خارج إطار الويب سيرفس؟

#14

نعم استعملتها خارج و الويب سرفيس و ايضا بواسطة الويب سرفيس بالدلفي و اعطة النتيجة صحيحة .انضر الصورة 1

شكرا على تواصلك معي

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…