WSDL
-URL에서 wsdl.exe
을 통해 C# 프록시 클래스를 만들었습니다. 내가 제어하지 않는 웹 응용 프로그램의 컨텍스트에서이 프록시 클래스를 사용하고 있습니다 (따라서 web.conf
또는 이와 유사한 메서드를 변경할 수있는 방법이 없습니다). 나는 또한 내가 말하는 웹 서비스에서 어떤 것도 변경할 수 없다.SoapHttpClientProtocol에서 예기치 않은 콘텐츠 형식을받습니다.
Client found response content type of 'multipart/related; type="application/xop+xml";
boundary="uuid:5c314128-0dc0-4cad-9b1a-dc4a3e5917bb"; start="<[email protected]>";
start-info="application/soap+xml"', but expected 'application/soap+xml'.
,이 웹 서비스에 의해 사용되는 MTOM에 문제가 있습니다 :
웹 서비스를 호출
, 나는 다음과 같은 예외를받을 수 있습니다. 이제 수업을 MTOM을 수락하라고 말하려고했으나 찾은 건web.conf
의 구성입니다.
프록시 클래스는
SoapHttpClientProtocol
에서 파생 된이처럼 보이는
(관련 부분) :
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name = "myrequestSoapBinding", Namespace = "http://namespace.of.company.of.webservice/")]
public class myrequest : System.Web.Services.Protocols.SoapHttpClientProtocol
{
public myrequest(string url)
{
this.SoapVersion = System.Web.Services.Protocols.SoapProtocolVersion.Soap12;
this.Url = url;
}
[return: System.Xml.Serialization.XmlElementAttribute("return", Form = System.Xml.Schema.XmlSchemaForm.Unqualified, DataType = "base64Binary")]
public byte[] getDocuments([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified, DataType = "base64Binary")] byte[] input)
{
try
{
object[] results = this.Invoke("getDocuments", new object[] {
input});
return ((byte[])(results[0]));
}
catch (Exception ex)
{
var realResponse = StripResponse(ex.Message);
return Encoding.UTF8.GetBytes(realResponse.ToString());
}
}
}
getDocuments
의 try ... catch
예외 Message
밖으로 '진짜'서비스 응답을 얻는 해키 해결 방법입니다 - 어떤 이걸 어떻게 구현하고 싶지는 않습니다.
내 질문은 : MTOM
응답을 받아들이도록 프록시 클래스에서 바인딩을 변경하는 방법이 있습니까?