私はwsHTTPBindingとbasicHTTPBindingで公開されているwcf webserviceを持っています。後者は、次のように「/基本」であるとして、それは、エンドポイントのアドレスです指定:次のように RESTまたはJSONなしでbasichttpbindingを使用してwcf webserviceを呼び出す
<endpoint address="/basic" binding="basicHttpBinding" bindingConfiguration="theAwesomeBasicHttpServerBinding" contract="LOServices.Proxy.ServiceContracts.ILOService">
<identity>
<servicePrincipalName value="HTTP/MY_MACHINE_NAME" />
</identity>
</endpoint>
結合
が定義されている:<basicHttpBinding>
<binding name="theAwesomeBasicHttpServerBinding" maxReceivedMessageSize="5000000">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
私はjqueryのを使用してのwebMethodsのいずれかを呼び出すようにしようとしています。したがって、これは基本的なHTTPバインディングであり、RESTfulではないため、私はJSONを使用しません。次のように私が使用していますがそのために構成されている
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/ILOService/GetLoanActions</Action>
</s:Header>
<s:Body>
<GetLoanActions xmlns="http://tempuri.org/">
<request xmlns:d4p1="http://schemas.datacontract.org/2004/07/LOServices.Proxy.Requests" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<d4p1:AssociationNumber>3</d4p1:AssociationNumber>
<d4p1:IgnoreWarnings>false</d4p1:IgnoreWarnings>
</request>
</GetLoanActions>
</s:Body>
</s:Envelope>
実際のjavascript:
function callWs() {
var theRequest = " \
<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<s:Header> \
<Action s:mustUnderstand=\"1\" xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">http://tempuri.org/ILOService/GetLoanActions</Action> \
</s:Header> \
<s:Body> \
<GetLoanActions xmlns=\"http://tempuri.org/\"> \
<request xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/LOServices.Proxy.Requests\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\"> \
<d4p1:AssociationNumber>3</d4p1:AssociationNumber> \
<d4p1:IgnoreWarnings>false</d4p1:IgnoreWarnings> \
</request> \
</GetLoanActions> \
</s:Body> \
</s:Envelope>";
$.ajax({
type: "POST",
url: "http://localhost/LOServices/Services/LOService.svc/basic",
data: theRequest,
timeout: 10000,
contentType: "text/xml",
dataType: "xml",
async: false
});
}
私は、結果的に、以前の(成功した)私は、WCFテストクライアントを介してサービスに行われたことを呼び出してからのリクエストXMLを構築しています
私はこの方法でそれを実行するとwcfサービスから "Bad Request"を受け取るのに不幸ですが、それは私に後続することを多く残しません。
私はこの作業を少なくとも3時間はやってみることに苦労しています。だれかがアイデアを持っているなら、いくつか提案してもらえますか?
ありがとうございました。
これはまさに私が聞きたかったものです。ありがとうございます@carlosfigueira。タグ(および子)を削除する必要があることにも注意してください。 basicHTTPBindingはそれを好まなかった。 –
Jason