내 클라이언트가 URL을 WSDL 웹 서비스에 전달해야합니다. 그들은 SoapHttpClientProtocol Url 속성을 사용하여 값을 설정합니다.웹 서비스 사용자로부터 url 속성에 액세스하는 방법
namespace MyMath {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;
[System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", Namespace="http://www.contoso.com/")]
public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol {
[System.Diagnostics.DebuggerStepThroughAttribute()]
public MyMath() {
this.Url = "http://www.contoso.com/math.asmx";
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.contoso.com/Add", RequestNamespace="http://www.contoso.com/", ResponseNamespace="http://www.contoso.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int Add(int num1, int num2) {
object[] results = this.Invoke("Add", new object[] {num1,
num2});
return ((int)(results[0]));
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public System.IAsyncResult BeginAdd(int num1, int num2, System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("Add", new object[] {num1,
num2}, callback, asyncState);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
public int EndAdd(System.IAsyncResult asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((int)(results[0]));
}
}
}
그러나, 나는 내 웹 메서드 내 soapClient.Url에 패스를했다 값을 확인해야합니다 예 내 클라이언트는 "http://www.contoso.com/math.asmx을"되는 URL 값을 전달합니다. 예 웹 서비스 :
<%@ WebService Language="C#" Class="MyMath"%>
using System.Web.Services;
using System;
[WebService(Namespace="http://www.contoso.com/")]
public class MyMath {
[ WebMethod ]
public int Add(int num1, int num2) {
//need to place logic to check the url pass by clients.
//if (url) place a logic here
//how do i check the SoapHttpClientProtocol url property?
return num1+num2;
}
}
난 내 웹 서비스 메서드에 내 고객에 의해 설정이 SoapHttpClientProtocol URL 속성 값에 액세스 할 수있는 방법을
?
아무쪼록 조언을 구하십시오.
어떤 종류의 웹 서비스입니까? ASMX? WCF? –
웹 서비스는 ASMX입니다. – jeff