50٪ تخفیف روی تمام دوره‌ها!
پایان تخفیف تا:
مشاهده دوره‌ها
0

خطا در اتصال SOAP Client

سلام دوستان

به یک سرویس SOAP که میخواهیم متصل شویم ، خطاهای زیر رو دریافت می کنیم:

1- در حالت basicHttpBinding خطای version میگیریم که ظاهرا باید Soap12 تنظیم بشه.


System.ServiceModel.CommunicationException: 'Unrecognized message version.'


2- برای دادن ورژن ، تنظیم رو روی customBinding میزاریم و خطای زیر رو میگیریم :

System.ServiceModel.ProtocolException: 'The content type text/xml; charset=utf-8 of the response message does 
not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder,
be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were:
'<?xml version="1.0" encoding="utf-8"?><wsdl:definitions name="Manifest" targetNamespace="http://xyz.com"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex"
xmlns:i0="http://tempuri.org/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:
wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://xyz.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"><wsdl:import name'.'


تنظیمات App.config به این صورت هستند :

<system.serviceModel>

  <bindings>

    <basicHttpsBinding>
    <binding name="BasicHttpBinding_IManSVC" >
      <security mode="Transport" />
    </binding>
  </basicHttpsBinding>

   <customBinding>
  <binding name="CustomBinding_IManSVC" >
  <textMessageEncoding messageVersion="Soap12"/>
  <httpTransport />
  </binding>
 </customBinding>

</bindings>

  <client>

    <endpoint address="https://xyz/ManSVC"
    binding="basicHttpsBinding" bindingConfiguration="BasicHttpBinding_IManSVC"
    contract="IManiSVC" name="BasicHttpBinding_IManSVC" />

  <endpoint address="http://xyzl/ManSVC"
            binding="customBinding" bindingConfiguration="CustomBinding_IManSVC"
            contract="IManSVC" name="CustomBinding_IManSVC" />

</client>

</system.serviceModel>


پرسیده شده در 1403/03/23 توسط

2 پاسخ

0

سلام وقت بخیر

از اونجایی که ادرس soap مربوطه رو نذاشتید ، و امکان تست نیست ، من صرفا از روی خطا تونستم از stackoverflow یه راهکاری پیدا کنم . راهکار این هست که اگر اخر endpoint تون ?wsdl هست ، اون رو حذف کنین. مثال:

http://server/service?wsdl

تبدیل بشه به:

http://server/service


پاسخ در 1403/03/23 توسط
0


سلام

اون قسمت رو کلا در انتهای endpoint نداشت ، راستش به دلیل اینکه سرویس مال یه سازمان دولتیه ، آدرسش رو تو متن سوال تعییر دادم.

براتون توی خصوصی میفرستم. اگه زحمتی نبود ، بررسی کنید. ممنون

پاسخ در 1403/03/24 توسط

پاسخ شما